@commonlyai/cli 0.1.238 → 0.1.240

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/README.md CHANGED
@@ -16,7 +16,7 @@ npm link # optional — makes `commonly` available globally
16
16
  commonly --help
17
17
  ```
18
18
 
19
- Requires Node 20+. No build step.
19
+ Requires Node 22+. No build step.
20
20
 
21
21
  ## Test
22
22
 
@@ -5,6 +5,10 @@ Reads its runtime token from .commonly-env (or COMMONLY_TOKEN) and echoes
5
5
  chat events back into the pod. Replace `handle_event()` with your logic.
6
6
  """
7
7
 
8
+ # PEP 604 unions (`str | None`) need 3.10+ at runtime; this keeps the bot
9
+ # importable on macOS's stock /usr/bin/python3 (3.9).
10
+ from __future__ import annotations
11
+
8
12
  import os
9
13
  import sys
10
14
  from pathlib import Path
@@ -37,7 +41,12 @@ def handle_event(evt: dict) -> str | None:
37
41
  if evt.get("type") not in CHAT_EVENT_TYPES:
38
42
  return None
39
43
  payload = evt.get("payload") or {}
40
- incoming = payload.get("content") or payload.get("prompt") or payload.get("text")
44
+ # rawContent is the message exactly as its author typed it. content is what
45
+ # a model should read: the kernel's context frames, a blank line, then the
46
+ # message. Older servers send only content/prompt/text.
47
+ incoming = payload.get("rawContent")
48
+ if incoming is None:
49
+ incoming = payload.get("content") or payload.get("prompt") or payload.get("text")
41
50
  if not incoming:
42
51
  return None
43
52
  return f"echo: {incoming}"
@@ -9,7 +9,7 @@ Usage (high-level):
9
9
  from commonly import Commonly
10
10
 
11
11
  bot = Commonly(base_url="https://api.commonly.me", runtime_token="cm_agent_…")
12
- bot.run(lambda evt: f"echo: {evt['payload'].get('content', '')}")
12
+ bot.run(lambda evt: f"echo: {evt['payload'].get('rawContent', evt['payload'].get('content', ''))}")
13
13
 
14
14
  Usage (manual loop):
15
15
 
@@ -14,7 +14,7 @@
14
14
  "README.md"
15
15
  ],
16
16
  "engines": {
17
- "node": ">=20.0.0"
17
+ "node": ">=22.0.0"
18
18
  },
19
19
  "scripts": {
20
20
  "test": "node --test $([ -z \"$CI\" ] && echo --test-concurrency=4) \"test/**/*.test.js\""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.238",
3
+ "version": "0.1.240",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -48,7 +48,7 @@
48
48
  "jest": "^29.7.0"
49
49
  },
50
50
  "engines": {
51
- "node": ">=20.0.0"
51
+ "node": ">=22.0.0"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"