3.2 KiB
1C Agent Coding Contract
This contract is the default rule set for coding agents that work through the 1C adapter.
Default View
- Read current code and metadata from the working saved-state layer by default.
- For REST calls, use
state=working. - For MCP calls, use
source_state=working. - Treat saved-state objects as current programming state even when they are not activated yet.
- Objects can exist only in saved-state and can later be activated or canceled. Do not hide them from the agent view.
Compare Views
- Use
state=bothorsource_state=allonly when the task needs a comparison with activated runtime state. - Show the effective working text first.
- Mark comparison details explicitly:
saved_state: saved and not activated;active: activated runtime state;text_source: which layer produced the returned text;comparison.differs: whether both layers exist and differ.
Read Workflow
Use public names and selectors:
extension.objects.findwithstate=workingto find extension objects.code.searchwithstate=workingto find routines or fragments.code.readwithstate=workingto read the module or routine.code.readwithstate=bothonly for an explicit saved-vs-active check.
Agents should ask for and report object names, routine names, and code text. They should not ask users for SQL tables, storage file names, stream indexes, or saved-state write flags during normal coding work.
Write Workflow
All normal BSL writes go through code.write.
Supported public edit shapes:
- replace a whole module with
module_text,full_text, orcode; - replace one procedure or function with
routine_nameandroutine_text; - replace one unique fragment with
oldandnew; whenroutine_nameis supplied, the adapter scopes the replacement to that routine.
code.write saves into saved-state automatically. A coding agent should simply
say "save this code" and send the desired code text. It must not ask whether SQL
saved-state apply flags are allowed.
Every successful code.write response must show:
write_mode.target=saved_state;write_mode.activation_state=not_activated;write_mode.production_apply=false.
Hidden Storage Details
The form module container marker ///---- is adapter-owned storage syntax.
Public code.read and code.search responses must not expose it as BSL.
Full-module writes must preserve the marker internally when the saved form
payload requires it.
Low-level methods such as metadata.module.write_apply, metadata.write, SQL
tables, stream refs, and saved-state apply flags are diagnostic tools. They are
not the default programming interface for agents.
Agent Response Shape
When reporting a working saved-state result to a user, prefer concise wording:
В working/save вижу формы:
t_Форма
tt_Форма3
ФормаЭлемента
Код читается из saved_state, еще не активирован.
If the user asks to compare active and saved state:
Working/save: найдено, источник saved_state, не активировано.
Active: не найдено.
Эффективный код для программирования сейчас берется из saved_state.