codebee 0.1.2 → 0.1.3

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.
@@ -949,6 +949,13 @@ def set_binding(agent_id, provider_id=None, model=None, models=None,
949
949
  _sync_chain_refs(b)
950
950
  if provider_id is not None:
951
951
  b["provider_id"] = eff_pid # 显式指定主供应商时覆盖链首推导
952
+ # 链首非空时主供应商跟链首走:旧读方/下拉残留的 provider_id
953
+ # 若与链首不一致,会复活成「下拉=停用的旧供应商」(2026-09-16
954
+ # 一键推荐实测)。链首为空(纯 CLI 默认凭据)才保留显式指定。
955
+ head_pid = next((c.get("provider_id") for c in b["chain"]
956
+ if c.get("provider_id")), "")
957
+ if head_pid:
958
+ b["provider_id"] = head_pid
952
959
  elif models is not None:
953
960
  # 有序模型链:第 1 个主模型,其余按序降级
954
961
  clean = _clean_models(models)
@@ -417,7 +417,10 @@ def _finish_step_result(run_id, step, res, role, agent, start):
417
417
  cost_usd=res.get("cost_usd", 0.0),
418
418
  tokens=res.get("tokens", 0),
419
419
  duration_s=time.time() - start,
420
- model=res.get("model"))
420
+ model=res.get("model"),
421
+ # 智能体的最终回答(runner 已从 JSONL 事件流里抽出 agent_message)。
422
+ # 对话视图直读这个;日志文件是全量事件流,塞进气泡就成了「看日志」。
423
+ output=(res.get("text") or ""))
421
424
  if agent.get("mode") != "mock":
422
425
  _record_usage(run_id, role, agent, res, source="pipeline", step=step["n"])
423
426
  # 5F:step 级运行时断言(只告警不阻断)
package/app/core/store.py CHANGED
@@ -1142,7 +1142,7 @@ def add_step(run_id, role, agent_id, agent_label, note=""):
1142
1142
 
1143
1143
 
1144
1144
  def finish_step(run_id, n, status, summary="", exit_code=None,
1145
- cost_usd=0.0, tokens=0.0, duration_s=None, model=None):
1145
+ cost_usd=0.0, tokens=0.0, duration_s=None, model=None, output=None):
1146
1146
  with LOCK:
1147
1147
  run = _RUNS.get(run_id)
1148
1148
  if not run:
@@ -1159,6 +1159,8 @@ def finish_step(run_id, n, status, summary="", exit_code=None,
1159
1159
  s["model"] = str(model)[:80]
1160
1160
  if duration_s is not None:
1161
1161
  s["duration_s"] = round(duration_s, 1)
1162
+ if output is not None:
1163
+ s["output"] = str(output)[:6000]
1162
1164
  break
1163
1165
  run["cost_usd"] = round(run.get("cost_usd", 0.0) + cost_usd, 4)
1164
1166
  run["tokens"] = run.get("tokens", 0) + tokens