@parall/parall 1.42.1 → 1.43.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.
@@ -1,4 +1,6 @@
1
1
  import type { ParallClient } from '@parall/sdk';
2
+ export declare function getChannelCapabilityFragments(): string[];
3
+ export declare function getChannelCapabilityKeys(): string[];
2
4
  interface ConfigManagerOpts {
3
5
  client: ParallClient;
4
6
  stateDir: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWhD,UAAU,iBAAiB;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAClG;AAwKD;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDxF"}
1
+ {"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuBhD,wBAAgB,6BAA6B,IAAI,MAAM,EAAE,CAExD;AAED,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAEnD;AAYD,UAAU,iBAAiB;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAClG;AAwKD;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDxF"}
@@ -1,5 +1,28 @@
1
+ import { extractCapabilities, materializeChannelCapabilities, } from '@parall/agent-core';
1
2
  import * as fs from 'node:fs';
2
3
  import * as path from 'node:path';
4
+ // Channel-capability snapshot for the OTHER consumers of capability state:
5
+ // the before_prompt_build hook (fragments into the system prompt — evaluated
6
+ // every prompt build, so a refresh reaches the very next turn without any
7
+ // restart) and the gateway's getCapabilityKeys (hint routing). Updated by
8
+ // applyChannelCapabilitySnapshot alongside every config apply, so the shim
9
+ // materialization and the declaration can never diverge within a refresh.
10
+ // Process-global BY THE SAME assumption as runtime.ts's agentIdentity:
11
+ // hosted agents run one-agent-per-pod, so a single snapshot is correct. A
12
+ // future multi-account host would need this keyed per account together with
13
+ // that identity global — do not fix one without the other.
14
+ let currentCapabilities = [];
15
+ export function getChannelCapabilityFragments() {
16
+ return currentCapabilities.map((c) => c.fragment);
17
+ }
18
+ export function getChannelCapabilityKeys() {
19
+ return currentCapabilities.map((c) => c.key);
20
+ }
21
+ function applyChannelCapabilitySnapshot(stateDir, config, log) {
22
+ const caps = extractCapabilities(config);
23
+ materializeChannelCapabilities(stateDir, caps, log);
24
+ currentCapabilities = caps;
25
+ }
3
26
  const CACHE_FILENAME = 'parall-platform-config.json';
4
27
  /** Tool names are no longer registered — all operations go through CLI. */
5
28
  function cachePath(stateDir) {
@@ -164,6 +187,7 @@ export async function fetchAndApplyPlatformConfig(opts) {
164
187
  if (cached) {
165
188
  log?.warn(`platform config fetch failed, using cached version ${cached.version}: ${String(err)}`);
166
189
  applyToOpenClawConfig(configPath, cached.config, credentials);
190
+ applyChannelCapabilitySnapshot(stateDir, cached.config, log);
167
191
  return;
168
192
  }
169
193
  // No cache and fetch fails — degrade gracefully
@@ -175,6 +199,7 @@ export async function fetchAndApplyPlatformConfig(opts) {
175
199
  log?.info('platform config unchanged (304)');
176
200
  if (cached) {
177
201
  applyToOpenClawConfig(configPath, cached.config, credentials);
202
+ applyChannelCapabilitySnapshot(stateDir, cached.config, log);
178
203
  }
179
204
  return;
180
205
  }
@@ -184,11 +209,13 @@ export async function fetchAndApplyPlatformConfig(opts) {
184
209
  log?.error(`platform config schema_version ${fresh.schema_version} is newer than supported (${SUPPORTED_SCHEMA_VERSION}), keeping current config`);
185
210
  if (cached) {
186
211
  applyToOpenClawConfig(configPath, cached.config, credentials);
212
+ applyChannelCapabilitySnapshot(stateDir, cached.config, log);
187
213
  }
188
214
  return;
189
215
  }
190
216
  // 5. Newer config received — save cache and apply
191
217
  log?.info(`platform config updated to version ${fresh.version}`);
192
218
  saveCachedConfig(stateDir, fresh);
219
+ applyChannelCapabilitySnapshot(stateDir, fresh.config, log);
193
220
  applyToOpenClawConfig(configPath, fresh.config, credentials);
194
221
  }
@@ -1 +1 @@
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;A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ParallAgentGateway, parseShutdownDeadlineMs, parseForkDeadlineMs, parseDispatchDeadlineMs, initAgentTelemetry, createOtelLogger, } from '@parall/agent-core';
1
+ import { ParallAgentGateway, capabilityBinDir, parseShutdownDeadlineMs, parseForkDeadlineMs, parseDispatchDeadlineMs, initAgentTelemetry, createOtelLogger, } from '@parall/agent-core';
2
2
  import { appendPreparedLocalAttachmentRefs, ensureLocalAttachmentGitExclude, pinLocalAttachmentPaths, } from '@parall/agent-core/internal/attachment-input';
3
3
  import { ApiError, ParallClient, ParallWs } from '@parall/sdk';
4
4
  import * as crypto from 'node:crypto';
@@ -7,7 +7,7 @@ import * as path from 'node:path';
7
7
  import { resolveParallAccount } from './accounts.js';
8
8
  import { getParallRuntime, removeParallAccountState, setAgentIdentity, setAgentSessionBinding, setDispatchGroupKey, setParallAccountState, } from './runtime.js';
9
9
  import { buildOrchestratorSessionKey } from './session.js';
10
- import { fetchAndApplyPlatformConfig } from './config-manager.js';
10
+ import { fetchAndApplyPlatformConfig, getChannelCapabilityKeys } from './config-manager.js';
11
11
  import { startWikiHelper } from './wiki-helper.js';
12
12
  import { SessionManager } from './oc-session.js';
13
13
  import { cleanupForkSession, clearSessionState, forkOrchestratorSession, resolveSessionId, resolveTranscriptFile, } from './fork.js';
@@ -332,6 +332,16 @@ export const parallGateway = {
332
332
  try {
333
333
  const stateDir = process.env.OPENCLAW_STATE_DIR || path.join(process.env.HOME || '/data', '.openclaw');
334
334
  const openclawConfigPath = path.join(stateDir, 'openclaw.json');
335
+ // Channel-capability shims resolve ahead of any globally-installed CLI
336
+ // of the same name. The plugin runs INSIDE the openclaw process, whose
337
+ // env every exec-tool child inherits — one idempotent prepend here
338
+ // covers the agent's shell commands for the process lifetime (the
339
+ // DIRECTORY is constant; its content tracks capability grants).
340
+ const shimDir = capabilityBinDir(stateDir);
341
+ const currentPath = process.env.PATH ?? '';
342
+ if (!currentPath.split(path.delimiter).includes(shimDir)) {
343
+ process.env.PATH = currentPath ? `${shimDir}${path.delimiter}${currentPath}` : shimDir;
344
+ }
335
345
  const configManagerOpts = {
336
346
  client,
337
347
  stateDir,
@@ -395,6 +405,9 @@ export const parallGateway = {
395
405
  runtimeRef: { hostname: os.hostname(), pid: process.pid },
396
406
  dispatchAdapter,
397
407
  log: otelLog,
408
+ // Live capability view for hint routing: the channel reply hint
409
+ // points at the vendor CLI only while the grant is active.
410
+ getCapabilityKeys: getChannelCapabilityKeys,
398
411
  shutdownDeadlineMs: parseShutdownDeadlineMs(process.env.PRLL_SHUTDOWN_DEADLINE_MS),
399
412
  forkDeadlineMs: parseForkDeadlineMs(process.env.PRLL_FORK_DEADLINE_MS),
400
413
  dispatchDeadlineMs: parseDispatchDeadlineMs(process.env.PRLL_DISPATCH_DEADLINE_MS),
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA+G7D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,QA6KzD"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAgH7D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,QAmLzD"}
package/dist/hooks.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { PRLL_BEHAVIOR, PRLL_REFERENCE_GUIDE, buildIdentity, isParallSendCommand, isParallNoReplyCommand, recordToolCall, recordMessageSend, recordNoReply, } from '@parall/agent-core';
2
+ import { getChannelCapabilityFragments } from './config-manager.js';
2
3
  import { extractAccountIdFromSessionKey } from './session.js';
3
4
  import { clearDispatchGroupKey, getAgentIdentity, getAgentSessionBinding, getDispatchGroupKey, getDispatchMessageId, getParallAccountState, getSessionChatId, setAgentSessionBinding, } from './runtime.js';
4
5
  import { resolveSessionId } from './fork.js';
@@ -107,6 +108,12 @@ export function registerParallHooks(api) {
107
108
  PRLL_CHANNEL_CONTEXT,
108
109
  PRLL_BEHAVIOR,
109
110
  PRLL_REFERENCE_GUIDE,
111
+ // Channel-capability declarations (platform-config
112
+ // agents.capabilities[]). Evaluated on EVERY prompt build, so a
113
+ // capability grant/revocation reaches the next turn without any
114
+ // restart — the openclaw analogue of the CLI bridges' prompt-file
115
+ // rewrite + respawn.
116
+ ...getChannelCapabilityFragments(),
110
117
  ].join('\n\n'),
111
118
  };
112
119
  });