@parall/daemon 1.58.0 → 1.58.2

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.58.0",
3
- "built_at": "2026-08-30T07:17:02.587Z",
2
+ "version": "1.58.2",
3
+ "built_at": "2026-08-31T17:39:36.772Z",
4
4
  "min_node_version": "20.0.0",
5
5
  "files": {
6
6
  "bb-browser-daemon.js": {
@@ -16,29 +16,29 @@
16
16
  "size": 18
17
17
  },
18
18
  "parall-browser-pod.js": {
19
- "sha256": "22cf8a224a89c91256969b5ef462b009af7b23b795e5a90577a44099124c5f6b",
20
- "size": 2971772
19
+ "sha256": "4841b686837495489d1834d25f14fca452daaed9be52ddb4692b302ce2c6d3bc",
20
+ "size": 2972260
21
21
  },
22
22
  "parall-channel-exec.js": {
23
23
  "sha256": "7c2a6e12483a45e9eb4a42cd7d4cdd3c4fa21dd09ac1347d9a3e177b4ddee930",
24
24
  "size": 7220
25
25
  },
26
26
  "parall-claude-agent.js": {
27
- "sha256": "024e1c4e47530dc0f7081cd89abd18a726531e09ef4973b8148135e5cd707759",
28
- "size": 2813575
27
+ "sha256": "5f59e7dcaca4767befb052001114875411b8e930dfe567eafbced3a78b359985",
28
+ "size": 2815668
29
29
  },
30
30
  "parall-codex-agent.js": {
31
- "sha256": "687f07dfa7deb4e90bc6997bb9c0c227c4b2e6379cd194bfbd342d59403c82ae",
32
- "size": 2844057
31
+ "sha256": "2a99b85b443e81863cc418a572c35bbad9660868828b634a1a00a87c8840ea8a",
32
+ "size": 2845907
33
33
  },
34
34
  "parall-daemon.js": {
35
- "sha256": "351656776702b981df5a0abd35d911088e0acde4fb0738c8288632bf9b85806e",
36
- "size": 3040630
35
+ "sha256": "e2c686bde1bc01107de15c4e970ab85160f9262878ab4b034ff1f4dff4ea15a6",
36
+ "size": 3041257
37
37
  },
38
38
  "parall-openclaw-agent.js": {
39
39
  "sha256": "856a1c3a9ae0ffef8efe2481fa1171dbeb1d67cccb88616aa9bf16da96a69355",
40
40
  "size": 9923
41
41
  }
42
42
  },
43
- "signature": "x5c625rzvIm7kfd5Re7oFBt5D9ortWxexu0jathft/la7zPAAI6U1Dwwxzt4ptGak2iLz0vSK+uiOUrRyrdbCg=="
43
+ "signature": "aVhILaJo6FTemM7X/iQDr+yuH8gtE/p5B070rqImrvaqz5fnMg9HlHz5h7MsbCtc8zndR68VOBR+rxksbF+GAg=="
44
44
  }
@@ -63536,6 +63536,18 @@ function attachmentEndpoints(apiBase) {
63536
63536
  };
63537
63537
  }
63538
63538
 
63539
+ // ts/sdk/dist/wechat-endpoints.js
63540
+ function wechatEndpoints(apiBase) {
63541
+ const agentBase = (orgId) => `${apiBase}/orgs/${orgId}/agents/me/wechat`;
63542
+ return {
63543
+ WECHAT_CONTACTS: (orgId) => `${agentBase(orgId)}/contacts`,
63544
+ WECHAT_HISTORY: (orgId) => `${agentBase(orgId)}/history`,
63545
+ WECHAT_MEDIA: (orgId) => `${agentBase(orgId)}/media`,
63546
+ WECHAT_PROFILE: (orgId) => `${agentBase(orgId)}/profile`,
63547
+ WECHAT_STATUS: (orgId) => `${agentBase(orgId)}/status`
63548
+ };
63549
+ }
63550
+
63539
63551
  // ts/sdk/dist/constants.js
63540
63552
  var API_BASE = "/api/v1";
63541
63553
  var WIKI_BASE = "/wiki/v1";
