Commit Graph

148 Commits

Author SHA1 Message Date
huanghuoguoguo 03ad58ec4d merge: resolve conflicts with master, add inbound attachment materialization
- Delete localagent.py and test_difysvapi_runner.py (replaced by plugins)
- Keep master's tool loader enhancements (byte_offset, encoding params)
- Remove feature branch's artifact reference code (use sandbox paths instead)
- Add _materialize_inbound_attachments in orchestrator for sandbox file staging
- Keep master's test formatting and new tests
- Keep master's frontend refactoring
2026-06-19 10:51:00 +08:00
huanghuoguoguo 79a5fba06b refactor(agent-runner): use sandbox file model 2026-06-19 10:24:49 +08:00
huanghuoguoguo a020ca680f Harden agent runner tool runtimes (#2247)
* fix(tools): harden agent runner tool runtimes

* fix(tools): bootstrap Python workspaces with available interpreter

* fix(tools): clear stale Python workspace env locks

* fix(tools): decouple runtime from agent runner

* test(tools): cover runtime hardening edge cases

* fix(tools): support binary workspace file chunks
2026-06-18 14:06:04 +00:00
huanghuoguoguo 5fe63ce822 Bound Space model sync startup wait (#2248)
* fix(modelmgr): bound Space model sync startup wait

* style(provider): format model manager
2026-06-18 22:00:33 +08:00
Junyan Chin 6b15a732e4 fix(box): purge leftover inbox/outbox on startup; clear root-owned outbox via exec (#2259)
The agent attachment outbox is written by the sandbox container as root over
the bind-mount, so the LangBot host process (non-root) cannot rmtree those
files — the host-side delete failed silently and stale files were re-collected
on a later turn that reused the same query_id (the query_id counter resets to 0
on every restart).

- BoxService.initialize now purges leftover inbox/outbox after the runtime is
  available: host rmtree first, then an in-sandbox 'rm -rf' via exec for any
  root-owned survivors.
- _clear_outbox now falls back to exec when the host delete leaves root-owned
  files behind, instead of silently failing.
- collect_outbound_attachments clears the outbox unconditionally (even on an
  empty collection) so a reused query_id never inherits stale files.
- Tests: startup purge (host-owned + root-owned exec fallback + no-workspace
  noop) and empty-collection-still-clears.
2026-06-18 21:59:48 +08:00
Junyan Chin a1e6eccdeb feat(box): bidirectional attachment transfer for sandbox (#2257)
* feat(box): bidirectional attachment transfer for sandbox

Materialize inbound attachments into the sandbox workspace so agents can
process user-sent files, and collect agent-produced files from the outbox
to attach them back to the reply.

- box(service): add materialize_inbound_attachments / collect_outbound
  attachments. Prefer direct host-filesystem read/write on the bind-mounted
  workspace (no size limit), falling back to chunked exec only for
  non-shared backends (e2b/remote). Clear per-query inbox/outbox dirs at
  turn start to avoid query_id-reuse collisions.
- provider(localagent): inject inbound attachment descriptors into the
  sandbox and append a system note telling the agent the inbox/outbox paths.
- pipeline(wrapper): collect outbox files on the final stream chunk and
  append them as attachment components to the response chain.
- web(debug-dialog): render File components with a download link when
  base64/url is present; add base64/path fields to the File entity.
- tests: cover inbound/outbound, large-file transfer without truncation,
  and stale-dir clearing (86 passing).

* feat(box): support voice/file attachment round-trip end-to-end

Extends the bidirectional attachment transfer to audio and arbitrary files
through the real webchat UI, and fixes the model-payload errors that
non-image attachments triggered.

- platform(websocket_adapter): resolve Voice/File component storage keys to
  base64 (previously only Image), so audio/documents reach the sandbox inbox.
- web(debug-dialog): accept audio/* and any file in the uploader (was
  image-only), classify by mimetype, upload Voice/File via the documents
  endpoint, and render non-image staged attachments as a chip.
- provider(litellmchat): drop non-image file parts (file_base64 / file_url)
  when building the OpenAI/LiteLLM payload. These come from Voice/File
  attachments — including ones replayed from conversation history — and the
  agent reads their bytes from the sandbox, not the model. Without this the
  provider rejects the request: 'invalid content type=file_base64'.
- provider(localagent): also strip those parts from the current user message
  alongside the sandbox-path note (model-facing clarity; the requester is the
  real safety net for history).
- tests: cover the requester strip/keep behavior (file dropped, image kept and
  reshaped to image_url, mixed history, plain-string content).

* test(box): cover inbound/outbound attachment helpers; fix ruff format

- ruff format localagent.py (CI ruff format --check was failing)
- add unit tests for ResponseWrapper outbound-attachment helpers (wrapper.py 78%->98%)
- add unit tests for LocalAgentRunner._inject_inbound_attachments
- add unit tests for WebSocketAdapter._process_image_components (0%->covered)

Lifts PR patch coverage from 68.97% to ~88% (>75% target).
2026-06-18 21:40:31 +08:00
huanghuoguoguo 2c09af406e feat(agent-runner): expose stats for control plane 2026-06-16 23:29:04 +08:00
huanghuoguoguo f390980d0a test: format test suite (#2252) 2026-06-16 11:22:29 +08:00
huanghuoguoguo 1ae5aacc00 test: add frontend smoke and backend e2e CI (#2251) 2026-06-16 11:09:55 +08:00
huanghuoguoguo e9dd7f423d feat(agent-runner): add admin reconcile primitives 2026-06-15 19:42:33 +08:00
huanghuoguoguo aa4fdd1144 feat(agent-runner): add host admin permissions 2026-06-15 18:55:11 +08:00
huanghuoguoguo 9aa643b55f feat(agent-runner): add host run ledger primitives 2026-06-15 18:09:05 +08:00
huanghuoguoguo 759f427110 chore(agent-runner): align split runtime files with base 2026-06-14 21:26:21 +08:00
huanghuoguoguo 4205858957 chore(agent-runner): merge split tool runtime base
# Conflicts:
#	src/langbot/pkg/box/workspace.py
#	src/langbot/pkg/provider/tools/loaders/mcp_stdio.py
#	src/langbot/pkg/provider/tools/loaders/native.py
#	src/langbot/pkg/provider/tools/loaders/skill.py
#	tests/unit_tests/box/test_workspace.py
#	tests/unit_tests/provider/test_mcp_box_integration.py
2026-06-14 21:22:05 +08:00
huanghuoguoguo 0a71747eec chore(agent-runner): remove split-out incidental fixes 2026-06-14 21:20:31 +08:00
huanghuoguoguo 9fa3251f3d fix(tools): decouple runtime from agent runner 2026-06-14 21:15:21 +08:00
huanghuoguoguo 7b67dcc302 fix(tools): bootstrap Python workspaces with available interpreter 2026-06-14 11:32:10 +08:00
huanghuoguoguo a60827f221 fix(tools): harden agent runner tool runtimes 2026-06-14 11:32:10 +08:00
huanghuoguoguo e9fe2f2d43 feat(agent-runner): support host tool lookup (#2244) 2026-06-14 11:29:57 +08:00
huanghuoguoguo 5b9e541998 chore(agent-runner): stack on latest tool runtime fixes 2026-06-14 11:23:41 +08:00
huanghuoguoguo 4013f2ffd1 fix(tools): bootstrap Python workspaces with available interpreter 2026-06-14 11:23:09 +08:00
huanghuoguoguo a26f3c2afd chore(agent-runner): drop tool fix residuals from feature branch 2026-06-14 11:20:22 +08:00
huanghuoguoguo 2da174361f chore(agent-runner): stack on tool runtime fixes
# Conflicts:
#	src/langbot/pkg/provider/tools/loaders/mcp_stdio.py
#	tests/unit_tests/provider/test_mcp_box_integration.py
2026-06-14 11:19:12 +08:00
huanghuoguoguo cff9ac5683 chore(agent-runner): split litellm usage details 2026-06-14 11:16:17 +08:00
huanghuoguoguo 27be09ab15 fix(provider): preserve litellm usage details (#2246) 2026-06-14 11:12:29 +08:00
huanghuoguoguo 2f90e3c59b fix(tools): harden agent runner tool runtimes 2026-06-14 11:07:46 +08:00
huanghuoguoguo ee24398d80 feat(agent-runner): support host tool lookup 2026-06-14 11:04:52 +08:00
huanghuoguoguo 09adf4c541 Propagate agent runner model usage context 2026-06-14 07:41:57 +08:00
RockChinQ b7d8332cb0 feat(telemetry): include instance_create_ts in heartbeat payload
Load the instance creation timestamp from data/labels/instance_id.json
(backfilling+persisting it for instances created before the field existed),
expose it as constants.instance_create_ts, and include it in the heartbeat
payload so Space can anchor Time-To-Value / onboarding analytics on real
install time rather than first-heartbeat.

Verified: py_compile, ruff, pytest tests/unit_tests/telemetry/ (37 passed).
2026-06-13 11:13:18 -04:00
huanghuoguoguo 7fe3eedeea fix(provider): use LiteLLM input window for context length (#2243) 2026-06-13 21:27:47 +08:00
huanghuoguoguo 1153433693 fix(agent-runner): harden run lifecycle and protocol stores 2026-06-13 21:22:13 +08:00
huanghuoguoguo 735a0011b0 fix(agent-runner): reconcile master rebase 2026-06-13 17:52:25 +08:00
huanghuoguoguo 313798bf0a fix(plugin): preserve marketplace package metadata 2026-06-13 17:48:26 +08:00
huanghuoguoguo d0b0a682c7 feat(agent-runner): expose effective prompt pull api 2026-06-13 17:48:26 +08:00
huanghuoguoguo 3984e0fe40 fix(persistence): repair missing mcp readme column 2026-06-13 17:48:26 +08:00
huanghuoguoguo c4fa39f684 refactor(agent-runner): migrate deerflow and weknora to plugins 2026-06-13 17:47:48 +08:00
huanghuoguoguo e7779bd16f fix: harden agent runner runtime boundaries 2026-06-13 17:47:48 +08:00
huanghuoguoguo 2094993afb Fix agent runner host migration and runtime guards
Migrates legacy runner blocks into plugin runner configs, preserves run-scoped history boundaries, enforces operation/file authorization, and sanitizes inline attachment persistence. Also fixes plugin runner form dirty handling and adds regression coverage.
2026-06-13 17:46:50 +08:00
huanghuoguoguo c9ef788072 Fix agent runner steering and lifecycle hardening 2026-06-13 17:46:50 +08:00
huanghuoguoguo 9cf99815ba feat(agent-runner): audit steering injection 2026-06-13 17:46:50 +08:00
huanghuoguoguo c10ce6cc2e chore: commit workspace changes 2026-06-13 17:46:50 +08:00
huanghuoguoguo 86ec12a391 feat(agent-runner): enforce typed host permissions 2026-06-13 17:46:50 +08:00
huanghuoguoguo 4e016ad23e fix(agent-runner): harden state and event APIs 2026-06-13 17:46:31 +08:00
huanghuoguoguo 5831198f38 refactor(agent-runner): remove protocol_version from various components and update related documentation 2026-06-13 17:46:31 +08:00
huanghuoguoguo 7675f565ff test(agent): harden runner persistence coverage 2026-06-13 17:46:31 +08:00
huanghuoguoguo 54bba1a1f5 feat(agent-runner): expose skill resources through host context 2026-06-13 17:45:53 +08:00
huanghuoguoguo a6a90f7d1b test: cover host skill tool scoping 2026-06-13 17:45:53 +08:00
huanghuoguoguo 4a8c1a76d7 refactor(agent-runner): use protocol version field 2026-06-13 17:45:53 +08:00
huanghuoguoguo 2de6d15d07 refactor(provider): formalize tool lookup contract 2026-06-13 17:45:53 +08:00
huanghuoguoguo f1a44ea8a8 refactor agent runner orchestration boundaries 2026-06-13 17:45:53 +08:00