@commonlyai/cli 0.1.373 → 0.1.374
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.
|
@@ -21,6 +21,8 @@ const MAX_STDERR_CHARS = 4096;
|
|
|
21
21
|
const MAX_LINE_CHARS = 1024 * 1024;
|
|
22
22
|
// Keys the wrapper owns in the profile's .env. Every other line is the user's.
|
|
23
23
|
const PROFILE_ENV_KEYS = ['OPENROUTER_API_KEY', 'OPENROUTER_BASE_URL'];
|
|
24
|
+
const HERMES_NO_PROVIDER = 'Hermes connects through OpenRouter only, so it can\'t use the provider block in this '
|
|
25
|
+
+ 'environment file. Remove that block and set OPENROUTER_API_KEY where this agent runs.';
|
|
24
26
|
const PLAIN_ENV_VALUE = /^[A-Za-z0-9_\-.:/+=@%~]+$/;
|
|
25
27
|
|
|
26
28
|
const definedKey = (line) => {
|
|
@@ -214,17 +216,25 @@ export const createHermesAdapter = ({
|
|
|
214
216
|
runtimeType: 'hermes',
|
|
215
217
|
supportsProvider: false,
|
|
216
218
|
providerKeyEnv: 'OPENROUTER_API_KEY',
|
|
219
|
+
// The CLI's shared provider check answers before validateEnvironment, so it
|
|
220
|
+
// reads this text for Hermes (F116).
|
|
221
|
+
noProviderRefusal: HERMES_NO_PROVIDER,
|
|
217
222
|
|
|
223
|
+
// F116: these refusals reach the person attaching their own agent, so each
|
|
224
|
+
// says what Hermes needs and what to do next, in words that person can act on.
|
|
218
225
|
async validateEnvironment(environment) {
|
|
219
|
-
if (environment?.provider !== undefined)
|
|
220
|
-
throw new Error('Hermes adapter does not consume environment.provider; supply OPENROUTER_API_KEY in the host environment');
|
|
221
|
-
}
|
|
226
|
+
if (environment?.provider !== undefined) throw new Error(HERMES_NO_PROVIDER);
|
|
222
227
|
if (environment?.mcp?.length) {
|
|
223
|
-
throw new Error('Hermes
|
|
228
|
+
throw new Error('Commonly can\'t give Hermes extra MCP servers yet, so this environment file can\'t '
|
|
229
|
+
+ 'list any. Remove the mcp block to run Hermes.');
|
|
230
|
+
}
|
|
231
|
+
if (effectiveTrust(environment?.sandbox?.trust) === 'public') {
|
|
232
|
+
throw new Error('Commonly has no sandbox for Hermes yet, so Hermes can\'t run as a public seat. '
|
|
233
|
+
+ 'Pick another harness for a public seat.');
|
|
224
234
|
}
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
|
|
235
|
+
if (environment?.sandbox?.mode && environment.sandbox.mode !== 'none') {
|
|
236
|
+
throw new Error(`This environment file asks for sandbox.mode=${environment.sandbox.mode}, and Commonly `
|
|
237
|
+
+ 'has no sandbox for Hermes yet, so Hermes can\'t run under it.');
|
|
228
238
|
}
|
|
229
239
|
},
|
|
230
240
|
|
|
@@ -247,7 +257,8 @@ export const createHermesAdapter = ({
|
|
|
247
257
|
throw new Error(`Hermes Agent ${SUPPORTED_HERMES_VERSION_RANGE} is not on PATH; install for your OS: https://hermes-agent.nousresearch.com/docs/getting-started/installation`);
|
|
248
258
|
}
|
|
249
259
|
if (!env.OPENROUTER_API_KEY) {
|
|
250
|
-
throw new Error('
|
|
260
|
+
throw new Error('Hermes connects through OpenRouter only. Set OPENROUTER_API_KEY where this agent runs, '
|
|
261
|
+
+ 'then start it again.');
|
|
251
262
|
}
|
|
252
263
|
await syncProfileEnv(home, env);
|
|
253
264
|
const cwd = ctx.cwd || process.cwd();
|
package/package.json
CHANGED
package/src/lib/environment.js
CHANGED
|
@@ -200,10 +200,13 @@ export const PROVIDER_APIS = Object.freeze(['openai-chat', 'anthropic-messages',
|
|
|
200
200
|
// One provider check for config, attach, run and the daemon's adapter swap: the adapter must take a
|
|
201
201
|
// provider block at all, and speak its `provider.api` (default openai-chat). An adapter's
|
|
202
202
|
// `providerVerdict(environment)` answers first when it returns a refusal or null (accepted);
|
|
203
|
-
// undefined leaves the seat to this check.
|
|
203
|
+
// undefined leaves the seat to this check. An adapter that takes no provider block may name
|
|
204
|
+
// its own refusal (`noProviderRefusal`), so the person sees why in that harness's terms (F116).
|
|
204
205
|
export const providerRefusal = (environment, adapter) => {
|
|
205
206
|
if (environment?.provider === undefined) return null;
|
|
206
|
-
if (!adapter?.supportsProvider)
|
|
207
|
+
if (!adapter?.supportsProvider) {
|
|
208
|
+
return adapter?.noProviderRefusal || 'environment.provider requires a provider-capable adapter';
|
|
209
|
+
}
|
|
207
210
|
const verdict = adapter.providerVerdict?.(environment);
|
|
208
211
|
if (verdict !== undefined) return verdict;
|
|
209
212
|
const api = environment.provider?.api || 'openai-chat';
|