Task files
task_files
¶
Separate host instructions from writable task state.
The input directory is mounted read-only, while agent configuration and session pointers remain writable. Initial prompts are published once; the task acknowledges delivery with a separate consumed marker.
CONTAINER_AGENT_INPUTS = '/home/dev/.terok/input'
module-attribute
¶
CONTAINER_AGENT_CONFIG = '/home/dev/.terok'
module-attribute
¶
CONTAINER_AGENT_EVENTS = '/home/dev/.terok/events'
module-attribute
¶
INITIAL_PROMPT_FILENAME = 'initial-prompt.txt'
module-attribute
¶
INITIAL_PROMPT_CONSUMED_FILENAME = 'initial-prompt.consumed'
module-attribute
¶
INPUTS_PROTOCOL_LABEL = 'ai.terok.inputs-protocol'
module-attribute
¶
INPUTS_PROTOCOL = '1'
module-attribute
¶
TASK_INPUT_PROTOCOL = '4'
module-attribute
¶
MAX_PROMPT_BYTES = 120 * 1024
module-attribute
¶
__all__ = ['CONTAINER_AGENT_INPUTS', 'INITIAL_PROMPT_CONSUMED_FILENAME', 'INITIAL_PROMPT_FILENAME', 'MAX_PROMPT_BYTES', 'InputProtocolMismatch', 'agent_config_volumes', 'agent_input_dir', 'agent_event_dir', 'require_task_input_protocol', 'require_image_input_protocol', 'write_initial_prompt']
module-attribute
¶
InputProtocolMismatch
¶
Bases: RuntimeError
A successful runtime inspection proves that task inputs use an obsolete protocol.
agent_input_dir(task_dir)
¶
agent_event_dir(task_dir)
¶
require_task_input_protocol(container, *, inspection=None)
¶
Refuse obsolete task inputs without treating inspection failures as upgrade requests.
Reuse inspection when the caller has already observed the retained
container. Only InputProtocolMismatch
establishes a reason to recreate; unavailable runtime data must abort
without discarding retained state.
Source code in src/terok_executor/task_files.py
require_image_input_protocol(image)
¶
Reject obsolete images before an orchestrator removes a retained task.
Source code in src/terok_executor/task_files.py
agent_config_volumes(agent_config_dir)
¶
Bind task state read-write and host instructions read-only.
The directory mount exposes prompts published after background startup. A file mount would keep the old inode after atomic publication.
Source code in src/terok_executor/task_files.py
write_initial_prompt(task_dir, prompt)
¶
Publish the initial prompt once, allowing an identical repeated submission.
A different prompt requires a new task. No existing file is opened for truncation, including legacy task-created links.