@@ -63789,10 +63801,7 @@ var ENDPOINTS = {
63789
63801
  SLACK_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/members`,
63790
63802
  SLACK_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
63791
63803
  // WeChat tier-B read verbs (agent-only; internal research preview).
63792
- WECHAT_CONTACTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
63793
- WECHAT_HISTORY: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/history`,
63794
- WECHAT_PROFILE: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/profile`,
63795
- WECHAT_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/status`,
63804
+ ...wechatEndpoints(API_BASE),
63796
63805
  // Invitations (org-scoped, admin)
63797
63806
  ORG_INVITATIONS: (orgId) => `${API_BASE}/orgs/${orgId}/invitations`,
63798
63807
  ORG_INVITATION: (orgId, invId) => `${API_BASE}/orgs/${orgId}/invitations/${invId}`,
@@ -64261,6 +64270,10 @@ var WechatClient = class extends TaskLabelClient {
64261
64270
  params.set("limit", String(query.limit));
64262
64271
  return this.request("GET", `${ENDPOINTS.WECHAT_HISTORY(orgId)}?${params.toString()}`);
64263
64272
  }
64273
+ /** Fetch and cache one WeChat image or completed file on first explicit read. */
64274
+ async materializeWechatMedia(orgId, messageId) {
64275
+ return this.request("POST", ENDPOINTS.WECHAT_MEDIA(orgId), { message_id: messageId });
64276
+ }
64264
64277
  /** Connected WeChat account identity. */
64265
64278
  async wechatProfile(orgId) {
64266
64279
  return this.request("GET", ENDPOINTS.WECHAT_PROFILE(orgId));
@@ -66896,7 +66909,8 @@ var ParallClient = class _ParallClient extends AttachmentClient {
66896
66909
  * `404 NOT_FOUND`. An installed cross-org clip with no connection yet lists
66897
66910
  * as an empty array — including one whose approved auth mode cannot be
66898
66911
  * configured at all (auth=none), which the write path is what refuses. With
66899
- * `cap:clip-mcp` off the route is not registered at all.
66912
+ * `cap:clip-mcp` off the route is not registered at all. The envelope also
66913
+ * carries `official_oauth_ready` (see MCPConnectionListResponse).
66900
66914
  */
66901
66915
  async listClipMCPConnections(orgId, clipId) {
66902
66916
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
@@ -51544,6 +51544,18 @@ function attachmentEndpoints(apiBase) {
51544
51544
  };
51545
51545
  }
51546
51546
 
51547
+ // ts/sdk/dist/wechat-endpoints.js
51548
+ function wechatEndpoints(apiBase) {
51549
+ const agentBase = (orgId) => `${apiBase}/orgs/${orgId}/agents/me/wechat`;
51550
+ return {
51551
+ WECHAT_CONTACTS: (orgId) => `${agentBase(orgId)}/contacts`,
51552
+ WECHAT_HISTORY: (orgId) => `${agentBase(orgId)}/history`,
51553
+ WECHAT_MEDIA: (orgId) => `${agentBase(orgId)}/media`,
51554
+ WECHAT_PROFILE: (orgId) => `${agentBase(orgId)}/profile`,
51555
+ WECHAT_STATUS: (orgId) => `${agentBase(orgId)}/status`
51556
+ };
51557
+ }
51558
+
51547
51559
  // ts/sdk/dist/constants.js
51548
51560
  var API_BASE = "/api/v1";
51549
51561
  var WIKI_BASE = "/wiki/v1";
@@ -51797,10 +51809,7 @@ var ENDPOINTS = {
51797
51809
  SLACK_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/members`,
51798
51810
  SLACK_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
51799
51811
  // WeChat tier-B read verbs (agent-only; internal research preview).
51800
- WECHAT_CONTACTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
51801
- WECHAT_HISTORY: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/history`,
51802
- WECHAT_PROFILE: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/profile`,
51803
- WECHAT_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/status`,
51812
+ ...wechatEndpoints(API_BASE),
51804
51813
  // Invitations (org-scoped, admin)
51805
51814
  ORG_INVITATIONS: (orgId) => `${API_BASE}/orgs/${orgId}/invitations`,
51806
51815
  ORG_INVITATION: (orgId, invId) => `${API_BASE}/orgs/${orgId}/invitations/${invId}`,
@@ -52360,6 +52369,10 @@ var WechatClient = class extends TaskLabelClient {
52360
52369
  params.set("limit", String(query.limit));
52361
52370
  return this.request("GET", `${ENDPOINTS.WECHAT_HISTORY(orgId)}?${params.toString()}`);
52362
52371
  }
52372
+ /** Fetch and cache one WeChat image or completed file on first explicit read. */
52373
+ async materializeWechatMedia(orgId, messageId) {
52374
+ return this.request("POST", ENDPOINTS.WECHAT_MEDIA(orgId), { message_id: messageId });
52375
+ }
52363
52376
  /** Connected WeChat account identity. */
52364
52377
  async wechatProfile(orgId) {
52365
52378
  return this.request("GET", ENDPOINTS.WECHAT_PROFILE(orgId));
@@ -54995,7 +55008,8 @@ var ParallClient = class _ParallClient extends AttachmentClient {
54995
55008
  * `404 NOT_FOUND`. An installed cross-org clip with no connection yet lists
54996
55009
  * as an empty array — including one whose approved auth mode cannot be
54997
55010
  * configured at all (auth=none), which the write path is what refuses. With
54998
- * `cap:clip-mcp` off the route is not registered at all.
55011
+ * `cap:clip-mcp` off the route is not registered at all. The envelope also
55012
+ * carries `official_oauth_ready` (see MCPConnectionListResponse).
54999
55013
  */
55000
55014
  async listClipMCPConnections(orgId, clipId) {
55001
55015
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
@@ -59304,6 +59318,14 @@ function resolveRuntimeContextWindow(resolvedModel, defaults, llmSource2) {
59304
59318
  const contextWindow = defaults.contextWindow;
59305
59319
  return typeof contextWindow === "number" && Number.isSafeInteger(contextWindow) && contextWindow > 0 ? contextWindow : void 0;
59306
59320
  }
59321
+ function resolveRuntimeMaxTokens(resolvedModel, defaults, llmSource2) {
59322
+ if (llmSource2 !== "parall")
59323
+ return void 0;
59324
+ if (!resolvedModel || resolvedModel !== defaults.model)
59325
+ return void 0;
59326
+ const maxTokens = defaults.maxTokens;
59327
+ return typeof maxTokens === "number" && Number.isSafeInteger(maxTokens) && maxTokens > 0 ? maxTokens : void 0;
59328
+ }
59307
59329
  function deriveModelIsPin(defaults, profile) {
59308
59330
  return defaults.modelIsPin !== void 0 ? defaults.modelIsPin : isPlatformModelOverride(profile);
59309
59331
  }
@@ -59341,38 +59363,42 @@ function runtimeModelConfig(canonicalModel, runtimeType, config) {
59341
59363
  const catalog = Array.isArray(parall.models) ? parall.models : [];
59342
59364
  const match = catalog.find((model) => model.id === canonicalModel);
59343
59365
  if (!match) {
59344
- return !runtime || runtime === "openclaw" || runtime === "hermes" ? { model: canonicalModel, contextWindow: null } : null;
59366
+ return !runtime || runtime === "openclaw" || runtime === "hermes" ? { model: canonicalModel, contextWindow: null, maxTokens: null } : null;
59345
59367
  }
59346
59368
  const contextWindow = typeof match.contextWindow === "number" && Number.isSafeInteger(match.contextWindow) && match.contextWindow > 0 ? match.contextWindow : null;
59369
+ const maxTokens = typeof match.maxTokens === "number" && Number.isSafeInteger(match.maxTokens) && match.maxTokens > 0 ? match.maxTokens : null;
59347
59370
  if (!runtime || runtime === "openclaw" || runtime === "hermes") {
59348
- return { model: canonicalModel, contextWindow };
59371
+ return { model: canonicalModel, contextWindow, maxTokens };
59349
59372
  }
59350
59373
  const runtimeNames = match.runtime_names ?? {};
59351
59374
  const runtimeName = runtimeNames[runtime];
59352
59375
  if (typeof runtimeName === "string" && runtimeName) {
59353
59376
  return {
59354
59377
  model: runtimeName,
59355
- contextWindow: runtimeName === canonicalModel ? contextWindow : null
59378
+ contextWindow: runtimeName === canonicalModel ? contextWindow : null,
59379
+ maxTokens: runtimeName === canonicalModel ? maxTokens : null
59356
59380
  };
59357
59381
  }
59358
- return { model: canonicalModel, contextWindow };
59382
+ return { model: canonicalModel, contextWindow, maxTokens };
59359
59383
  }
59360
59384
  function extractDefaults(config, runtimeType) {
59361
59385
  const agents = config.agents ?? {};
59362
59386
  const defaults = agents.defaults ?? {};
59363
59387
  let model = null;
59364
59388
  let contextWindow = null;
59389
+ let maxTokens = null;
59365
59390
  if (typeof defaults.model === "string" && defaults.model) {
59366
59391
  const canonicalModel = defaults.model.replace(/^parall-anthropic\//, "").replace(/^parall\//, "");
59367
59392
  const resolved = runtimeModelConfig(canonicalModel, runtimeType, config);
59368
59393
  model = resolved?.model ?? null;
59369
59394
  contextWindow = resolved?.contextWindow ?? null;
59395
+ maxTokens = resolved?.maxTokens ?? null;
59370
59396
  }
59371
59397
  let thinkingEffort = null;
59372
59398
  if (typeof defaults.thinking_effort === "string" && defaults.thinking_effort) {
59373
59399
  thinkingEffort = defaults.thinking_effort;
59374
59400
  }
59375
- return { model, thinkingEffort, contextWindow };
59401
+ return { model, thinkingEffort, contextWindow, maxTokens };
59376
59402
  }
59377
59403
  function createPlatformConfigManager(opts) {
59378
59404
  const { client, stateDir, runtimeType, log: log2 } = opts;
@@ -59381,6 +59407,7 @@ function createPlatformConfigManager(opts) {
59381
59407
  model: null,
59382
59408
  thinkingEffort: null,
59383
59409
  contextWindow: null,
59410
+ maxTokens: null,
59384
59411
  modelIsPin: void 0
59385
59412
  };
59386
59413
  let currentRawConfig = null;
@@ -61938,7 +61965,11 @@ function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
61938
61965
  result.CLAUDE_CODE_EFFORT_LEVEL = opts.effortLevel;
61939
61966
  }
61940
61967
  if (typeof opts.contextWindow === "number" && Number.isSafeInteger(opts.contextWindow) && opts.contextWindow > 0) {
61941
- result.CLAUDE_CODE_MAX_CONTEXT_TOKENS = String(opts.contextWindow);
61968
+ let inputBudget = opts.contextWindow;
61969
+ if (typeof opts.maxTokens === "number" && Number.isSafeInteger(opts.maxTokens) && opts.maxTokens > 0 && opts.maxTokens < opts.contextWindow) {
61970
+ inputBudget = opts.contextWindow - opts.maxTokens;
61971
+ }
61972
+ result.CLAUDE_CODE_MAX_CONTEXT_TOKENS = String(inputBudget);
61942
61973
  }
61943
61974
  if (opts.capabilityBinDir) {
61944
61975
  const pathKey = process.platform === "win32" ? Object.keys(result).find((k) => k.toUpperCase() === "PATH") ?? "PATH" : "PATH";
@@ -62101,10 +62132,12 @@ var ClaudeCodeAdapter = class {
62101
62132
  _model;
62102
62133
  _effortLevel;
62103
62134
  _contextWindow;
62135
+ _maxTokens;
62104
62136
  constructor(opts) {
62105
62137
  this.opts = opts;
62106
62138
  this._model = opts.model;
62107
62139
  this._contextWindow = opts.contextWindow;
62140
+ this._maxTokens = opts.maxTokens;
62108
62141
  }
62109
62142
  get currentModel() {
62110
62143
  return this._model;
@@ -62116,13 +62149,16 @@ var ClaudeCodeAdapter = class {
62116
62149
  const modelChanged = config.model !== void 0 && config.model !== this._model;
62117
62150
  const effortChanged = config.effort !== void 0 && config.effort !== this._effortLevel;
62118
62151
  const contextWindowChanged = config.contextWindow !== void 0 && config.contextWindow !== this._contextWindow;
62152
+ const maxTokensChanged = config.maxTokens !== void 0 && config.maxTokens !== this._maxTokens;
62119
62153
  if (modelChanged)
62120
62154
  this._model = config.model ?? void 0;
62121
62155
  if (effortChanged)
62122
62156
  this._effortLevel = config.effort ?? void 0;
62123
62157
  if (contextWindowChanged)
62124
62158
  this._contextWindow = config.contextWindow ?? void 0;
62125
- if (modelChanged || effortChanged || contextWindowChanged) {
62159
+ if (maxTokensChanged)
62160
+ this._maxTokens = config.maxTokens ?? void 0;
62161
+ if (modelChanged || effortChanged || contextWindowChanged || maxTokensChanged) {
62126
62162
  this.requestProcessRestart();
62127
62163
  }
62128
62164
  }
@@ -62528,11 +62564,12 @@ var ClaudeCodeAdapter = class {
62528
62564
  const env = buildSpawnEnv(process.env, this.opts.claudeHome, this.buildPlaceholderContext(sessionKey), {
62529
62565
  allowApiKey: this.opts.allowApiKey,
62530
62566
  contextWindow: this._contextWindow,
62567
+ maxTokens: this._maxTokens,
62531
62568
  effortLevel: this._effortLevel,
62532
62569
  wikiMountRoot: this.opts.workspaceDir,
62533
62570
  capabilityBinDir: this.opts.capabilityBinDir
62534
62571
  });
62535
- log2?.info(`spawn long-lived ${this.opts.claudeBin} (session ${sessionKey}, model=${this._model || "default"}, context=${this._contextWindow || "cli-default"}, effort=${this._effortLevel || "default"}, mode=${this.opts.permissionMode})`);
62572
+ log2?.info(`spawn long-lived ${this.opts.claudeBin} (session ${sessionKey}, model=${this._model || "default"}, context=${this._contextWindow || "cli-default"}, maxOut=${this._maxTokens || "cli-default"}, effort=${this._effortLevel || "default"}, mode=${this.opts.permissionMode})`);
62536
62573
  const proc = spawn(IS_WIN32 ? quoteWin32Arg(this.opts.claudeBin) : this.opts.claudeBin, IS_WIN32 ? args.map(quoteWin32Arg) : args, {
62537
62574
  cwd: this.opts.workspaceDir,
62538
62575
  env,
@@ -62939,6 +62976,7 @@ async function main() {
62939
62976
  const platformModelOverride = deriveModelIsPin(platformDefaults, me.agent_profile);
62940
62977
  const resolvedModel = resolveRuntimeModel(platformModelOverride, platformDefaults.model, config.model);
62941
62978
  const resolvedContextWindow = resolveRuntimeContextWindow(resolvedModel, platformDefaults, activeLLMSource);
62979
+ const resolvedMaxTokens = resolveRuntimeMaxTokens(resolvedModel, platformDefaults, activeLLMSource);
62942
62980
  const resolvedEffort = platformDefaults.thinkingEffort ?? (process.env.CLAUDE_CODE_EFFORT_LEVEL?.trim() || void 0);
62943
62981
  if (platformDefaults.model)
62944
62982
  agentLog.info(`platform config: model=${platformDefaults.model} \u2192 resolved=${resolvedModel ?? "cli-default"} (${platformModelOverride ? "pin/override" : "floor"})`);
@@ -62946,12 +62984,15 @@ async function main() {
62946
62984
  agentLog.info(`platform config: thinking_effort=${platformDefaults.thinkingEffort}`);
62947
62985
  if (resolvedContextWindow)
62948
62986
  agentLog.info(`platform config: context_window=${resolvedContextWindow}`);
62987
+ if (resolvedMaxTokens)
62988
+ agentLog.info(`platform config: max_tokens=${resolvedMaxTokens}`);
62949
62989
  const adapter = new ClaudeCodeAdapter({
62950
62990
  claudeBin: config.claudeBin,
62951
62991
  claudeHome: config.claudeHome,
62952
62992
  workspaceDir: config.workspaceDir,
62953
62993
  model: resolvedModel,
62954
62994
  contextWindow: resolvedContextWindow,
62995
+ maxTokens: resolvedMaxTokens,
62955
62996
  permissionMode: config.permissionMode,
62956
62997
  allowedTools: config.allowedTools,
62957
62998
  disallowedTools: config.disallowedTools,
@@ -62993,6 +63034,7 @@ async function main() {
62993
63034
  adapter.updateConfig({
62994
63035
  model,
62995
63036
  contextWindow: resolveRuntimeContextWindow(model, updated, activeLLMSource) ?? null,
63037
+ maxTokens: resolveRuntimeMaxTokens(model, updated, activeLLMSource) ?? null,
62996
63038
  effort: updated.thinkingEffort ?? localEffort
62997
63039
  });
62998
63040
  const fragments = applyChannelCapabilities();
@@ -17719,9 +17719,9 @@ var require_getMachineId_linux = __commonJS({
17719
17719
  var api_1 = (init_esm(), __toCommonJS(esm_exports));
17720
17720
  async function getMachineId() {
17721
17721
  const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
17722
- for (const path12 of paths) {
17722
+ for (const path13 of paths) {
17723
17723
  try {
17724
- const result = await fs_1.promises.readFile(path12, { encoding: "utf8" });
17724
+ const result = await fs_1.promises.readFile(path13, { encoding: "utf8" });
17725
17725
  return result.trim();
17726
17726
  } catch (e) {
17727
17727
  api_1.diag.debug(`error reading machine id: ${e}`);
@@ -21124,7 +21124,7 @@ function appendRootPathToUrlIfNeeded(url) {
21124
21124
  return void 0;
21125
21125
  }
21126
21126
  }
21127
- function appendResourcePathToUrl(url, path12) {
21127
+ function appendResourcePathToUrl(url, path13) {
21128
21128
  try {
21129
21129
  new URL(url);
21130
21130
  } catch (_a) {
@@ -21134,11 +21134,11 @@ function appendResourcePathToUrl(url, path12) {
21134
21134
  if (!url.endsWith("/")) {
21135
21135
  url = url + "/";
21136
21136
  }
21137
- url += path12;
21137
+ url += path13;
21138
21138
  try {
21139
21139
  new URL(url);
21140
21140
  } catch (_b) {
21141
- diag2.warn("Configuration: Provided URL appended with '" + path12 + "' is not a valid URL, using 'undefined' instead of '" + url + "'");
21141
+ diag2.warn("Configuration: Provided URL appended with '" + path13 + "' is not a valid URL, using 'undefined' instead of '" + url + "'");
21142
21142
  return void 0;
21143
21143
  }
21144
21144
  return url;
@@ -27549,14 +27549,14 @@ var require_util2 = __commonJS({
27549
27549
  }
27550
27550
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
27551
27551
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
27552
- let path12 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
27552
+ let path13 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
27553
27553
  if (origin[origin.length - 1] === "/") {
27554
27554
  origin = origin.slice(0, origin.length - 1);
27555
27555
  }
27556
- if (path12 && path12[0] !== "/") {
27557
- path12 = `/${path12}`;
27556
+ if (path13 && path13[0] !== "/") {
27557
+ path13 = `/${path13}`;
27558
27558
  }
27559
- return new URL(`${origin}${path12}`);
27559
+ return new URL(`${origin}${path13}`);
27560
27560
  }
27561
27561
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
27562
27562
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -28377,9 +28377,9 @@ var require_diagnostics = __commonJS({
28377
28377
  "undici:client:sendHeaders",
28378
28378
  (evt) => {
28379
28379
  const {
28380
- request: { method, path: path12, origin }
28380
+ request: { method, path: path13, origin }
28381
28381
  } = evt;
28382
- debugLog("sending request to %s %s%s", method, origin, path12);
28382
+ debugLog("sending request to %s %s%s", method, origin, path13);
28383
28383
  }
28384
28384
  );
28385
28385
  }
@@ -28397,14 +28397,14 @@ var require_diagnostics = __commonJS({
28397
28397
  "undici:request:headers",
28398
28398
  (evt) => {
28399
28399
  const {
28400
- request: { method, path: path12, origin },
28400
+ request: { method, path: path13, origin },
28401
28401
  response: { statusCode }
28402
28402
  } = evt;
28403
28403
  debugLog(
28404
28404
  "received response to %s %s%s - HTTP %d",
28405
28405
  method,
28406
28406
  origin,
28407
- path12,
28407
+ path13,
28408
28408
  statusCode
28409
28409
  );
28410
28410
  }
@@ -28413,23 +28413,23 @@ var require_diagnostics = __commonJS({
28413
28413
  "undici:request:trailers",
28414
28414
  (evt) => {
28415
28415
  const {
28416
- request: { method, path: path12, origin }
28416
+ request: { method, path: path13, origin }
28417
28417
  } = evt;
28418
- debugLog("trailers received from %s %s%s", method, origin, path12);
28418
+ debugLog("trailers received from %s %s%s", method, origin, path13);
28419
28419
  }
28420
28420
  );
28421
28421
  diagnosticsChannel.subscribe(
28422
28422
  "undici:request:error",
28423
28423
  (evt) => {
28424
28424
  const {
28425
- request: { method, path: path12, origin },
28425
+ request: { method, path: path13, origin },
28426
28426
  error
28427
28427
  } = evt;
28428
28428
  debugLog(
28429
28429
  "request to %s %s%s errored - %s",
28430
28430
  method,
28431
28431
  origin,
28432
- path12,
28432
+ path13,
28433
28433
  error.message
28434
28434
  );
28435
28435
  }
@@ -28532,7 +28532,7 @@ var require_request = __commonJS({
28532
28532
  var kHandler = Symbol("handler");
28533
28533
  var Request = class {
28534
28534
  constructor(origin, {
28535
- path: path12,
28535
+ path: path13,
28536
28536
  method,
28537
28537
  body,
28538
28538
  headers,
@@ -28549,11 +28549,11 @@ var require_request = __commonJS({
28549
28549
  maxRedirections,
28550
28550
  typeOfService
28551
28551
  }, handler) {
28552
- if (typeof path12 !== "string") {
28552
+ if (typeof path13 !== "string") {
28553
28553
  throw new InvalidArgumentError("path must be a string");
28554
- } else if (path12[0] !== "/" && !(path12.startsWith("http://") || path12.startsWith("https://")) && method !== "CONNECT") {
28554
+ } else if (path13[0] !== "/" && !(path13.startsWith("http://") || path13.startsWith("https://")) && method !== "CONNECT") {
28555
28555
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
28556
- } else if (invalidPathRegex.test(path12)) {
28556
+ } else if (invalidPathRegex.test(path13)) {
28557
28557
  throw new InvalidArgumentError("invalid request path");
28558
28558
  }
28559
28559
  if (typeof method !== "string") {
@@ -28628,7 +28628,7 @@ var require_request = __commonJS({
28628
28628
  this.completed = false;
28629
28629
  this.aborted = false;
28630
28630
  this.upgrade = upgrade || null;
28631
- this.path = query ? serializePathWithQuery(path12, query) : path12;
28631
+ this.path = query ? serializePathWithQuery(path13, query) : path13;
28632
28632
  this.origin = origin;
28633
28633
  this.protocol = getProtocolFromUrlString(origin);
28634
28634
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -33667,7 +33667,7 @@ var require_client_h1 = __commonJS({
33667
33667
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
33668
33668
  }
33669
33669
  function writeH1(client, request3) {
33670
- const { method, path: path12, host, upgrade, blocking, reset } = request3;
33670
+ const { method, path: path13, host, upgrade, blocking, reset } = request3;
33671
33671
  let { body, headers, contentLength } = request3;
33672
33672
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
33673
33673
  if (util.isFormDataLike(body)) {
@@ -33736,7 +33736,7 @@ var require_client_h1 = __commonJS({
33736
33736
  if (socket.setTypeOfService) {
33737
33737
  socket.setTypeOfService(request3.typeOfService);
33738
33738
  }
33739
- let header = `${method} ${path12} HTTP/1.1\r
33739
+ let header = `${method} ${path13} HTTP/1.1\r
33740
33740
  `;
33741
33741
  if (typeof host === "string") {
33742
33742
  header += `host: ${host}\r
@@ -34389,7 +34389,7 @@ var require_client_h2 = __commonJS({
34389
34389
  function writeH2(client, request3) {
34390
34390
  const requestTimeout = request3.bodyTimeout ?? client[kBodyTimeout];
34391
34391
  const session = client[kHTTP2Session];
34392
- const { method, path: path12, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request3;
34392
+ const { method, path: path13, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request3;
34393
34393
  let { body } = request3;
34394
34394
  if (upgrade != null && upgrade !== "websocket") {
34395
34395
  util.errorRequest(client, request3, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -34457,7 +34457,7 @@ var require_client_h2 = __commonJS({
34457
34457
  }
34458
34458
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
34459
34459
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
34460
- headers[HTTP2_HEADER_PATH] = path12;
34460
+ headers[HTTP2_HEADER_PATH] = path13;
34461
34461
  if (protocol === "ws:" || protocol === "wss:") {
34462
34462
  headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
34463
34463
  } else {
@@ -34498,7 +34498,7 @@ var require_client_h2 = __commonJS({
34498
34498
  stream.setTimeout(requestTimeout);
34499
34499
  return true;
34500
34500
  }
34501
- headers[HTTP2_HEADER_PATH] = path12;
34501
+ headers[HTTP2_HEADER_PATH] = path13;
34502
34502
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
34503
34503
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
34504
34504
  if (body && typeof body.read === "function") {
@@ -36800,10 +36800,10 @@ var require_proxy_agent = __commonJS({
36800
36800
  };
36801
36801
  const {
36802
36802
  origin,
36803
- path: path12 = "/",
36803
+ path: path13 = "/",
36804
36804
  headers = {}
36805
36805
  } = opts;
36806
- opts.path = origin + path12;
36806
+ opts.path = origin + path13;
36807
36807
  if (!("host" in headers) && !("Host" in headers)) {
36808
36808
  const { host } = new URL(origin);
36809
36809
  headers.host = host;
@@ -38866,20 +38866,20 @@ var require_mock_utils = __commonJS({
38866
38866
  }
38867
38867
  return normalizedQp;
38868
38868
  }
38869
- function safeUrl(path12) {
38870
- if (typeof path12 !== "string") {
38871
- return path12;
38869
+ function safeUrl(path13) {
38870
+ if (typeof path13 !== "string") {
38871
+ return path13;
38872
38872
  }
38873
- const pathSegments = path12.split("?", 3);
38873
+ const pathSegments = path13.split("?", 3);
38874
38874
  if (pathSegments.length !== 2) {
38875
- return path12;
38875
+ return path13;
38876
38876
  }
38877
38877
  const qp = new URLSearchParams(pathSegments.pop());
38878
38878
  qp.sort();
38879
38879
  return [...pathSegments, qp.toString()].join("?");
38880
38880
  }
38881
- function matchKey(mockDispatch2, { path: path12, method, body, headers }) {
38882
- const pathMatch = matchValue(mockDispatch2.path, path12);
38881
+ function matchKey(mockDispatch2, { path: path13, method, body, headers }) {
38882
+ const pathMatch = matchValue(mockDispatch2.path, path13);
38883
38883
  const methodMatch = matchValue(mockDispatch2.method, method);
38884
38884
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
38885
38885
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -38904,8 +38904,8 @@ var require_mock_utils = __commonJS({
38904
38904
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
38905
38905
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
38906
38906
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
38907
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path12, ignoreTrailingSlash }) => {
38908
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path12)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path12), resolvedPath);
38907
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path13, ignoreTrailingSlash }) => {
38908
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path13)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path13), resolvedPath);
38909
38909
  });
38910
38910
  if (matchedMockDispatches.length === 0) {
38911
38911
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -38944,19 +38944,19 @@ var require_mock_utils = __commonJS({
38944
38944
  mockDispatches.splice(index, 1);
38945
38945
  }
38946
38946
  }
38947
- function removeTrailingSlash(path12) {
38948
- while (path12.endsWith("/")) {
38949
- path12 = path12.slice(0, -1);
38947
+ function removeTrailingSlash(path13) {
38948
+ while (path13.endsWith("/")) {
38949
+ path13 = path13.slice(0, -1);
38950
38950
  }
38951
- if (path12.length === 0) {
38952
- path12 = "/";
38951
+ if (path13.length === 0) {
38952
+ path13 = "/";
38953
38953
  }
38954
- return path12;
38954
+ return path13;
38955
38955
  }
38956
38956
  function buildKey(opts) {
38957
- const { path: path12, method, body, headers, query } = opts;
38957
+ const { path: path13, method, body, headers, query } = opts;
38958
38958
  return {
38959
- path: path12,
38959
+ path: path13,
38960
38960
  method,
38961
38961
  body,
38962
38962
  headers,
@@ -39646,10 +39646,10 @@ var require_pending_interceptors_formatter = __commonJS({
39646
39646
  }
39647
39647
  format(pendingInterceptors) {
39648
39648
  const withPrettyHeaders = pendingInterceptors.map(
39649
- ({ method, path: path12, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
39649
+ ({ method, path: path13, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
39650
39650
  Method: method,
39651
39651
  Origin: origin,
39652
- Path: path12,
39652
+ Path: path13,
39653
39653
  "Status code": statusCode,
39654
39654
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
39655
39655
  Invocations: timesInvoked,
@@ -39731,9 +39731,9 @@ var require_mock_agent = __commonJS({
39731
39731
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
39732
39732
  const dispatchOpts = { ...opts };
39733
39733
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
39734
- const [path12, searchParams] = dispatchOpts.path.split("?");
39734
+ const [path13, searchParams] = dispatchOpts.path.split("?");
39735
39735
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
39736
- dispatchOpts.path = `${path12}?${normalizedSearchParams}`;
39736
+ dispatchOpts.path = `${path13}?${normalizedSearchParams}`;
39737
39737
  }
39738
39738
  return this[kAgent].dispatch(dispatchOpts, handler);
39739
39739
  }
@@ -40134,12 +40134,12 @@ var require_snapshot_recorder = __commonJS({
40134
40134
  * @return {Promise<void>} - Resolves when snapshots are loaded
40135
40135
  */
40136
40136
  async loadSnapshots(filePath) {
40137
- const path12 = filePath || this.#snapshotPath;
40138
- if (!path12) {
40137
+ const path13 = filePath || this.#snapshotPath;
40138
+ if (!path13) {
40139
40139
  throw new InvalidArgumentError("Snapshot path is required");
40140
40140
  }
40141
40141
  try {
40142
- const data = await readFile(resolve4(path12), "utf8");
40142
+ const data = await readFile(resolve4(path13), "utf8");
40143
40143
  const parsed = JSON.parse(data);
40144
40144
  if (Array.isArray(parsed)) {
40145
40145
  this.#snapshots.clear();
@@ -40153,7 +40153,7 @@ var require_snapshot_recorder = __commonJS({
40153
40153
  if (error.code === "ENOENT") {
40154
40154
  this.#snapshots.clear();
40155
40155
  } else {
40156
- throw new UndiciError(`Failed to load snapshots from ${path12}`, { cause: error });
40156
+ throw new UndiciError(`Failed to load snapshots from ${path13}`, { cause: error });
40157
40157
  }
40158
40158
  }
40159
40159
  }
@@ -40164,11 +40164,11 @@ var require_snapshot_recorder = __commonJS({
40164
40164
  * @returns {Promise<void>} - Resolves when snapshots are saved
40165
40165
  */
40166
40166
  async saveSnapshots(filePath) {
40167
- const path12 = filePath || this.#snapshotPath;
40168
- if (!path12) {
40167
+ const path13 = filePath || this.#snapshotPath;
40168
+ if (!path13) {
40169
40169
  throw new InvalidArgumentError("Snapshot path is required");
40170
40170
  }
40171
- const resolvedPath = resolve4(path12);
40171
+ const resolvedPath = resolve4(path13);
40172
40172
  await mkdir2(dirname8(resolvedPath), { recursive: true });
40173
40173
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
40174
40174
  hash,
@@ -40793,15 +40793,15 @@ var require_redirect_handler = __commonJS({
40793
40793
  return;
40794
40794
  }
40795
40795
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
40796
- const path12 = search ? `${pathname}${search}` : pathname;
40797
- const redirectUrlString = `${origin}${path12}`;
40796
+ const path13 = search ? `${pathname}${search}` : pathname;
40797
+ const redirectUrlString = `${origin}${path13}`;
40798
40798
  for (const historyUrl of this.history) {
40799
40799
  if (historyUrl.toString() === redirectUrlString) {
40800
40800
  throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
40801
40801
  }
40802
40802
  }
40803
40803
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
40804
- this.opts.path = path12;
40804
+ this.opts.path = path13;
40805
40805
  this.opts.origin = origin;
40806
40806
  this.opts.query = null;
40807
40807
  }
@@ -44411,10 +44411,10 @@ var require_headers = __commonJS({
44411
44411
  const lowercaseName = isLowerCase ? name : name.toLowerCase();
44412
44412
  const exists = this.headersMap.get(lowercaseName);
44413
44413
  if (exists) {
44414
- const delimiter2 = lowercaseName === "cookie" ? "; " : ", ";
44414
+ const delimiter3 = lowercaseName === "cookie" ? "; " : ", ";
44415
44415
  this.headersMap.set(lowercaseName, {
44416
44416
  name: exists.name,
44417
- value: `${exists.value}${delimiter2}${value}`
44417
+ value: `${exists.value}${delimiter3}${value}`
44418
44418
  });
44419
44419
  } else {
44420
44420
  this.headersMap.set(lowercaseName, { name, value });
@@ -47008,11 +47008,11 @@ var require_fetch = __commonJS({
47008
47008
  function dispatch({ body }) {
47009
47009
  const url = requestCurrentURL(request3);
47010
47010
  const agent = fetchParams.controller.dispatcher;
47011
- const path12 = url.pathname + url.search;
47011
+ const path13 = url.pathname + url.search;
47012
47012
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
47013
47013
  return new Promise((resolve4, reject) => agent.dispatch(
47014
47014
  {
47015
- path: hasTrailingQuestionMark ? `${path12}?` : path12,
47015
+ path: hasTrailingQuestionMark ? `${path13}?` : path13,
47016
47016
  origin: url.origin,
47017
47017
  method: request3.method,
47018
47018
  body: agent.isMockActive ? request3.body && (request3.body.source || request3.body.stream) : body,
@@ -47959,9 +47959,9 @@ var require_util5 = __commonJS({
47959
47959
  }
47960
47960
  }
47961
47961
  }
47962
- function validateCookiePath(path12) {
47963
- for (let i = 0; i < path12.length; ++i) {
47964
- const code = path12.charCodeAt(i);
47962
+ function validateCookiePath(path13) {
47963
+ for (let i = 0; i < path13.length; ++i) {
47964
+ const code = path13.charCodeAt(i);
47965
47965
  if (code < 32 || // exclude CTLs (0-31)
47966
47966
  code === 127 || // DEL
47967
47967
  code === 59) {
@@ -51131,11 +51131,11 @@ var require_undici = __commonJS({
51131
51131
  if (typeof opts.path !== "string") {
51132
51132
  throw new InvalidArgumentError("invalid opts.path");
51133
51133
  }
51134
- let path12 = opts.path;
51134
+ let path13 = opts.path;
51135
51135
  if (!opts.path.startsWith("/")) {
51136
- path12 = `/${path12}`;
51136
+ path13 = `/${path13}`;
51137
51137
  }
51138
- url = new URL(util.parseOrigin(url).origin + path12);
51138
+ url = new URL(util.parseOrigin(url).origin + path13);
51139
51139
  } else {
51140
51140
  if (!opts) {
51141
51141
  opts = typeof url === "object" ? url : {};
@@ -51544,6 +51544,18 @@ function attachmentEndpoints(apiBase) {
51544
51544
  };
51545
51545
  }
51546
51546
 
51547
+ // ts/sdk/dist/wechat-endpoints.js
51548
+ function wechatEndpoints(apiBase) {
51549
+ const agentBase = (orgId) => `${apiBase}/orgs/${orgId}/agents/me/wechat`;
51550
+ return {
51551
+ WECHAT_CONTACTS: (orgId) => `${agentBase(orgId)}/contacts`,
51552
+ WECHAT_HISTORY: (orgId) => `${agentBase(orgId)}/history`,
51553
+ WECHAT_MEDIA: (orgId) => `${agentBase(orgId)}/media`,
51554
+ WECHAT_PROFILE: (orgId) => `${agentBase(orgId)}/profile`,
51555
+ WECHAT_STATUS: (orgId) => `${agentBase(orgId)}/status`
51556
+ };
51557
+ }
51558
+
51547
51559
  // ts/sdk/dist/constants.js
51548
51560
  var API_BASE = "/api/v1";
51549
51561
  var WIKI_BASE = "/wiki/v1";
@@ -51797,10 +51809,7 @@ var ENDPOINTS = {
51797
51809
  SLACK_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/members`,
51798
51810
  SLACK_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
51799
51811
  // WeChat tier-B read verbs (agent-only; internal research preview).
51800
- WECHAT_CONTACTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
51801
- WECHAT_HISTORY: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/history`,
51802
- WECHAT_PROFILE: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/profile`,
51803
- WECHAT_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/status`,
51812
+ ...wechatEndpoints(API_BASE),
51804
51813
  // Invitations (org-scoped, admin)
51805
51814
  ORG_INVITATIONS: (orgId) => `${API_BASE}/orgs/${orgId}/invitations`,
51806
51815
  ORG_INVITATION: (orgId, invId) => `${API_BASE}/orgs/${orgId}/invitations/${invId}`,
@@ -52360,6 +52369,10 @@ var WechatClient = class extends TaskLabelClient {
52360
52369
  params.set("limit", String(query.limit));
52361
52370
  return this.request("GET", `${ENDPOINTS.WECHAT_HISTORY(orgId)}?${params.toString()}`);
52362
52371
  }
52372
+ /** Fetch and cache one WeChat image or completed file on first explicit read. */
52373
+ async materializeWechatMedia(orgId, messageId) {
52374
+ return this.request("POST", ENDPOINTS.WECHAT_MEDIA(orgId), { message_id: messageId });
52375
+ }
52363
52376
  /** Connected WeChat account identity. */
52364
52377
  async wechatProfile(orgId) {
52365
52378
  return this.request("GET", ENDPOINTS.WECHAT_PROFILE(orgId));
@@ -52590,7 +52603,7 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52590
52603
  return apiError;
52591
52604
  }
52592
52605
  /** Build headers common to all requests (auth, swimlane). */
52593
- buildHeaders(path12, extra) {
52606
+ buildHeaders(path13, extra) {
52594
52607
  const headers = {
52595
52608
  "Content-Type": "application/json",
52596
52609
  ...extra
@@ -52601,7 +52614,7 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52601
52614
  if (this.swimlaneName) {
52602
52615
  headers["X-Prll-Swimlane"] = this.swimlaneName;
52603
52616
  }
52604
- if (path12.startsWith(API_BASE)) {
52617
+ if (path13.startsWith(API_BASE)) {
52605
52618
  const overrides = this.getFeatureFlagOverrides?.();
52606
52619
  if (overrides)
52607
52620
  headers["X-Prll-FF-Override"] = overrides;
@@ -52625,8 +52638,8 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52625
52638
  * is authoritative, so wiki vs api routing can't drift from how a caller
52626
52639
  * happens to invoke the client.
52627
52640
  */
52628
- baseUrlFor(path12) {
52629
- return path12.startsWith(WIKI_BASE) ? this.wikiBaseUrl : this.baseUrl;
52641
+ baseUrlFor(path13) {
52642
+ return path13.startsWith(WIKI_BASE) ? this.wikiBaseUrl : this.baseUrl;
52630
52643
  }
52631
52644
  setToken(token) {
52632
52645
  this.token = token;
@@ -52653,10 +52666,10 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52653
52666
  * REFRESH_THRESHOLD_S, refresh it **before** sending the request.
52654
52667
  * No-op when the token is still fresh, missing, or un-parseable.
52655
52668
  */
52656
- async ensureFreshToken(path12) {
52669
+ async ensureFreshToken(path13) {
52657
52670
  if (!this.token || !this.getRefreshToken)
52658
52671
  return;
52659
- const pathSuffix = path12.replace(/^\/api\/v1/, "");
52672
+ const pathSuffix = path13.replace(/^\/api\/v1/, "");
52660
52673
  if (_ParallClient.AUTH_PATHS.has(pathSuffix))
52661
52674
  return;
52662
52675
  const exp = _ParallClient.decodeJwtExp(this.token);
@@ -52688,11 +52701,11 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52688
52701
  this.refreshPromise = null;
52689
52702
  }
52690
52703
  }
52691
- async request(method, path12, body, query, retried = false, opts) {
52704
+ async request(method, path13, body, query, retried = false, opts) {
52692
52705
  if (!retried) {
52693
- await this.ensureFreshToken(path12);
52706
+ await this.ensureFreshToken(path13);
52694
52707
  }
52695
- let url = `${this.baseUrlFor(path12)}${path12}`;
52708
+ let url = `${this.baseUrlFor(path13)}${path13}`;
52696
52709
  if (query) {
52697
52710
  const params = new URLSearchParams();
52698
52711
  for (const [key, value] of Object.entries(query)) {
@@ -52704,7 +52717,7 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52704
52717
  if (qs)
52705
52718
  url += `?${qs}`;
52706
52719
  }
52707
- const headers = this.buildHeaders(path12, opts?.headers);
52720
+ const headers = this.buildHeaders(path13, opts?.headers);
52708
52721
  const timeoutSignal = AbortSignal.timeout(opts?.timeoutMs ?? 15e3);
52709
52722
  const signal = opts?.signal ? AbortSignal.any([opts.signal, timeoutSignal]) : timeoutSignal;
52710
52723
  let res;
@@ -52722,12 +52735,12 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52722
52735
  throw _ParallClient.normalizeFetchError(err);
52723
52736
  }
52724
52737
  if (res.status === 401) {
52725
- const pathSuffix = path12.replace(/^\/api\/v1/, "");
52738
+ const pathSuffix = path13.replace(/^\/api\/v1/, "");
52726
52739
  const isAuthPath = _ParallClient.AUTH_PATHS.has(pathSuffix);
52727
52740
  if (!retried && !isAuthPath && this.getRefreshToken) {
52728
52741
  const refreshed = await this.tryRefresh();
52729
52742
  if (refreshed) {
52730
- return this.request(method, path12, body, query, true, opts);
52743
+ return this.request(method, path13, body, query, true, opts);
52731
52744
  }
52732
52745
  }
52733
52746
  if (this.onTokenExpired && !isAuthPath) {
@@ -52757,18 +52770,18 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52757
52770
  * hit the 100 MiB cap, so a longer 5-minute timeout is used so a
52758
52771
  * 50 MiB blob on a slow connection doesn't get chopped at 15 s.
52759
52772
  */
52760
- async multipartRequest(method, path12, body, retried = false, opts) {
52773
+ async multipartRequest(method, path13, body, retried = false, opts) {
52761
52774
  if (!retried) {
52762
- await this.ensureFreshToken(path12);
52775
+ await this.ensureFreshToken(path13);
52763
52776
  }
52764
- const { "Content-Type": _drop, ...headers } = this.buildHeaders(path12);
52777
+ const { "Content-Type": _drop, ...headers } = this.buildHeaders(path13);
52765
52778
  void _drop;
52766
52779
  const timeoutMs = opts?.timeoutMs ?? 5 * 60 * 1e3;
52767
52780
  let res;
52768
52781
  try {
52769
52782
  res = await sendMultipartRequest({
52770
52783
  method,
52771
- url: `${this.baseUrlFor(path12)}${path12}`,
52784
+ url: `${this.baseUrlFor(path13)}${path13}`,
52772
52785
  headers,
52773
52786
  body,
52774
52787
  timeoutMs,
@@ -52779,12 +52792,12 @@ var ParallClient = class _ParallClient extends AttachmentClient {
52779
52792
  throw _ParallClient.normalizeFetchError(err);
52780
52793
  }
52781
52794
  if (res.status === 401) {
52782
- const pathSuffix = path12.replace(/^\/api\/v1/, "");
52795
+ const pathSuffix = path13.replace(/^\/api\/v1/, "");
52783
52796
  const isAuthPath = _ParallClient.AUTH_PATHS.has(pathSuffix);
52784
52797
  if (!retried && !isAuthPath && this.getRefreshToken) {
52785
52798
  const refreshed = await this.tryRefresh();
52786
52799
  if (refreshed) {
52787
- return this.multipartRequest(method, path12, body, true, opts);
52800
+ return this.multipartRequest(method, path13, body, true, opts);
52788
52801
  }
52789
52802
  }
52790
52803
  if (this.onTokenExpired && !isAuthPath) {
@@ -53628,8 +53641,8 @@ var ParallClient = class _ParallClient extends AttachmentClient {
53628
53641
  * remote filesystem browse of a member's machine was remote device access.
53629
53642
  * The endpoint now answers 409 LOCAL_BROWSE_NOT_SUPPORTED unconditionally;
53630
53643
  * workspace paths are typed in (or picked on the machine's own Desktop). */
53631
- async browseMachineFilesystem(orgId, machineId, path12) {
53632
- return this.request("POST", ENDPOINTS.MACHINE_BROWSE(orgId, machineId), { path: path12 }, void 0, false, { timeoutMs: 15e3 });
53644
+ async browseMachineFilesystem(orgId, machineId, path13) {
53645
+ return this.request("POST", ENDPOINTS.MACHINE_BROWSE(orgId, machineId), { path: path13 }, void 0, false, { timeoutMs: 15e3 });
53633
53646
  }
53634
53647
  /** Create a new machine key. Returns the raw key string (shown once) + metadata. */
53635
53648
  async createMachineKey(orgId, machineId, name) {
@@ -54203,12 +54216,12 @@ var ParallClient = class _ParallClient extends AttachmentClient {
54203
54216
  async deleteWikiRestriction(orgId, wikiId, restrictionId) {
54204
54217
  await this.request("DELETE", ENDPOINTS.WIKI_RESTRICTION(orgId, wikiId, restrictionId));
54205
54218
  }
54206
- async getWikiAccessStatus(orgId, wikiId, path12) {
54207
- return this.request("GET", ENDPOINTS.WIKI_ACCESS_STATUS(orgId, wikiId), void 0, path12 ? { path: path12 } : void 0);
54219
+ async getWikiAccessStatus(orgId, wikiId, path13) {
54220
+ return this.request("GET", ENDPOINTS.WIKI_ACCESS_STATUS(orgId, wikiId), void 0, path13 ? { path: path13 } : void 0);
54208
54221
  }
54209
54222
  // ---- Wiki membership projection (who-can-access, invites, join/leave) ----
54210
- async getWikiAccessPolicy(orgId, wikiId, path12 = "") {
54211
- return this.request("GET", ENDPOINTS.WIKI_ACCESS_POLICY(orgId, wikiId), void 0, path12 ? { path: path12 } : void 0);
54223
+ async getWikiAccessPolicy(orgId, wikiId, path13 = "") {
54224
+ return this.request("GET", ENDPOINTS.WIKI_ACCESS_POLICY(orgId, wikiId), void 0, path13 ? { path: path13 } : void 0);
54212
54225
  }
54213
54226
  async putWikiAccessPolicy(orgId, wikiId, policy) {
54214
54227
  return this.request("PUT", ENDPOINTS.WIKI_ACCESS_POLICY(orgId, wikiId), policy);
@@ -54253,14 +54266,14 @@ var ParallClient = class _ParallClient extends AttachmentClient {
54253
54266
  async getWikiCommits(orgId, wikiId, params) {
54254
54267
  return this.request("GET", ENDPOINTS.WIKI_COMMITS(orgId, wikiId), void 0, params);
54255
54268
  }
54256
- async getWikiFileCommits(orgId, wikiId, path12, params) {
54269
+ async getWikiFileCommits(orgId, wikiId, path13, params) {
54257
54270
  return this.request("GET", ENDPOINTS.WIKI_FILE_COMMITS(orgId, wikiId), void 0, {
54258
- path: path12,
54271
+ path: path13,
54259
54272
  ...params
54260
54273
  });
54261
54274
  }
54262
- async getWikiBlame(orgId, wikiId, path12, ref) {
54263
- return this.request("GET", ENDPOINTS.WIKI_BLAME(orgId, wikiId), void 0, { path: path12, ref });
54275
+ async getWikiBlame(orgId, wikiId, path13, ref) {
54276
+ return this.request("GET", ENDPOINTS.WIKI_BLAME(orgId, wikiId), void 0, { path: path13, ref });
54264
54277
  }
54265
54278
  // ---- Wiki Operations (audit log) ----
54266
54279
  async getWikiOperations(orgId, wikiId, params) {
@@ -54995,7 +55008,8 @@ var ParallClient = class _ParallClient extends AttachmentClient {
54995
55008
  * `404 NOT_FOUND`. An installed cross-org clip with no connection yet lists
54996
55009
  * as an empty array — including one whose approved auth mode cannot be
54997
55010
  * configured at all (auth=none), which the write path is what refuses. With
54998
- * `cap:clip-mcp` off the route is not registered at all.
55011
+ * `cap:clip-mcp` off the route is not registered at all. The envelope also
55012
+ * carries `official_oauth_ready` (see MCPConnectionListResponse).
54999
55013
  */
55000
55014
  async listClipMCPConnections(orgId, clipId) {
55001
55015
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
@@ -59333,38 +59347,42 @@ function runtimeModelConfig(canonicalModel, runtimeType, config) {
59333
59347
  const catalog = Array.isArray(parall.models) ? parall.models : [];
59334
59348
  const match = catalog.find((model) => model.id === canonicalModel);
59335
59349
  if (!match) {
59336
- return !runtime || runtime === "openclaw" || runtime === "hermes" ? { model: canonicalModel, contextWindow: null } : null;
59350
+ return !runtime || runtime === "openclaw" || runtime === "hermes" ? { model: canonicalModel, contextWindow: null, maxTokens: null } : null;
59337
59351
  }
59338
59352
  const contextWindow = typeof match.contextWindow === "number" && Number.isSafeInteger(match.contextWindow) && match.contextWindow > 0 ? match.contextWindow : null;
59353
+ const maxTokens = typeof match.maxTokens === "number" && Number.isSafeInteger(match.maxTokens) && match.maxTokens > 0 ? match.maxTokens : null;
59339
59354
  if (!runtime || runtime === "openclaw" || runtime === "hermes") {
59340
- return { model: canonicalModel, contextWindow };
59355
+ return { model: canonicalModel, contextWindow, maxTokens };
59341
59356
  }
59342
59357
  const runtimeNames = match.runtime_names ?? {};
59343
59358
  const runtimeName = runtimeNames[runtime];
59344
59359
  if (typeof runtimeName === "string" && runtimeName) {
59345
59360
  return {
59346
59361
  model: runtimeName,
59347
- contextWindow: runtimeName === canonicalModel ? contextWindow : null
59362
+ contextWindow: runtimeName === canonicalModel ? contextWindow : null,
59363
+ maxTokens: runtimeName === canonicalModel ? maxTokens : null
59348
59364
  };
59349
59365
  }
59350
- return { model: canonicalModel, contextWindow };
59366
+ return { model: canonicalModel, contextWindow, maxTokens };
59351
59367
  }
59352
59368
  function extractDefaults(config, runtimeType) {
59353
59369
  const agents = config.agents ?? {};
59354
59370
  const defaults = agents.defaults ?? {};
59355
59371
  let model = null;
59356
59372
  let contextWindow = null;
59373
+ let maxTokens = null;
59357
59374
  if (typeof defaults.model === "string" && defaults.model) {
59358
59375
  const canonicalModel = defaults.model.replace(/^parall-anthropic\//, "").replace(/^parall\//, "");
59359
59376
  const resolved = runtimeModelConfig(canonicalModel, runtimeType, config);
59360
59377
  model = resolved?.model ?? null;
59361
59378
  contextWindow = resolved?.contextWindow ?? null;
59379
+ maxTokens = resolved?.maxTokens ?? null;
59362
59380
  }
59363
59381
  let thinkingEffort = null;
59364
59382
  if (typeof defaults.thinking_effort === "string" && defaults.thinking_effort) {
59365
59383
  thinkingEffort = defaults.thinking_effort;
59366
59384
  }
59367
- return { model, thinkingEffort, contextWindow };
59385
+ return { model, thinkingEffort, contextWindow, maxTokens };
59368
59386
  }
59369
59387
  function createPlatformConfigManager(opts) {
59370
59388
  const { client, stateDir, runtimeType, log: log2 } = opts;
@@ -59373,6 +59391,7 @@ function createPlatformConfigManager(opts) {
59373
59391
  model: null,
59374
59392
  thinkingEffort: null,
59375
59393
  contextWindow: null,
59394
+ maxTokens: null,
59376
59395
  modelIsPin: void 0
59377
59396
  };
59378
59397
  let currentRawConfig = null;
@@ -60979,7 +60998,7 @@ function stepIdFilePathForSession(stateDir, sessionKey) {
60979
60998
  // ts/codex-agent/dist/dispatch.js
60980
60999
  import { spawn } from "node:child_process";
60981
61000
  import { randomUUID as randomUUID2 } from "node:crypto";
60982
- import * as path8 from "node:path";
61001
+ import * as path9 from "node:path";
60983
61002
 
60984
61003
  // ts/agent-core/dist/internal/attachment-input.js
60985
61004
  import { execSync } from "node:child_process";
@@ -62049,6 +62068,24 @@ function answerServerRequest(method) {
62049
62068
  return Object.hasOwn(APPROVAL_DENIALS, method) ? APPROVAL_DENIALS[method] : void 0;
62050
62069
  }
62051
62070
 
62071
+ // ts/codex-agent/dist/thread-config.js
62072
+ import * as path8 from "node:path";
62073
+ function buildThreadConfigOverrides({ reasoningEffort, capabilityBinDir: capabilityBinDir2, inheritedPath, platform = process.platform }) {
62074
+ const config = {};
62075
+ if (reasoningEffort)
62076
+ config.model_reasoning_effort = reasoningEffort;
62077
+ if (capabilityBinDir2 && platform !== "win32") {
62078
+ const pathEntries = (inheritedPath ?? "").split(path8.delimiter).filter((entry) => entry && entry !== capabilityBinDir2);
62079
+ const effectivePath = [capabilityBinDir2, ...pathEntries].join(path8.delimiter);
62080
+ config.allow_login_shell = false;
62081
+ config.shell_environment_policy = {
62082
+ experimental_use_profile: false,
62083
+ set: { PATH: effectivePath }
62084
+ };
62085
+ }
62086
+ return Object.keys(config).length > 0 ? config : void 0;
62087
+ }
62088
+
62052
62089
  // ts/codex-agent/dist/event-mapping.js
62053
62090
  var EventMapper = class {
62054
62091
  toolCallStart = /* @__PURE__ */ new Map();
@@ -62511,6 +62548,13 @@ var CodexAppServerAdapter = class {
62511
62548
  if (config.developerInstructions !== void 0)
62512
62549
  this.opts.developerInstructions = config.developerInstructions ?? void 0;
62513
62550
  }
62551
+ threadConfigOverrides() {
62552
+ return buildThreadConfigOverrides({
62553
+ reasoningEffort: this.opts.reasoningEffort,
62554
+ capabilityBinDir: this.opts.capabilityBinDir,
62555
+ inheritedPath: process.env.PATH
62556
+ });
62557
+ }
62514
62558
  async enqueueDuringDispatch(sessionKey, body) {
62515
62559
  const client = this.client;
62516
62560
  if (!client || client.isDisposed())
@@ -62871,9 +62915,9 @@ var CodexAppServerAdapter = class {
62871
62915
  }
62872
62916
  if (this.opts.model)
62873
62917
  forkParams.model = this.opts.model;
62874
- if (this.opts.reasoningEffort) {
62875
- forkParams.config = { model_reasoning_effort: this.opts.reasoningEffort };
62876
- }
62918
+ const threadConfig = this.threadConfigOverrides();
62919
+ if (threadConfig)
62920
+ forkParams.config = threadConfig;
62877
62921
  const result = await client.sendRequest("thread/fork", forkParams);
62878
62922
  const forkedThreadId = extractThreadId(result);
62879
62923
  if (!forkedThreadId) {
@@ -62983,7 +63027,7 @@ var CodexAppServerAdapter = class {
62983
63027
  if (this.opts.capabilityBinDir) {
62984
63028
  const pathKey = IS_WIN32 ? Object.keys(env).find((k) => k.toUpperCase() === "PATH") ?? "PATH" : "PATH";
62985
63029
  const existing = env[pathKey];
62986
- env[pathKey] = existing ? `${this.opts.capabilityBinDir}${path8.delimiter}${existing}` : this.opts.capabilityBinDir;
63030
+ env[pathKey] = existing ? `${this.opts.capabilityBinDir}${path9.delimiter}${existing}` : this.opts.capabilityBinDir;
62987
63031
  }
62988
63032
  if (this.opts.contextFilePath) {
62989
63033
  env.PRLL_CONTEXT_FILE = this.opts.contextFilePath;
@@ -63085,9 +63129,9 @@ var CodexAppServerAdapter = class {
63085
63129
  }
63086
63130
  if (this.opts.model)
63087
63131
  commonParams.model = this.opts.model;
63088
- if (this.opts.reasoningEffort) {
63089
- commonParams.config = { model_reasoning_effort: this.opts.reasoningEffort };
63090
- }
63132
+ const threadConfig = this.threadConfigOverrides();
63133
+ if (threadConfig)
63134
+ commonParams.config = threadConfig;
63091
63135
  const method = opts.resumeId ? "thread/resume" : "thread/start";
63092
63136
  const params = opts.resumeId ? {
63093
63137
  threadId: opts.resumeId,
@@ -63150,7 +63194,7 @@ function errToString2(err) {
63150
63194
 
63151
63195
  // ts/codex-agent/dist/session-manager.js
63152
63196
  import * as fs8 from "node:fs";
63153
- import * as path9 from "node:path";
63197
+ import * as path10 from "node:path";
63154
63198
  var CodexSessionManager = class {
63155
63199
  mainSessionKey;
63156
63200
  stateFilePath;
@@ -63247,7 +63291,7 @@ var CodexSessionManager = class {
63247
63291
  if (!threadId)
63248
63292
  return;
63249
63293
  try {
63250
- fs8.mkdirSync(path9.dirname(this.stateFilePath), { recursive: true });
63294
+ fs8.mkdirSync(path10.dirname(this.stateFilePath), { recursive: true });
63251
63295
  const tmpPath = `${this.stateFilePath}.tmp`;
63252
63296
  const state = { runtimeKey: this.mainSessionKey, threadId };
63253
63297
  const effectiveSha = this.effectiveInstructionsShas.get(this.mainSessionKey);
@@ -63263,18 +63307,18 @@ var CodexSessionManager = class {
63263
63307
 
63264
63308
  // ts/codex-agent/dist/workspace.js
63265
63309
  import * as fs10 from "node:fs";
63266
- import * as path11 from "node:path";
63310
+ import * as path12 from "node:path";
63267
63311
 
63268
63312
  // ts/codex-agent/dist/legacy-workspace-config-migration.js
63269
63313
  import * as fs9 from "node:fs";
63270
- import * as path10 from "node:path";
63314
+ import * as path11 from "node:path";
63271
63315
  var LEGACY_CONFIG_RELPATH = [".codex", "config.toml"];
63272
63316
  var MIGRATION_SENTINEL_RELPATH = [".parall", "legacy-workspace-config-migration.v1"];
63273
63317
  function legacyWorkspaceConfigPath(workspaceDir) {
63274
- return path10.join(workspaceDir, ...LEGACY_CONFIG_RELPATH);
63318
+ return path11.join(workspaceDir, ...LEGACY_CONFIG_RELPATH);
63275
63319
  }
63276
63320
  function migrationSentinelPath(workspaceDir) {
63277
- return path10.join(workspaceDir, ...MIGRATION_SENTINEL_RELPATH);
63321
+ return path11.join(workspaceDir, ...MIGRATION_SENTINEL_RELPATH);
63278
63322
  }
63279
63323
  function legacyWorkspaceConfigToml(prompt) {
63280
63324
  return `developer_instructions = """
@@ -63326,7 +63370,7 @@ If a stale .codex/config.toml is still present, remove it by hand.
63326
63370
  `;
63327
63371
  function claimLegacyWorkspaceConfigMigration(workspaceDir) {
63328
63372
  const sentinel = migrationSentinelPath(workspaceDir);
63329
- fs9.mkdirSync(path10.dirname(sentinel), { recursive: true });
63373
+ fs9.mkdirSync(path11.dirname(sentinel), { recursive: true });
63330
63374
  try {
63331
63375
  fs9.writeFileSync(sentinel, SENTINEL_BODY, { flag: "wx" });
63332
63376
  return "claimed";
@@ -63392,9 +63436,9 @@ function sleepSync(ms) {
63392
63436
  Atomics.wait(SLEEP_SIGNAL, 0, 0, ms);
63393
63437
  }
63394
63438
  function withConfigLock(codexHome, log2, fn) {
63395
- const queueDir = path11.join(codexHome, "config.toml.lock.d");
63439
+ const queueDir = path12.join(codexHome, "config.toml.lock.d");
63396
63440
  let ticketName = bakeryEnqueue(queueDir);
63397
- let ticketPath = ticketName ? path11.join(queueDir, ticketName) : "";
63441
+ let ticketPath = ticketName ? path12.join(queueDir, ticketName) : "";
63398
63442
  let acquired = false;
63399
63443
  let heldPath = "";
63400
63444
  const deadline = Date.now() + CONFIG_LOCK_TIMINGS.waitMs;
@@ -63409,7 +63453,7 @@ function withConfigLock(codexHome, log2, fn) {
63409
63453
  ticketName = bakeryEnqueue(queueDir);
63410
63454
  if (!ticketName)
63411
63455
  break;
63412
- ticketPath = path11.join(queueDir, ticketName);
63456
+ ticketPath = path12.join(queueDir, ticketName);
63413
63457
  continue;
63414
63458
  }
63415
63459
  const now = Date.now();
@@ -63417,7 +63461,7 @@ function withConfigLock(codexHome, log2, fn) {
63417
63461
  let blocked = false;
63418
63462
  let head;
63419
63463
  for (const name of names) {
63420
- const entryPath = path11.join(queueDir, name);
63464
+ const entryPath = path12.join(queueDir, name);
63421
63465
  if (name.startsWith("held-")) {
63422
63466
  const enteredAt = Number.parseInt(name.slice(5, 20), 10);
63423
63467
  if (Number.isFinite(enteredAt) && now - enteredAt > CONFIG_LOCK_TIMINGS.staleMs) {
@@ -63460,7 +63504,7 @@ function withConfigLock(codexHome, log2, fn) {
63460
63504
  if (!blocked && head === ticketName) {
63461
63505
  CONFIG_LOCK_TEST_HOOKS.beforeTicketEntry?.();
63462
63506
  const heldName = `held-${String(Date.now()).padStart(15, "0")}-${ticketName.slice(2)}`;
63463
- const candidateHeldPath = path11.join(queueDir, heldName);
63507
+ const candidateHeldPath = path12.join(queueDir, heldName);
63464
63508
  try {
63465
63509
  fs10.renameSync(ticketPath, candidateHeldPath);
63466
63510
  } catch {
@@ -63501,7 +63545,7 @@ var CONFIG_LOCK_TEST_HOOKS = {};
63501
63545
  function bakeryEnqueue(queueDir) {
63502
63546
  for (let attempt = 0; attempt < 3; attempt++) {
63503
63547
  const token = `${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
63504
- const markerPath = path11.join(queueDir, `choosing-${token}`);
63548
+ const markerPath = path12.join(queueDir, `choosing-${token}`);
63505
63549
  try {
63506
63550
  fs10.mkdirSync(queueDir, { recursive: true });
63507
63551
  CONFIG_LOCK_TEST_HOOKS.beforeChoosingMarker?.();
@@ -63519,7 +63563,7 @@ function bakeryEnqueue(queueDir) {
63519
63563
  maxSeq = seq;
63520
63564
  }
63521
63565
  const ticketName = `t-${String(maxSeq + 1).padStart(10, "0")}-${token}`;
63522
- const ticketPath = path11.join(queueDir, ticketName);
63566
+ const ticketPath = path12.join(queueDir, ticketName);
63523
63567
  CONFIG_LOCK_TEST_HOOKS.beforeTicketPublish?.();
63524
63568
  fs10.renameSync(markerPath, ticketPath);
63525
63569
  try {
@@ -63573,7 +63617,7 @@ function resolveWriteTarget(filePath) {
63573
63617
  throw err;
63574
63618
  }
63575
63619
  const seen = /* @__PURE__ */ new Set();
63576
- let p = path11.resolve(filePath);
63620
+ let p = path12.resolve(filePath);
63577
63621
  for (let depth = 0; depth < 40; depth++) {
63578
63622
  if (seen.has(p)) {
63579
63623
  throw new Error(`symlink cycle at ${p} while resolving ${filePath}`);
@@ -63588,7 +63632,7 @@ function resolveWriteTarget(filePath) {
63588
63632
  return p;
63589
63633
  throw err;
63590
63634
  }
63591
- p = path11.resolve(path11.dirname(p), link);
63635
+ p = path12.resolve(path12.dirname(p), link);
63592
63636
  }
63593
63637
  throw new Error(`symlink chain deeper than 40 while resolving ${filePath}`);
63594
63638
  }
@@ -63637,7 +63681,7 @@ function ensureParallProvider(codexHome, apiUrl, log2, opts) {
63637
63681
  withConfigLock(codexHome, log2, () => ensureParallProviderLocked(codexHome, apiUrl, opts));
63638
63682
  }
63639
63683
  function ensureParallProviderLocked(codexHome, apiUrl, opts) {
63640
- const configPath = path11.join(codexHome, "config.toml");
63684
+ const configPath = path12.join(codexHome, "config.toml");
63641
63685
  const baseUrl = apiUrl.replace(/\/$/, "") + "/api/llm/v1";
63642
63686
  try {
63643
63687
  let content = "";
@@ -63683,11 +63727,11 @@ function findSectionEnd(content, fromIndex) {
63683
63727
  return nextHeader === -1 ? content.length : nextHeader;
63684
63728
  }
63685
63729
  function systemPromptCopyPath(workspaceDir) {
63686
- return path11.join(workspaceDir, ".parall", "system-prompt.md");
63730
+ return path12.join(workspaceDir, ".parall", "system-prompt.md");
63687
63731
  }
63688
63732
  function writeCodexSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
63689
63733
  const systemPrompt = buildCodexPlatformInstructions(workspaceDir, agentIdentity, capabilityFragments);
63690
- fs10.mkdirSync(path11.join(workspaceDir, ".parall"), { recursive: true });
63734
+ fs10.mkdirSync(path12.join(workspaceDir, ".parall"), { recursive: true });
63691
63735
  fs10.writeFileSync(systemPromptCopyPath(workspaceDir), systemPrompt, "utf8");
63692
63736
  return systemPrompt;
63693
63737
  }
@@ -63695,7 +63739,7 @@ function ensureCodexWorkspace(workspaceDir, log2, agentIdentity, capabilityFragm
63695
63739
  fs10.mkdirSync(workspaceDir, { recursive: true });
63696
63740
  runLegacyWorkspaceConfigMigration(workspaceDir, () => readAuthorshipProof(workspaceDir, log2), log2);
63697
63741
  const systemPrompt = writeCodexSystemPrompt(workspaceDir, agentIdentity, capabilityFragments);
63698
- writeSkillFiles(path11.join(workspaceDir, ".parall", "skills"));
63742
+ writeSkillFiles(path12.join(workspaceDir, ".parall", "skills"));
63699
63743
  return systemPrompt;
63700
63744
  }
63701
63745
  function readAuthorshipProof(workspaceDir, log2) {
@@ -215,12 +215,30 @@ var init_attachment_endpoints = __esm({
215
215
  }
216
216
  });
217
217
 
218
+ // ts/sdk/dist/wechat-endpoints.js
219
+ function wechatEndpoints(apiBase) {
220
+ const agentBase = (orgId) => `${apiBase}/orgs/${orgId}/agents/me/wechat`;
221
+ return {
222
+ WECHAT_CONTACTS: (orgId) => `${agentBase(orgId)}/contacts`,
223
+ WECHAT_HISTORY: (orgId) => `${agentBase(orgId)}/history`,
224
+ WECHAT_MEDIA: (orgId) => `${agentBase(orgId)}/media`,
225
+ WECHAT_PROFILE: (orgId) => `${agentBase(orgId)}/profile`,
226
+ WECHAT_STATUS: (orgId) => `${agentBase(orgId)}/status`
227
+ };
228
+ }
229
+ var init_wechat_endpoints = __esm({
230
+ "ts/sdk/dist/wechat-endpoints.js"() {
231
+ "use strict";
232
+ }
233
+ });
234
+
218
235
  // ts/sdk/dist/constants.js
219
236
  var API_BASE, WIKI_BASE, CLIP_BASE, ENDPOINTS, WS_EVENTS;
220
237
  var init_constants = __esm({
221
238
  "ts/sdk/dist/constants.js"() {
222
239
  "use strict";
223
240
  init_attachment_endpoints();
241
+ init_wechat_endpoints();
224
242
  API_BASE = "/api/v1";
225
243
  WIKI_BASE = "/wiki/v1";
226
244
  CLIP_BASE = "/clip/v1";
@@ -473,10 +491,7 @@ var init_constants = __esm({
473
491
  SLACK_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/members`,
474
492
  SLACK_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
475
493
  // WeChat tier-B read verbs (agent-only; internal research preview).
476
- WECHAT_CONTACTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
477
- WECHAT_HISTORY: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/history`,
478
- WECHAT_PROFILE: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/profile`,
479
- WECHAT_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/status`,
494
+ ...wechatEndpoints(API_BASE),
480
495
  // Invitations (org-scoped, admin)
481
496
  ORG_INVITATIONS: (orgId) => `${API_BASE}/orgs/${orgId}/invitations`,
482
497
  ORG_INVITATION: (orgId, invId) => `${API_BASE}/orgs/${orgId}/invitations/${invId}`,
@@ -1059,6 +1074,10 @@ var init_wechat_client = __esm({
1059
1074
  params.set("limit", String(query.limit));
1060
1075
  return this.request("GET", `${ENDPOINTS.WECHAT_HISTORY(orgId)}?${params.toString()}`);
1061
1076
  }
1077
+ /** Fetch and cache one WeChat image or completed file on first explicit read. */
1078
+ async materializeWechatMedia(orgId, messageId) {
1079
+ return this.request("POST", ENDPOINTS.WECHAT_MEDIA(orgId), { message_id: messageId });
1080
+ }
1062
1081
  /** Connected WeChat account identity. */
1063
1082
  async wechatProfile(orgId) {
1064
1083
  return this.request("GET", ENDPOINTS.WECHAT_PROFILE(orgId));
@@ -3761,7 +3780,8 @@ var init_client = __esm({
3761
3780
  * `404 NOT_FOUND`. An installed cross-org clip with no connection yet lists
3762
3781
  * as an empty array — including one whose approved auth mode cannot be
3763
3782
  * configured at all (auth=none), which the write path is what refuses. With
3764
- * `cap:clip-mcp` off the route is not registered at all.
3783
+ * `cap:clip-mcp` off the route is not registered at all. The envelope also
3784
+ * carries `official_oauth_ready` (see MCPConnectionListResponse).
3765
3785
  */
3766
3786
  async listClipMCPConnections(orgId, clipId) {
3767
3787
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/daemon",
3
- "version": "1.58.0",
3
+ "version": "1.58.2",
4
4
  "description": "Parall local agent runtime — daemon supervisor + bridge runtimes, bundled as standalone JS files",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  "@aws-sdk/client-s3": "3.984.0",
34
34
  "@pinixai/bb-browser-pro": "0.15.0",
35
35
  "ws": "^8.18.0",
36
- "@parall/sdk": "1.58.0",
37
- "@parall/claude-agent": "1.58.0",
38
- "@parall/codex-agent": "1.58.0",
39
- "@parall/openclaw-agent": "1.58.0",
40
- "@parall/agent-core": "1.58.0"
36
+ "@parall/agent-core": "1.58.2",
37
+ "@parall/sdk": "1.58.2",
38
+ "@parall/claude-agent": "1.58.2",
39
+ "@parall/codex-agent": "1.58.2",
40
+ "@parall/openclaw-agent": "1.58.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.0.0",