@blockrun/clawrouter 0.12.126 → 0.12.127

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.js CHANGED
@@ -81236,69 +81236,71 @@ var plugin = {
81236
81236
  return;
81237
81237
  }
81238
81238
  const proc = process;
81239
- if (proc.__clawrouterRegistered) return;
81239
+ const alreadyRegistered = !!proc.__clawrouterRegistered;
81240
81240
  proc.__clawrouterRegistered = true;
81241
- api.registerProvider(blockrunProvider);
81242
- api.registerImageGenerationProvider(buildImageGenerationProvider());
81243
- api.registerMusicGenerationProvider(buildMusicGenerationProvider());
81244
- injectModelsConfig(api.logger);
81245
- injectAuthProfile(api.logger);
81246
- const runtimePort = getProxyPort();
81247
- if (!api.config.models) {
81248
- api.config.models = { providers: {} };
81249
- }
81250
- if (!api.config.models.providers) {
81251
- api.config.models.providers = {};
81252
- }
81253
- api.config.models.providers.blockrun = {
81254
- baseUrl: `http://127.0.0.1:${runtimePort}/v1`,
81255
- api: "openai-completions",
81256
- // apiKey is required by pi-coding-agent's ModelRegistry for providers with models.
81257
- apiKey: "x402-proxy-handles-auth",
81258
- models: OPENCLAW_MODELS
81259
- };
81260
- api.logger.info("BlockRun provider registered (55+ models via x402)");
81261
- try {
81262
- const proxyBaseUrl = `http://127.0.0.1:${runtimePort}`;
81263
- const partnerTools = buildPartnerTools(proxyBaseUrl);
81264
- for (const tool of partnerTools) {
81265
- api.registerTool(tool);
81266
- }
81267
- if (partnerTools.length > 0) {
81268
- api.logger.info(
81269
- `Registered ${partnerTools.length} partner tool(s): ${partnerTools.map((t) => t.name).join(", ")}`
81241
+ if (!alreadyRegistered) {
81242
+ api.registerProvider(blockrunProvider);
81243
+ api.registerImageGenerationProvider(buildImageGenerationProvider());
81244
+ api.registerMusicGenerationProvider(buildMusicGenerationProvider());
81245
+ injectModelsConfig(api.logger);
81246
+ injectAuthProfile(api.logger);
81247
+ const runtimePort = getProxyPort();
81248
+ if (!api.config.models) {
81249
+ api.config.models = { providers: {} };
81250
+ }
81251
+ if (!api.config.models.providers) {
81252
+ api.config.models.providers = {};
81253
+ }
81254
+ api.config.models.providers.blockrun = {
81255
+ baseUrl: `http://127.0.0.1:${runtimePort}/v1`,
81256
+ api: "openai-completions",
81257
+ // apiKey is required by pi-coding-agent's ModelRegistry for providers with models.
81258
+ apiKey: "x402-proxy-handles-auth",
81259
+ models: OPENCLAW_MODELS
81260
+ };
81261
+ api.logger.info("BlockRun provider registered (55+ models via x402)");
81262
+ try {
81263
+ const proxyBaseUrl = `http://127.0.0.1:${runtimePort}`;
81264
+ const partnerTools = buildPartnerTools(proxyBaseUrl);
81265
+ for (const tool of partnerTools) {
81266
+ api.registerTool(tool);
81267
+ }
81268
+ if (partnerTools.length > 0) {
81269
+ api.logger.info(
81270
+ `Registered ${partnerTools.length} partner tool(s): ${partnerTools.map((t) => t.name).join(", ")}`
81271
+ );
81272
+ }
81273
+ } catch (err) {
81274
+ api.logger.warn(
81275
+ `Failed to register partner tools: ${err instanceof Error ? err.message : String(err)}`
81270
81276
  );
81271
81277
  }
81272
- api.registerCommand({
81273
- name: "partners",
81274
- description: "List available partner APIs and pricing",
81275
- acceptsArgs: false,
81276
- requireAuth: false,
81277
- handler: async () => {
81278
- if (PARTNER_SERVICES.length === 0) {
81279
- return { text: "No partner APIs available." };
81280
- }
81281
- const lines = ["**Partner APIs** (paid via your ClawRouter wallet)", ""];
81282
- for (const svc of PARTNER_SERVICES) {
81283
- lines.push(`**${svc.name}** (${svc.partner})`);
81284
- lines.push(` ${svc.description}`);
81285
- lines.push(` Tool: \`${`blockrun_${svc.id}`}\``);
81286
- lines.push(
81287
- ` Pricing: ${svc.pricing.perUnit} per ${svc.pricing.unit} (min ${svc.pricing.minimum}, max ${svc.pricing.maximum})`
81288
- );
81289
- lines.push(
81290
- ` **How to use:** Ask "Look up Twitter user @elonmusk" or "Get info on these X accounts: @naval, @balajis"`
81291
- );
81292
- lines.push("");
81293
- }
81294
- return { text: lines.join("\n") };
81295
- }
81296
- });
81297
- } catch (err) {
81298
- api.logger.warn(
81299
- `Failed to register partner tools: ${err instanceof Error ? err.message : String(err)}`
81300
- );
81301
81278
  }
81279
+ api.registerCommand({
81280
+ name: "partners",
81281
+ description: "List available partner APIs and pricing",
81282
+ acceptsArgs: false,
81283
+ requireAuth: false,
81284
+ handler: async () => {
81285
+ if (PARTNER_SERVICES.length === 0) {
81286
+ return { text: "No partner APIs available." };
81287
+ }
81288
+ const lines = ["**Partner APIs** (paid via your ClawRouter wallet)", ""];
81289
+ for (const svc of PARTNER_SERVICES) {
81290
+ lines.push(`**${svc.name}** (${svc.partner})`);
81291
+ lines.push(` ${svc.description}`);
81292
+ lines.push(` Tool: \`${`blockrun_${svc.id}`}\``);
81293
+ lines.push(
81294
+ ` Pricing: ${svc.pricing.perUnit} per ${svc.pricing.unit} (min ${svc.pricing.minimum}, max ${svc.pricing.maximum})`
81295
+ );
81296
+ lines.push(
81297
+ ` **How to use:** Ask "Look up Twitter user @elonmusk" or "Get info on these X accounts: @naval, @balajis"`
81298
+ );
81299
+ lines.push("");
81300
+ }
81301
+ return { text: lines.join("\n") };
81302
+ }
81303
+ });
81302
81304
  api.registerCommand(createWalletCommand(api));
81303
81305
  try {
81304
81306
  const blockrunAlias = createWalletCommand(api);
@@ -81309,6 +81311,7 @@ var plugin = {
81309
81311
  api.registerCommand(createStatsCommand());
81310
81312
  api.registerCommand(createExcludeCommand());
81311
81313
  api.logger.info("Commands registered: /wallet, /blockrun, /stats, /exclude");
81314
+ if (alreadyRegistered) return;
81312
81315
  api.registerService({
81313
81316
  id: "clawrouter-proxy",
81314
81317
  start: () => {
@@ -81353,7 +81356,7 @@ var plugin = {
81353
81356
  }
81354
81357
  startProxyInBackground(api).then(async () => {
81355
81358
  const port = getProxyPort();
81356
- const healthy = await waitForProxyHealth(port, 5e3);
81359
+ const healthy = await waitForProxyHealth(port, 15e3);
81357
81360
  if (!healthy) {
81358
81361
  api.logger.warn(`Proxy health check timed out, commands may not work immediately`);
81359
81362
  }