@parall/parall 1.33.0 → 1.34.0

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/gateway.d.ts CHANGED
@@ -1,7 +1,16 @@
1
+ import type { PluginRuntime } from 'openclaw/plugin-sdk';
1
2
  import type { ChannelPlugin } from 'openclaw/plugin-sdk/core';
2
3
  /** Extract ChannelGatewayAdapter from ChannelPlugin (removed from public SDK exports in 2026.3.24). */
3
4
  type ChannelGatewayAdapter<T = unknown> = NonNullable<ChannelPlugin<T>['gateway']>;
5
+ import { type DispatchAdapter } from '@parall/agent-core';
4
6
  import type { ResolvedParallAccount } from './types.js';
7
+ export declare function createOpenClawDispatchAdapter(opts: {
8
+ core: PluginRuntime;
9
+ cfg: Record<string, unknown>;
10
+ accountId: string;
11
+ sessionsDir: string;
12
+ workspaceDir: string;
13
+ }): DispatchAdapter;
5
14
  export declare const parallGateway: ChannelGatewayAdapter<ResolvedParallAccount>;
6
15
  export {};
7
16
  //# sourceMappingURL=gateway.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,uGAAuG;AACvG,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAgCnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA8SxD,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAAC,qBAAqB,CAmJtE,CAAC"}
1
+ {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,uGAAuG;AACvG,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACnF,OAAO,EAOL,KAAK,eAAe,EAGrB,MAAM,oBAAoB,CAAC;AAqB5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAiKxD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,eAAe,CA0KlB;AAED,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAAC,qBAAqB,CAmJtE,CAAC"}
package/dist/gateway.js CHANGED
@@ -145,8 +145,41 @@ async function waitForOpenClawSessionId(sessionsDir, sessionKey, timeoutMs = 10_
145
145
  }
146
146
  return null;
147
147
  }
