@melaya/runner 1.1.20 → 1.1.22

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.
@@ -239,9 +239,16 @@ if not isinstance(sys.stdout, _RedactingStdout):
239
239
  sys.stdout = _RedactingStdout(sys.stdout)
240
240
 
241
241
 
242
- _HITL_MODES = ("safe", "autonomous", "payments_only")
243
-
244
- # ── Melaya Browser: per-turn target grant (plan 0.4) ─────────────────────────
242
+ _HITL_MODES = ("safe", "autonomous", "payments_only")
243
+ _TELEMETRY_SURFACES = ("assistant", "browser_control", "extension", "device_control")
244
+
245
+
246
+ def _apply_telemetry_surface(surface: str | None) -> None:
247
+ """Stamp the current turn without changing any runtime capability gates."""
248
+ value = str(surface or "").strip().lower()
249
+ os.environ["MEL_ASSISTANT_TELEMETRY_SURFACE"] = value if value in _TELEMETRY_SURFACES else "assistant"
250
+
251
+ # ── Melaya Browser: per-turn target grant (plan 0.4) ─────────────────────────
245
252
  # The signed grant is delivered PER TURN on the turn frame ({"browser_grant":
246
253
  # "<compact JWS>", "browser_target_ref": "..."}) and exposed to the browser
247
254
  # toolkit ONLY through these env vars for the duration of ONE turn. It is
@@ -1004,9 +1011,13 @@ def main() -> int:
1004
1011
  # turn. Absent ⇒ keep the current (spawn / previous-turn) mode. The
1005
1012
  # connector gate + phone tools read the env at call-time, so setting
1006
1013
  # it here (before _run_turn) is enough — no agent rebuild needed.
1007
- if "hitl_mode" in req:
1008
- _apply_hitl_mode(req.get("hitl_mode"))
1009
- # Per-turn STATIC CONTEXT: fold the conversation's persona / standing
1014
+ if "hitl_mode" in req:
1015
+ _apply_hitl_mode(req.get("hitl_mode"))
1016
+ # Product usage attribution is per turn. This must be applied before the
1017
+ # AgentScope spans are created; _emit_usage force-flushes them before the
1018
+ # next turn can replace the value.
1019
+ _apply_telemetry_surface(req.get("telemetry_surface"))
1020
+ # Per-turn STATIC CONTEXT: fold the conversation's persona / standing
1010
1021
  # instructions into the system prompt before running the turn (parity with
1011
1022
  # the cloud path; handles set / edit / clear mid-conversation).
1012
1023
  _apply_static_context(agent, base_sys_prompt, req.get("static_context"))
@@ -1293,6 +1293,9 @@ export async function connect(opts) {
1293
1293
  MEL_ASSISTANT_MODEL: String(payload.model || ""),
1294
1294
  MEL_ASSISTANT_LANGUAGE: String(payload.language || "en"),
1295
1295
  MEL_ASSISTANT_SURFACE: String(payload.surface || ""),
1296
+ // Product attribution is deliberately separate from MEL_ASSISTANT_SURFACE,
1297
+ // which controls runtime capabilities such as mobile-native phone tools.
1298
+ MEL_ASSISTANT_TELEMETRY_SURFACE: String(payload.telemetrySurface || "assistant"),
1296
1299
  // Phone toolkit unlocks when the user has a paired phone, on ANY surface
1297
1300
  // (desktop drives the paired phone remotely). The host ORs this with the
1298
1301
  // mobile-native surface check. Empty ⇒ not paired ⇒ no phone tools.
@@ -1631,6 +1634,7 @@ export async function connect(opts) {
1631
1634
  message: payload.message,
1632
1635
  hitl_mode: hitlMode,
1633
1636
  static_context: typeof payload.staticContext === "string" ? payload.staticContext : "",
1637
+ telemetry_surface: typeof payload.telemetrySurface === "string" ? payload.telemetrySurface : "assistant",
1634
1638
  // Per-turn browser grant: forwarded to the host as the raw compact
1635
1639
  // JWS string so the Python browser toolkit can verify it again
1636
1640
  // (defence-in-depth) and install MEL_BROWSER_TURN_GRANT in the
package/dist/detect.js CHANGED
@@ -12,8 +12,8 @@ const execFileAsync = promisify(execFile);
12
12
  * error, missing cache). The REAL lists are fetched dynamically below so a new
13
13
  * claude/codex release is available on Melaya automatically — no code change,
14
14
  * no redeploy. Kept minimal + in step with the registry `staticModels`. */
15
- const CODEX_MODELS_FALLBACK = ["gpt-5.5", "gpt-5.4", "gpt-5.4-mini"];
16
- const CLAUDE_ALIASES_FALLBACK = ["sonnet", "opus", "haiku"];
15
+ const CODEX_MODELS_FALLBACK = ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini"];
16
+ const CLAUDE_ALIASES_FALLBACK = ["sonnet", "opus", "fable", "haiku"];
17
17
  /** Discover the claude model FAMILIES this subscription serves, so a new
18
18
  * family (a future tier) appears on Melaya automatically. Hits the same
19
19
  * GET /v1/models the runtime resolver uses (model.py::_resolve_claude_model_id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,