Add an optional 'data' field ({name, content}) to the create_file agent tool
so agents can create files without a local file (e.g. when bash is not
available). The existing 'path' upload mode is preserved; exactly one of
'path' or 'data' must be provided.
Extract mime detection helpers (getFileMimeType, readFileMimeType) into a
new file-mime module, keeping utils/mime.ts free of fs/path imports so it
stays compatible with the Temporal workflow bundle (agent-autofill imports
getProxyType from it). Refactor create_version to reuse the extracted
helpers.
Content uploads reuse s3Service.putObject; mime type is derived from the
filename extension with a text/plain fallback, and the name is sanitized
for the S3 key.
Two bugs found while testing skill loading as a non-owner:
1. The injected bash tool was never actually usable: AgentHarness.setTools
only updates the tool registry unless activeToolNames is passed, so bash
was missing from the active tool set sent to the model on the next turn.
Pass the full post-update tool list as activeToolNames.
2. The active_tools_change session entry (written by setTools) has no chat
representation, so mapEntryToMessage fell back to fabricating an empty
user message that appeared as a stray empty bubble in the chat stream.
Render active_tools_change as a typed custom message and skip entry
types that have no chat representation instead of emitting empty text.
Add comprehensive test coverage for 5 core service methods that were
added in the layered architecture refactor but lacked tests:
- AgentService.getAgent: found/not-found cases
- ProjectService.getUserProjects: team scope, project scope,
multi-team aggregation, limit, and empty result cases
- SkillService.getSkill: full field mapping and not-found cases
- TeamService.hasWritableRoleInAnyTeam: owner, editor, reviewer,
and no-membership cases
- UserService (new file): getUserById and createGuestUser