148
- function createOpenClawDispatchAdapter(opts) {
148
+ export function createOpenClawDispatchAdapter(opts) {
149
149
  const activeStreams = new Map();
150
+ let configFallbackWarned = false;
151
+ /**
152
+ * Resolve the config for one dispatch. OpenClaw hot-reloads
153
+ * `agents.defaults.model` / `models.providers` WITHOUT restarting channel
154
+ * plugins, so the `ctx.cfg` snapshot captured at startAccount goes stale the
155
+ * moment the operator switches the agent's model — every run would keep the
156
+ * old model until the whole gateway restarts. `core.config.current()` is the
157
+ * host's live (hot-reload-refreshed) config; fall back to the startup
158
+ * snapshot on hosts that predate the API. The fallback warns once per
159
+ * degradation streak (latch resets on success) — silently dispatching with
160
+ * the stale snapshot would recreate the invisible model-switch mismatch this
161
+ * function exists to fix.
162
+ */
163
+ function resolveDispatchConfig(log) {
164
+ try {
165
+ const current = opts.core.config?.current?.();
166
+ if (current && typeof current === 'object') {
167
+ configFallbackWarned = false;
168
+ return current;
169
+ }
170
+ if (!configFallbackWarned) {
171
+ configFallbackWarned = true;
172
+ log?.warn?.(`parall[${opts.accountId}]: config.current() unavailable on this host — dispatching with the startup config snapshot; model switches need a gateway restart until then`);
173
+ }
174
+ }
175
+ catch (err) {
176
+ if (!configFallbackWarned) {
177
+ configFallbackWarned = true;
178
+ log?.warn?.(`parall[${opts.accountId}]: config.current() failed (${String(err)}) — dispatching with the startup config snapshot; model switches need a gateway restart until then`);
179
+ }
180
+ }
181
+ return opts.cfg;
182
+ }
150
183
  return {
151
184
  abortDispatch(sessionKey) {
152
185
  activeStreams.get(sessionKey)?.fail(new Error('dispatch deadline exceeded'));
@@ -172,7 +205,7 @@ function createOpenClawDispatchAdapter(opts) {
172
205
  let turnGroupKey = '';
173
206
  const run = opts.core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
174
207
  ctx: buildInboundCtx(opts.core, opts.accountId, event, sessionKey, promptBody, earlierEvents),
175
- cfg: opts.cfg,
208
+ cfg: resolveDispatchConfig(context.log),
176
209
  dispatcherOptions: {
177
210
  deliver: async (payload) => {
178
211
  const replyText = payload.text?.trim();
@@ -27226,6 +27226,8 @@ var ENDPOINTS = {
27226
27226
  PUSH_VAPID_KEY: `${API_BASE}/push/vapid-key`,
27227
27227
  // Notification preferences
27228
27228
  NOTIFICATION_PREFERENCES: `${API_BASE}/notification-preferences`,
27229
+ // Unified search (messages + tasks + wiki, org-scoped)
27230
+ SEARCH: (orgId) => `${API_BASE}/orgs/${orgId}/search`,
27229
27231
  // Feature flags (org-scoped, server-evaluated)
27230
27232
  FEATURE_FLAGS: (orgId) => `${API_BASE}/orgs/${orgId}/feature-flags`,
27231
27233
  // Billing & Credits (org-scoped)
@@ -27359,8 +27361,13 @@ var ParallClient = class _ParallClient {
27359
27361
  /** Proactive refresh when token expires within this window (seconds). */
27360
27362
  static REFRESH_THRESHOLD_S = 5 * 60;
27361
27363
  static normalizeFetchError(err) {
27362
- if (typeof DOMException !== "undefined" && err instanceof DOMException && (err.name === "TimeoutError" || err.name === "AbortError")) {
27363
- return new ApiError(0, "Request timed out", "REQUEST_TIMEOUT");
27364
+ if (typeof DOMException !== "undefined" && err instanceof DOMException) {
27365
+ if (err.name === "TimeoutError") {
27366
+ return new ApiError(0, "Request timed out", "REQUEST_TIMEOUT");
27367
+ }
27368
+ if (err.name === "AbortError") {
27369
+ return new ApiError(0, "Request aborted", "REQUEST_ABORTED");
27370
+ }
27364
27371
  }
27365
27372
  const apiError = new ApiError(0, "Network request failed", "NETWORK_ERROR");
27366
27373
  if (err instanceof Error && err.message && err.message !== "Failed to fetch") {
@@ -27467,13 +27474,15 @@ var ParallClient = class _ParallClient {
27467
27474
  url += `?${qs}`;
27468
27475
  }
27469
27476
  const headers = this.buildHeaders();
27477
+ const timeoutSignal = AbortSignal.timeout(opts?.timeoutMs ?? 15e3);
27478
+ const signal = opts?.signal ? AbortSignal.any([opts.signal, timeoutSignal]) : timeoutSignal;
27470
27479
  let res;
27471
27480
  try {
27472
27481
  res = await fetch(url, {
27473
27482
  method,
27474
27483
  headers,
27475
27484
  body: body ? JSON.stringify(body) : void 0,
27476
- signal: AbortSignal.timeout(opts?.timeoutMs ?? 15e3)
27485
+ signal
27477
27486
  });
27478
27487
  } catch (err) {
27479
27488
  throw _ParallClient.normalizeFetchError(err);
@@ -28421,6 +28430,9 @@ var ParallClient = class _ParallClient {
28421
28430
  async getWikiNodeSections(orgId, wikiId, params) {
28422
28431
  return this.request("GET", ENDPOINTS.WIKI_NODE_SECTIONS(orgId, wikiId), void 0, params);
28423
28432
  }
28433
+ async search(orgId, params, opts) {
28434
+ return this.request("GET", ENDPOINTS.SEARCH(orgId), void 0, params, false, opts);
28435
+ }
28424
28436
  async searchWiki(orgId, wikiId, params) {
28425
28437
  return this.request("GET", ENDPOINTS.WIKI_SEARCH(orgId, wikiId), void 0, params);
28426
28438
  }
@@ -32407,6 +32419,26 @@ async function waitForOpenClawSessionId(sessionsDir, sessionKey, timeoutMs = 1e4
32407
32419
  }
32408
32420
  function createOpenClawDispatchAdapter(opts) {
32409
32421
  const activeStreams = /* @__PURE__ */ new Map();
32422
+ let configFallbackWarned = false;
32423
+ function resolveDispatchConfig(log) {
32424
+ try {
32425
+ const current = opts.core.config?.current?.();
32426
+ if (current && typeof current === "object") {
32427
+ configFallbackWarned = false;
32428
+ return current;
32429
+ }
32430
+ if (!configFallbackWarned) {
32431
+ configFallbackWarned = true;
32432
+ log?.warn?.(`parall[${opts.accountId}]: config.current() unavailable on this host \u2014 dispatching with the startup config snapshot; model switches need a gateway restart until then`);
32433
+ }
32434
+ } catch (err) {
32435
+ if (!configFallbackWarned) {
32436
+ configFallbackWarned = true;
32437
+ log?.warn?.(`parall[${opts.accountId}]: config.current() failed (${String(err)}) \u2014 dispatching with the startup config snapshot; model switches need a gateway restart until then`);
32438
+ }
32439
+ }
32440
+ return opts.cfg;
32441
+ }
32410
32442
  return {
32411
32443
  abortDispatch(sessionKey) {
32412
32444
  activeStreams.get(sessionKey)?.fail(new Error("dispatch deadline exceeded"));
@@ -32432,7 +32464,7 @@ function createOpenClawDispatchAdapter(opts) {
32432
32464
  let turnGroupKey = "";
32433
32465
  const run = opts.core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
32434
32466
  ctx: buildInboundCtx(opts.core, opts.accountId, event, sessionKey, promptBody, earlierEvents),
32435
- cfg: opts.cfg,
32467
+ cfg: resolveDispatchConfig(context2.log),
32436
32468
  dispatcherOptions: {
32437
32469
  deliver: async (payload) => {
32438
32470
  const replyText = payload.text?.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/parall",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "description": "OpenClaw channel plugin for Parall IM",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,8 +16,8 @@
16
16
  "openclaw.plugin.json"
17
17
  ],
18
18
  "dependencies": {
19
- "@parall/agent-core": "1.33.0",
20
- "@parall/sdk": "1.33.0"
19
+ "@parall/agent-core": "1.34.0",
20
+ "@parall/sdk": "1.34.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.0.0",
package/src/gateway.ts CHANGED
@@ -195,7 +195,7 @@ async function waitForOpenClawSessionId(
195
195
  return null;
196
196
  }
197
197
 
198
- function createOpenClawDispatchAdapter(opts: {
198
+ export function createOpenClawDispatchAdapter(opts: {
199
199
  core: PluginRuntime;
200
200
  cfg: Record<string, unknown>;
201
201
  accountId: string;
@@ -203,6 +203,43 @@ function createOpenClawDispatchAdapter(opts: {
203
203
  workspaceDir: string;
204
204
  }): DispatchAdapter {
205
205
  const activeStreams = new Map<string, ReturnType<typeof createRuntimeEventStream>>();
206
+ let configFallbackWarned = false;
207
+
208
+ /**
209
+ * Resolve the config for one dispatch. OpenClaw hot-reloads
210
+ * `agents.defaults.model` / `models.providers` WITHOUT restarting channel
211
+ * plugins, so the `ctx.cfg` snapshot captured at startAccount goes stale the
212
+ * moment the operator switches the agent's model — every run would keep the
213
+ * old model until the whole gateway restarts. `core.config.current()` is the
214
+ * host's live (hot-reload-refreshed) config; fall back to the startup
215
+ * snapshot on hosts that predate the API. The fallback warns once per
216
+ * degradation streak (latch resets on success) — silently dispatching with
217
+ * the stale snapshot would recreate the invisible model-switch mismatch this
218
+ * function exists to fix.
219
+ */
220
+ function resolveDispatchConfig(log?: { warn?: (msg: string) => void }): Record<string, unknown> {
221
+ try {
222
+ const current = opts.core.config?.current?.();
223
+ if (current && typeof current === 'object') {
224
+ configFallbackWarned = false;
225
+ return current as unknown as Record<string, unknown>;
226
+ }
227
+ if (!configFallbackWarned) {
228
+ configFallbackWarned = true;
229
+ log?.warn?.(
230
+ `parall[${opts.accountId}]: config.current() unavailable on this host — dispatching with the startup config snapshot; model switches need a gateway restart until then`,
231
+ );
232
+ }
233
+ } catch (err) {
234
+ if (!configFallbackWarned) {
235
+ configFallbackWarned = true;
236
+ log?.warn?.(
237
+ `parall[${opts.accountId}]: config.current() failed (${String(err)}) — dispatching with the startup config snapshot; model switches need a gateway restart until then`,
238
+ );
239
+ }
240
+ }
241
+ return opts.cfg;
242
+ }
206
243
 
207
244
  return {
208
245
  abortDispatch(sessionKey: string): void {
@@ -238,7 +275,7 @@ function createOpenClawDispatchAdapter(opts: {
238
275
  promptBody,
239
276
  earlierEvents,
240
277
  ),
241
- cfg: opts.cfg,
278
+ cfg: resolveDispatchConfig(context.log),
242
279
  dispatcherOptions: {
243
280
  deliver: async (payload: { text?: string }) => {
244
281
  const replyText = payload.text?.trim();