@token2chat/t2c 0.2.1 → 0.2.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.
@@ -67,9 +67,10 @@ async function getConfigPath() {
67
67
  }
68
68
  /**
69
69
  * Merge Token2Chat configuration into existing OpenClaw config.
70
- * Handles:
71
- * - Arrays and nested objects
72
- * - Existing token2chat config (overwrites, doesn't duplicate)
70
+ *
71
+ * Only adds the token2chat models provider — does NOT modify
72
+ * agents.defaults.model or agents.defaults.models so existing
73
+ * primary/fallback routing is preserved.
73
74
  */
74
75
  function mergeToken2ChatConfig(existingConfig, t2cConfig, gateModels, apiKey) {
75
76
  const config = { ...existingConfig };
@@ -90,23 +91,9 @@ function mergeToken2ChatConfig(existingConfig, t2cConfig, gateModels, apiKey) {
90
91
  api: "openai-completions",
91
92
  models: activeModels,
92
93
  };
93
- // Set up agents.defaults with token2chat model allowlist and fallbacks
94
- if (!config.agents || typeof config.agents !== "object") {
95
- config.agents = {};
96
- }
97
- const agents = config.agents;
98
- if (!agents.defaults || typeof agents.defaults !== "object") {
99
- agents.defaults = {};
100
- }
101
- const defaults = agents.defaults;
102
- const modelIds = activeModels.map((m) => m.id);
103
- defaults.models = modelIds;
104
- defaults.model = {
105
- ...(typeof defaults.model === "object" && defaults.model !== null
106
- ? defaults.model
107
- : {}),
108
- fallbacks: modelIds,
109
- };
94
+ // Do NOT touch agents.defaults the user's primary model and
95
+ // fallback chain should stay intact. Token2Chat models are available
96
+ // via the "token2chat/" provider prefix (e.g. token2chat/anthropic-claude-sonnet-4).
110
97
  return config;
111
98
  }
112
99
  export const openclawConnector = {
@@ -185,13 +172,22 @@ export const openclawConnector = {
185
172
  console.log(` Fund your wallet: t2c mint <amount>`);
186
173
  console.log(` Mint URL: ${config.mintUrl}`);
187
174
  }
175
+ // Show available model IDs for easy copy-paste
176
+ const activeModels = gateModels.length > 0 ? gateModels : DEFAULT_MODELS;
177
+ const modelList = activeModels.map((m) => `token2chat/${m.id}`);
188
178
  console.log("\n📋 Next steps:\n");
189
179
  console.log(" 1. Restart OpenClaw gateway:");
190
180
  console.log(" openclaw gateway restart\n");
191
- console.log(" 2. Start the t2c proxy:");
181
+ console.log(" 2. Make sure the t2c proxy is running:");
192
182
  console.log(" t2c service start\n");
193
- console.log(" 3. Use Token2Chat models with:");
194
- console.log(" token2chat/anthropic-claude-sonnet-4\n");
183
+ console.log(" 3. Use Token2Chat models (via provider prefix):");
184
+ for (const mid of modelList) {
185
+ console.log(` ${mid}`);
186
+ }
187
+ console.log("");
188
+ console.log(" 4. (Optional) Add as fallback in openclaw.json:");
189
+ console.log(' agents.defaults.model.fallbacks → ["token2chat/anthropic-claude-sonnet-4", ...]');
190
+ console.log("");
195
191
  },
196
192
  async verify() {
197
193
  // Check if config has our entries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@token2chat/t2c",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "t2c - Pay-per-request LLM access via Cashu ecash",