@nextclaw/openclaw-compat 0.1.34 → 0.2.1

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _nextclaw_core from '@nextclaw/core';
2
- import { Config, ExtensionChannel } from '@nextclaw/core';
2
+ import { Config, ExtensionChannel, AgentEngineFactory } from '@nextclaw/core';
3
3
 
4
4
  type PluginConfigUiHint = {
5
5
  label?: string;
@@ -51,6 +51,9 @@ type OpenClawPluginToolOptions = {
51
51
  names?: string[];
52
52
  optional?: boolean;
53
53
  };
54
+ type OpenClawPluginEngineOptions = {
55
+ kind: string;
56
+ };
54
57
  type OpenClawProviderPlugin = {
55
58
  id: string;
56
59
  label?: string;
@@ -171,6 +174,7 @@ type PluginRecord = {
171
174
  toolNames: string[];
172
175
  channelIds: string[];
173
176
  providerIds: string[];
177
+ engineKinds: string[];
174
178
  configSchema: boolean;
175
179
  configUiHints?: Record<string, PluginConfigUiHint>;
176
180
  configJsonSchema?: Record<string, unknown>;
@@ -192,6 +196,12 @@ type PluginProviderRegistration = {
192
196
  provider: OpenClawProviderPlugin;
193
197
  source: string;
194
198
  };
199
+ type PluginEngineRegistration = {
200
+ pluginId: string;
201
+ kind: string;
202
+ factory: AgentEngineFactory;
203
+ source: string;
204
+ };
195
205
  type PluginReplyDispatchParams = {
196
206
  ctx: {
197
207
  Body?: string;
@@ -253,6 +263,7 @@ type OpenClawPluginApi = {
253
263
  registerTool: (tool: OpenClawPluginTool | OpenClawPluginToolFactory, opts?: OpenClawPluginToolOptions) => void;
254
264
  registerChannel: (registration: OpenClawPluginChannelRegistration) => void;
255
265
  registerProvider: (provider: OpenClawProviderPlugin) => void;
266
+ registerEngine: (factory: AgentEngineFactory, opts: OpenClawPluginEngineOptions) => void;
256
267
  registerHook: (_events: string | string[], _handler: unknown, _opts?: unknown) => void;
257
268
  registerGatewayMethod: (_method: string, _handler: unknown) => void;
258
269
  registerCli: (_registrar: unknown, _opts?: unknown) => void;
@@ -270,6 +281,7 @@ type PluginRegistry = {
270
281
  tools: PluginToolRegistration[];
271
282
  channels: PluginChannelRegistration[];
272
283
  providers: PluginProviderRegistration[];
284
+ engines: PluginEngineRegistration[];
273
285
  diagnostics: PluginDiagnostic[];
274
286
  resolvedTools: OpenClawPluginTool[];
275
287
  };
@@ -464,6 +476,7 @@ type PluginLoadOptions = {
464
476
  reservedToolNames?: string[];
465
477
  reservedChannelIds?: string[];
466
478
  reservedProviderIds?: string[];
479
+ reservedEngineKinds?: string[];
467
480
  };
468
481
  declare function loadOpenClawPlugins(options: PluginLoadOptions): PluginRegistry;
469
482
 
@@ -540,10 +553,12 @@ type PluginRegisterRuntime = {
540
553
  toolNameOwners: Map<string, string>;
541
554
  channelIdOwners: Map<string, string>;
542
555
  providerIdOwners: Map<string, string>;
556
+ engineKindOwners: Map<string, string>;
543
557
  resolvedToolNames: Set<string>;
544
558
  reservedToolNames: Set<string>;
545
559
  reservedChannelIds: Set<string>;
546
560
  reservedProviderIds: Set<string>;
561
+ reservedEngineKinds: Set<string>;
547
562
  };
548
563
  declare function createPluginRegisterRuntime(params: {
549
564
  config: Config;
@@ -553,6 +568,7 @@ declare function createPluginRegisterRuntime(params: {
553
568
  reservedToolNames: Set<string>;
554
569
  reservedChannelIds: Set<string>;
555
570
  reservedProviderIds: Set<string>;
571
+ reservedEngineKinds: Set<string>;
556
572
  }): PluginRegisterRuntime;
557
573
  declare function registerPluginWithApi(params: {
558
574
  runtime: PluginRegisterRuntime;
@@ -590,6 +606,7 @@ declare function buildPluginStatusReport(params: {
590
606
  reservedToolNames?: string[];
591
607
  reservedChannelIds?: string[];
592
608
  reservedProviderIds?: string[];
609
+ reservedEngineKinds?: string[];
593
610
  }): PluginStatusReport;
594
611
 
595
612
  type UninstallActions = {
@@ -627,4 +644,4 @@ declare function uninstallPlugin(params: {
627
644
  extensionsDir?: string;
628
645
  }): Promise<UninstallPluginResult>;
629
646
 
630
- export { DEFAULT_ACCOUNT_ID, type InstallPluginResult, type NormalizedPluginsConfig, type OpenClawChannelAgentPrompt, type OpenClawChannelConfigAdapter, type OpenClawChannelConfigSchema, type OpenClawChannelGateway, type OpenClawChannelGatewayStartContext, type OpenClawChannelPlugin, type OpenClawChannelSetup, type OpenClawPluginApi, type OpenClawPluginChannelRegistration, type OpenClawPluginConfigSchema, type OpenClawPluginDefinition, type OpenClawPluginModule, type OpenClawPluginTool, type OpenClawPluginToolContext, type OpenClawPluginToolFactory, type OpenClawPluginToolOptions, type OpenClawProviderPlugin, PLUGIN_MANIFEST_FILENAME, PLUGIN_MANIFEST_FILENAMES, type PackageManifest, type PluginCandidate, type PluginChannelBinding, type PluginChannelGatewayHandle, type PluginChannelRegistration, type PluginConfigUiHint, type PluginDiagnostic, type PluginDiscoveryResult, type PluginInstallLogger, type PluginInstallSource, type PluginInstallUpdate, type PluginKind, type PluginLoadOptions, type PluginLogger, type PluginManifest, type PluginManifestLoadResult, type PluginManifestRecord, type PluginManifestRegistry, type PluginOrigin, type PluginProviderRegistration, type PluginRecord, type PluginRegisterRuntime, type PluginRegistry, type PluginReplyDispatchParams, type PluginRuntime, type PluginRuntimeBridge, type PluginStatusReport, type PluginToolRegistration, type PluginUiMetadata, type UninstallActions, type UninstallPluginResult, type _CompatOnly, __nextclawPluginSdkCompat, addPluginLoadPath, buildChannelConfigSchema, buildOauthProviderAuthResult, buildPluginStatusReport, createNextclawBuiltinChannelPlugin, createPluginRegisterRuntime, createPluginRuntime, disablePluginInConfig, discoverOpenClawPlugins, emptyPluginConfigSchema, enablePluginInConfig, getPackageManifestMetadata, getPluginChannelBindings, getPluginUiMetadataFromRegistry, installPluginFromArchive, installPluginFromDir, installPluginFromFile, installPluginFromNpmSpec, installPluginFromPath, loadOpenClawPlugins, loadPluginManifest, loadPluginManifestRegistry, loadPluginUiMetadata, normalizeAccountId, normalizePluginHttpPath, normalizePluginsConfig, recordPluginInstall, registerPluginWithApi, removePluginFromConfig, resolveEnableState, resolvePluginChannelMessageToolHints, resolvePluginInstallDir, resolvePluginManifestPath, resolveUninstallDirectoryTarget, setPluginRuntimeBridge, sleep, startPluginChannelGateways, stopPluginChannelGateways, toPluginUiMetadata, uninstallPlugin, validateJsonSchemaValue };
647
+ export { DEFAULT_ACCOUNT_ID, type InstallPluginResult, type NormalizedPluginsConfig, type OpenClawChannelAgentPrompt, type OpenClawChannelConfigAdapter, type OpenClawChannelConfigSchema, type OpenClawChannelGateway, type OpenClawChannelGatewayStartContext, type OpenClawChannelPlugin, type OpenClawChannelSetup, type OpenClawPluginApi, type OpenClawPluginChannelRegistration, type OpenClawPluginConfigSchema, type OpenClawPluginDefinition, type OpenClawPluginEngineOptions, type OpenClawPluginModule, type OpenClawPluginTool, type OpenClawPluginToolContext, type OpenClawPluginToolFactory, type OpenClawPluginToolOptions, type OpenClawProviderPlugin, PLUGIN_MANIFEST_FILENAME, PLUGIN_MANIFEST_FILENAMES, type PackageManifest, type PluginCandidate, type PluginChannelBinding, type PluginChannelGatewayHandle, type PluginChannelRegistration, type PluginConfigUiHint, type PluginDiagnostic, type PluginDiscoveryResult, type PluginEngineRegistration, type PluginInstallLogger, type PluginInstallSource, type PluginInstallUpdate, type PluginKind, type PluginLoadOptions, type PluginLogger, type PluginManifest, type PluginManifestLoadResult, type PluginManifestRecord, type PluginManifestRegistry, type PluginOrigin, type PluginProviderRegistration, type PluginRecord, type PluginRegisterRuntime, type PluginRegistry, type PluginReplyDispatchParams, type PluginRuntime, type PluginRuntimeBridge, type PluginStatusReport, type PluginToolRegistration, type PluginUiMetadata, type UninstallActions, type UninstallPluginResult, type _CompatOnly, __nextclawPluginSdkCompat, addPluginLoadPath, buildChannelConfigSchema, buildOauthProviderAuthResult, buildPluginStatusReport, createNextclawBuiltinChannelPlugin, createPluginRegisterRuntime, createPluginRuntime, disablePluginInConfig, discoverOpenClawPlugins, emptyPluginConfigSchema, enablePluginInConfig, getPackageManifestMetadata, getPluginChannelBindings, getPluginUiMetadataFromRegistry, installPluginFromArchive, installPluginFromDir, installPluginFromFile, installPluginFromNpmSpec, installPluginFromPath, loadOpenClawPlugins, loadPluginManifest, loadPluginManifestRegistry, loadPluginUiMetadata, normalizeAccountId, normalizePluginHttpPath, normalizePluginsConfig, recordPluginInstall, registerPluginWithApi, removePluginFromConfig, resolveEnableState, resolvePluginChannelMessageToolHints, resolvePluginInstallDir, resolvePluginManifestPath, resolveUninstallDirectoryTarget, setPluginRuntimeBridge, sleep, startPluginChannelGateways, stopPluginChannelGateways, toPluginUiMetadata, uninstallPlugin, validateJsonSchemaValue };
package/dist/index.js CHANGED
@@ -1371,10 +1371,12 @@ function createPluginRegisterRuntime(params) {
1371
1371
  toolNameOwners: /* @__PURE__ */ new Map(),
1372
1372
  channelIdOwners: /* @__PURE__ */ new Map(),
1373
1373
  providerIdOwners: /* @__PURE__ */ new Map(),
1374
+ engineKindOwners: /* @__PURE__ */ new Map(),
1374
1375
  resolvedToolNames: /* @__PURE__ */ new Set(),
1375
1376
  reservedToolNames: params.reservedToolNames,
1376
1377
  reservedChannelIds: params.reservedChannelIds,
1377
- reservedProviderIds: params.reservedProviderIds
1378
+ reservedProviderIds: params.reservedProviderIds,
1379
+ reservedEngineKinds: params.reservedEngineKinds
1378
1380
  };
1379
1381
  }
1380
1382
  function registerPluginTool(params) {
@@ -1556,6 +1558,27 @@ function registerPluginProvider(params) {
1556
1558
  });
1557
1559
  params.record.providerIds.push(accepted[0]);
1558
1560
  }
1561
+ function registerPluginEngine(params) {
1562
+ const accepted = ensureUniqueNames({
1563
+ names: [params.kind],
1564
+ pluginId: params.pluginId,
1565
+ diagnostics: params.runtime.registry.diagnostics,
1566
+ source: params.source,
1567
+ owners: params.runtime.engineKindOwners,
1568
+ reserved: params.runtime.reservedEngineKinds,
1569
+ kind: "engine"
1570
+ });
1571
+ if (accepted.length === 0) {
1572
+ return;
1573
+ }
1574
+ params.runtime.registry.engines.push({
1575
+ pluginId: params.pluginId,
1576
+ kind: accepted[0],
1577
+ factory: params.factory,
1578
+ source: params.source
1579
+ });
1580
+ params.record.engineKinds.push(accepted[0]);
1581
+ }
1559
1582
  function registerPluginWithApi(params) {
1560
1583
  const pluginRuntime = createPluginRuntime({ workspace: params.runtime.workspaceDir, config: params.runtime.config });
1561
1584
  const pluginLogger = buildPluginLogger(params.runtime.logger, params.pluginId);
@@ -1606,6 +1629,26 @@ function registerPluginWithApi(params) {
1606
1629
  provider
1607
1630
  });
1608
1631
  },
1632
+ registerEngine: (factory, opts) => {
1633
+ const kind = opts?.kind?.trim().toLowerCase();
1634
+ if (!kind) {
1635
+ params.runtime.registry.diagnostics.push({
1636
+ level: "error",
1637
+ pluginId: params.pluginId,
1638
+ source: params.source,
1639
+ message: "registerEngine requires opts.kind"
1640
+ });
1641
+ return;
1642
+ }
1643
+ registerPluginEngine({
1644
+ runtime: params.runtime,
1645
+ record: params.record,
1646
+ pluginId: params.pluginId,
1647
+ source: params.source,
1648
+ kind,
1649
+ factory
1650
+ });
1651
+ },
1609
1652
  registerHook: () => pushUnsupported("registerHook"),
1610
1653
  registerGatewayMethod: () => pushUnsupported("registerGatewayMethod"),
1611
1654
  registerCli: () => pushUnsupported("registerCli"),
@@ -1735,6 +1778,7 @@ function createPluginRecord(params) {
1735
1778
  toolNames: [],
1736
1779
  channelIds: [],
1737
1780
  providerIds: [],
1781
+ engineKinds: [],
1738
1782
  configSchema: params.configSchema,
1739
1783
  configUiHints: params.configUiHints,
1740
1784
  configJsonSchema: params.configJsonSchema
@@ -1873,12 +1917,14 @@ function loadOpenClawPlugins(options) {
1873
1917
  tools: [],
1874
1918
  channels: [],
1875
1919
  providers: [],
1920
+ engines: [],
1876
1921
  diagnostics: [],
1877
1922
  resolvedTools: []
1878
1923
  };
1879
1924
  const reservedToolNames = new Set(options.reservedToolNames ?? []);
1880
1925
  const reservedChannelIds = new Set(options.reservedChannelIds ?? []);
1881
1926
  const reservedProviderIds = new Set(options.reservedProviderIds ?? []);
1927
+ const reservedEngineKinds = new Set((options.reservedEngineKinds ?? ["native"]).map((entry) => entry.toLowerCase()));
1882
1928
  const registerRuntime = createPluginRegisterRuntime({
1883
1929
  config: options.config,
1884
1930
  workspaceDir,
@@ -1886,7 +1932,8 @@ function loadOpenClawPlugins(options) {
1886
1932
  registry,
1887
1933
  reservedToolNames,
1888
1934
  reservedChannelIds,
1889
- reservedProviderIds
1935
+ reservedProviderIds,
1936
+ reservedEngineKinds
1890
1937
  });
1891
1938
  const pluginSdkAlias = resolvePluginSdkAlias();
1892
1939
  const jiti = createJiti(import.meta.url, {
@@ -2091,7 +2138,8 @@ function buildPluginStatusReport(params) {
2091
2138
  logger: params.logger,
2092
2139
  reservedToolNames: params.reservedToolNames,
2093
2140
  reservedChannelIds: params.reservedChannelIds,
2094
- reservedProviderIds: params.reservedProviderIds
2141
+ reservedProviderIds: params.reservedProviderIds,
2142
+ reservedEngineKinds: params.reservedEngineKinds
2095
2143
  });
2096
2144
  return {
2097
2145
  workspaceDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/openclaw-compat",
3
- "version": "0.1.34",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "description": "OpenClaw plugin compatibility layer for NextClaw.",
6
6
  "type": "module",
@@ -14,22 +14,22 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "ajv": "^8.17.1",
18
- "jiti": "^1.21.7",
19
- "jszip": "^3.10.1",
20
- "tar": "^7.4.3",
21
- "@nextclaw/core": "^0.6.45",
22
- "@nextclaw/channel-plugin-telegram": "^0.1.6",
23
- "@nextclaw/channel-plugin-whatsapp": "^0.1.6",
17
+ "@nextclaw/channel-plugin-dingtalk": "^0.1.6",
24
18
  "@nextclaw/channel-plugin-discord": "^0.1.7",
19
+ "@nextclaw/channel-plugin-email": "^0.1.6",
25
20
  "@nextclaw/channel-plugin-feishu": "^0.1.6",
26
21
  "@nextclaw/channel-plugin-mochat": "^0.1.6",
27
- "@nextclaw/channel-plugin-dingtalk": "^0.1.6",
28
- "@nextclaw/channel-plugin-wecom": "^0.1.6",
29
- "@nextclaw/channel-plugin-email": "^0.1.6",
30
- "@nextclaw/channel-plugin-slack": "^0.1.6",
31
22
  "@nextclaw/channel-plugin-qq": "^0.1.6",
32
- "@nextclaw/channel-runtime": "^0.1.28"
23
+ "@nextclaw/channel-plugin-slack": "^0.1.6",
24
+ "@nextclaw/channel-plugin-telegram": "^0.1.6",
25
+ "@nextclaw/channel-plugin-wecom": "^0.1.6",
26
+ "@nextclaw/channel-plugin-whatsapp": "^0.1.6",
27
+ "@nextclaw/channel-runtime": "^0.1.30",
28
+ "@nextclaw/core": "^0.7.3",
29
+ "ajv": "^8.17.1",
30
+ "jiti": "^1.21.7",
31
+ "jszip": "^3.10.1",
32
+ "tar": "^7.4.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^20.17.6",