Repository navigation
The Agents pages are Harbor's (0.20.0) - #25
Merged
Merged
Conversation
…, an agent's page, form and avatar Harbor::AgentsController serves /factory/agents with its Task routing and Shared context tabs, an agent's page, the form that creates and edits one, its avatar and PATCH /factory/agents/context; Harbor::TaskAssignmentsController gives a task type to an agent. The menu's Agents entry is the engine's own route. A site with no code of its own gets all of it: identity, avatar upload and removal, model alias, workspace, limits, the system prompt, documents as rows (harbor--nested-fields), tools, default tasks and configuration as JSON, routing over the declared task types, and what every agent is told. The agents and routing tables are cards on a phone. A host adds to the pages with partials in its own app/views/harbor/agents/, rendered when they exist: _agent_columns_head and _agent_columns (its own columns in the agents table, in two places), _routing_columns_head and _routing_columns, _show_facts and _form_extras. What is code is config: agent_params names the host's attributes the form may save, agent_edited is called when an agent is saved from the form and at no other time, and task_assignment_class names the host's subclass, whose compatible_agents decides who a task type is offered to and whose refusal words the alert for anyone else. harbor_agent_avatar draws an agent in any view: its image, or its initial. An agent saved from the form needs a model alias. 0.20.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Agents pages move into Harbor, the same way the Runs pages did in 0.19.0.
What a site gets
Harbor::AgentsController, underHarbor.path:GET /factory/agentswith three tabs: the agents, Task routing (?tab=routing) and Shared context (?tab=context)GET /factory/agents/:id,new,POST,edit,PATCH: an agent's page and its form (identity, avatar upload and removal, model alias, workspace, limits, enabled, system prompt, documents as rows onharbor--nested-fields, and tools, default task types and configuration as JSON)GET /factory/agents/:id/avatar: the stored image, private, with an ETag. Not gated by the page switch, because other pages show avatarsPATCH /factory/agents/context: the house context, or a shared document by keyHarbor::TaskAssignmentsController:PATCH /factory/task_assignments/:task_typegives a declared task type to an agentscope: :harbor)harbor_agent_avatar(agent, size:)in every view: an agent's image, or its initiallgWhere a host plugs in
Partials in the host's
app/views/harbor/agents/, rendered when they exist:_agent_columns_headslot(:firstafter Agent,:lastbefore Updated)_agent_columnsagent,slot_routing_columns_head_routing_columnstask_type,assignment_show_factsagent_form_extrasform,agentConfig:
config.agent_params: attributes of the host's agent class the form may save. Assigned before Harbor's own fields, so the form's field wins where both set the same thingconfig.agent_edited: called with (agent, current user) when an agent is saved from the form, before it is checked and saved; never for a save made any other wayconfig.task_assignment_class(Harbor.task_assignment_class): the host's subclass ofHarbor::TaskAssignment.compatible_agents(task_type)decides who the routing tab offers and accepts; the newrefusal(task_type, agent_key)words the alert for anyone elseAlso
Harbor::AgentSetting.editable_key?(key): the keys the Shared context tab may writeharbor_current_usermoved from the Runs controller toHarbor::ApplicationControllerTests
test/agents_pages_test.rb(47 tests): each page and tab, creating and editing with every validation, the JSON fields (bad JSON keeps what was typed), documents added, edited and removed, the avatar (upload, serving, caching, 404, removal), routing (assign, refuse, unknown task type, a host's class), shared context (house context, a shared document, refused keys), each host partial present and absent, extra permitted params, the save hook, the page switch, the login, and the menu marking Agents on an agent's page and on the routing tab.Full suite: 600 runs, 0 failures. Rubocop clean.
Not tagged or released.