@commonlyai/cli 0.1.237 → 0.1.239
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.
|
@@ -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
|
-
|
|
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
|
|
package/package.json
CHANGED
|
@@ -244,9 +244,18 @@ export const withholdGrantBroker = (environment, adapter, {
|
|
|
244
244
|
const reason = confinementReason(environment, adapter, platform);
|
|
245
245
|
if (!reason) return environment;
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
// F94: the server flags a broker whose grant names this seat (the granter's
|
|
248
|
+
// own agent, with consent) so it rides a seat no sandbox confines. Delivery
|
|
249
|
+
// only; the broker checks the naming on every call. Never on native Windows,
|
|
250
|
+
// and never for an adapter not approved for the broker.
|
|
251
|
+
const rides = (server) => server?.byoNamed === true
|
|
252
|
+
&& reason !== 'adapter_cannot_confine' && platform !== 'win32';
|
|
253
|
+
const isWithheld = (server) => isOurGrantBroker(server, { instanceUrl }) && !rides(server);
|
|
254
|
+
if (!environment.mcp.some(isWithheld)) return environment;
|
|
255
|
+
|
|
256
|
+
const kept = environment.mcp.filter((server) => !isWithheld(server));
|
|
248
257
|
const withheld = environment.mcp
|
|
249
|
-
.filter(
|
|
258
|
+
.filter(isWithheld)
|
|
250
259
|
.map((server) => (typeof server?.name === 'string' && server.name ? server.name : '(unnamed)'));
|
|
251
260
|
if (typeof onRefuse === 'function') {
|
|
252
261
|
onRefuse({
|