@commonlyai/cli 0.1.202 → 0.1.203

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.
@@ -200,7 +200,8 @@ class Commonly:
200
200
  if consecutive_auth_errors >= max_auth_errors:
201
201
  print(
202
202
  f"[commonly] runtime token rejected {consecutive_auth_errors}x in a row — exiting. "
203
- "The token is likely revoked; re-issue or uninstall the agent.",
203
+ "Check COMMONLY_TOKEN: it must hold the bare cm_agent_... value, not the "
204
+ "KEY=VALUE line from .commonly-env. If it is right, re-issue the token or uninstall the agent.",
204
205
  flush=True,
205
206
  )
206
207
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.202",
3
+ "version": "0.1.203",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -3354,7 +3354,11 @@ const SDK_SOURCES = {
3354
3354
  botSrc: () => sdkAsset('python/bot.py', join('hello-world-python', 'bot.py')),
3355
3355
  sdkOut: 'commonly.py',
3356
3356
  botOut: (name) => `${name}.py`,
3357
- runHint: (name) => `COMMONLY_TOKEN=$(cat .commonly-env) python3 ${name}.py`,
3357
+ // .commonly-env is already KEY=VALUE. Sourcing it under `set -a` exports
3358
+ // the key as written and keeps the token out of argv (`env $(cat …)` would
3359
+ // put it on the command line). `COMMONLY_TOKEN=$(cat …)` would set the
3360
+ // variable to the literal `COMMONLY_TOKEN=cm_agent_…` and the bot would 401.
3361
+ runHint: (name) => `(set -a; . ./.commonly-env; exec python3 ${name}.py)`,
3358
3362
  },
3359
3363
  };
3360
3364
 
@@ -3409,6 +3413,9 @@ export const performInit = async ({
3409
3413
  });
3410
3414
  const installation = installResult.installation || installResult;
3411
3415
  const instanceId = installation.instanceId || 'default';
3416
+ // Same rule as `attach`: the mention handle is the instanceId when there is
3417
+ // one, otherwise the registry agentName.
3418
+ const mentionHandle = instanceId !== 'default' ? instanceId : (installation.agentName || agentName);
3412
3419
 
3413
3420
  let runtimeToken = installResult.runtimeToken;
3414
3421
  if (!runtimeToken) {
@@ -3434,6 +3441,7 @@ export const performInit = async ({
3434
3441
  return {
3435
3442
  installation,
3436
3443
  instanceId,
3444
+ mentionHandle,
3437
3445
  runtimeToken,
3438
3446
  files: {
3439
3447
  sdk: sdkOutPath,
@@ -4171,6 +4179,7 @@ Docs:
4171
4179
  console.log('\nNext:');
4172
4180
  console.log(` 1. Edit ${opts.name}.py to handle events.`);
4173
4181
  console.log(` 2. Run: ${result.runHint}`);
4182
+ console.log(` 3. In pod ${opts.pod}, @mention ${result.mentionHandle} to talk to it.`);
4174
4183
  } catch (err) {
4175
4184
  console.error(`Init failed: ${err.message}`);
4176
4185
  process.exit(1);