The entry assistant
The source src/modules/applications/assistant built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
The assistant: a window where the principal asks an agent for help, and reads the conversation: the replies of the agent, each act that it proposes, and the result of each act.
What it is for. The agent runs on the host: modustool assistant reads each request through remote, asks a language model, runs each act of its reply through the host agent bridge, and gives the outcome back. An act that the bridge stops for the principal shows the act dialog of the trusted display; the principal decides it there, never the agent.
Start: the start menu, or start("assistant") in the console. Type a request, then Enter.
Grants, as the root service gives them:
- Serve: its exports, for the agent runner through remote.
- Connect to the role Display, with the boot image: the act dialog. The term asks_acts lets it ask the trusted display for an act dialog, and for nothing else that serves the principal: it acts for nobody.
assistant module with an entry
- Hash
9462cc0150d43c203ea9ca24326dea3c1021d95031d8ba824dcf1d66526dc8c8- Size
281299 bytes- Exports
8- Imports
1- Imported by
0- License
- MIT
The assistant: a window where the principal asks an agent for help, and reads the conversation: the replies of the agent, each act that it proposes, and the result of each act
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/applications/assistant |
| Boot image | yes: in the boot image, 281299 bytes in this build |
| Build settings |
|
| Imports | |
| Imported by | none |
Neighbours
What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.
Exports
| Export | What it does |
|---|---|
request_serial() -> Integer | gives the serial of the oldest request of the principal that no runner took, or 0 when none waits |
request_text(serial: Integer) -> Text | gives the text of a request, and marks it taken: request_serial does not give it again |
reply(serial: Integer, text: Text, acts: Integer) -> Integer | shows the text of the reply of the model to a request that a runner took, with the count of its acts |
reply_refused(serial: Integer, kind: Integer, unit: Integer, argument: Integer, value: Integer, limit: Integer) -> Integer | shows that the runner refused the reply of the model to a request at its border: the words of the error record of that refusal |
act(serial: Integer, kind: Integer, line: Text, service: Text, export: Text) -> Integer | shows an act that the reply of the model to a request proposes, before the bridge answers it, and gives its number |
act_result(act: Integer, state: Integer, text: Text) -> Integer | shows the answer of the bridge to an act: done with its result, refused with why, or waiting for the principal, which shows the act dialog of the trusted display |
act_table(act: Integer, shape: Integer, name: Text, total_rows: Integer, columns: Table(Act_Table_Column, Read), cells: Table(Act_Table_Cell, Read)) -> Integer | gives the typed result of an act that is done, a table or a record, so the window draws it as the console does: a line of heads, aligned columns, the first rows and the count of the others |
act_state(act: Integer) -> Integer | gives the state of an act, a word of assistant.Act_State: the runner reads the decision of the principal on an act that waited |
entry() | The entry of the assistant: it opens its service and its window, then runs the calls of the runner and the events of the window in one loop |
request_serial
request_serial() ->
request_serial gives the serial of the oldest request of the principal that no runner took, or 0 when none waits.
What it is for. The agent runner on the host asks for the next request through remote, then reads its text with request_text.
Grant: the caller must act for the principal; else No_Grant (-1).
- none
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:56
request_text
request_text(serial: ) ->
request_text gives the text of a request, and marks it taken: request_serial does not give it again.
The result is the count of bytes of the text, or a negative number with an error record: No_Grant (-1, the caller does not act for the principal); Absent (-1, no request of the window has this serial); Too_Long (-1, the result has less room than the text: the request is not taken).
serial:
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:66
reply
reply(serial: , text: , acts: ) ->
reply shows the text of the reply of the model to a request that a runner took, with the count of its acts.
- serial: the request.
- text: the reply, at most 1024 bytes.
- acts: the count of the acts of the reply, 0 to 4: the window takes that many acts of the request, and no more.
The result is the count of bytes kept, or a negative number with an error record: No_Grant (-1); Absent (-1, no request has the serial, or it was not taken); State (-1, the request has its reply already); Empty, Too_Long or Bad_Value (-1, the text has no byte, more than 1024 bytes, or a control byte or a damaged character); Bad_Value or Too_Long (-1, a count of acts under 0 or over 4).
serial:text:acts:
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:85
reply_refused
reply_refused(serial: , kind: , unit: , argument: , value: , limit: ) ->
reply_refused shows that the runner refused the reply of the model to a request at its border: the words of the error record of that refusal. No act of that reply runs, and the turn of the request ends.
The result is 1, or a negative number with an error record: No_Grant (-1); Absent (-1, no request taken has the serial); State (-1, the request has its reply already); Bad_Value (-1, a kind or a unit that names no member of the contract, or the kind None).
serial:kind:unit:argument:value:limit:
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:99
act
act(serial: , kind: , line: , service: , export: ) ->
act shows an act that the reply of the model to a request proposes, before the bridge answers it, and gives its number.
- serial: the request.
- kind: the kind of the act, a word of assistant.Act_Kind: 1 a line of Lex.
- line: the line of the act, at most 200 bytes.
- service, export: the names of the one call of the line, which the runner parsed: two identifiers of 31 bytes at most, or two empty texts for a line that is no single call. The act dialog shows them.
The result is the number of the act, from 1, or a negative number with an error record: No_Grant (-1); Absent (-1, no request taken has the serial); State (-1, no reply counted this act: the reply did not come, was refused, or its acts came); Bad_Value (-1, a kind that names no member, or a name that is no identifier); Empty, Too_Long or Bad_Value (-1, the line).
serial:kind:line:service:export:
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:122
act_result
act_result(act: , state: , text: ) ->
act_result shows the answer of the bridge to an act: done with its result, refused with why, or waiting for the principal, which shows the act dialog of the trusted display.
- act: the number that act gave.
- state: a word of assistant.Act_State that the runner may write: 2 done, 3 refused, 4 waiting for the principal.
- text: the result or the refusal, as words for the principal.
The result is 1, or a negative number with an error record: No_Grant (-1); Absent (-1, no act has the number); Bad_Value (-1, a state that names no member, one that the runner may not write, or waiting for an act with no names); State (-1, the act has an outcome already); Empty, Too_Long or Bad_Value (-1, the text).
act:state:text:
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:140
act_table
act_table(act: , shape: , name: , total_rows: , columns: (, Read), cells: (, Read)) ->
act_table gives the typed result of an act that is done, a table or a record, so the window draws it as the console does: a line of heads, aligned columns, the first rows and the count of the others.
- act: the number that act gave; the act is done.
- shape: a word of assistant.Act_Table_Shape: 1 a table, 2 a record of one row.
- name: the name of the record, at most 32 bytes.
- total_rows: the rows of the whole result; the cells hold the first ones.
- columns: a table of
Act_Table_Columnrows, 1 to 24: the name of a column, its kind (a word of agent_bridge.Lex_Column_Kind: 1 text, 2 integer, 3 size, 4 time, 5 hexadecimal) and its unit word. - cells: a table of
Act_Table_Cellrows, row after row, a cell for each column: the text of a text column, the value of a number column; at most 8 rows of the result.
The result is 1, or a negative number with an error record: No_Grant (-1); Absent (-1, no act has the number); State (-1, the act is not done, or has its table); Bad_Value (-1, a shape or a column kind that names no member, a unit that does not fit its kind, a text in a number cell or a value in a text cell, a record of another count of rows than 1, a total under the rows, a count of cells that is no whole count of rows, an empty column name, or a name or a cell that is not UTF-8 with no control byte or that has a byte after its zero); Empty or Too_Long (-1, the name, no column or more than 24, more than 8 rows).
act:shape:name:total_rows:columns: (, Read)cells: (, Read)
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:180
act_state
act_state(act: ) ->
act_state gives the state of an act, a word of assistant.Act_State: the runner reads the decision of the principal on an act that waited.
The result is the state, or a negative number with an error record: No_Grant (-1); Absent (-1, no act has the number).
act:
- When it fails
- a negative result, and the error record
src/modules/applications/assistant/conversation.odin:206
entry
entry()
The entry of the assistant: it opens its service and its window, then runs the calls of the runner and the events of the window in one loop. While an act waits for the principal, the loop also wakes to read the decision of the act dialog.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/applications/assistant/main.odin:202
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | A window and a service: the agent runner on the host calls its exports through remote, and it asks the trusted display for the act dialog with the term asks_acts. It acts for nobody: the grant to act for the principal would open each export of the display that serves the principal. The boot image checks that the holder of Display has the act dialog. See: The assistant: The right to ask an act in the repository | |
| Other terms of its start grant set | callable = {0 = "display"}, asks_acts = true | |
| Budget that it asks for |
| The window, the entries of the conversation (about 940 KiB: each act keeps the cells of its typed result, 14 KiB), the kept lines of three results (about 100 KiB), the two draw tables of the worst frame (about 130 KiB: result_table.odin), the stack, and the glyph memory of a window of paint, which this process draws as: the tool counts the window at the window bound (Module contract, "The budget that a module asks for"). |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
Integer wire form
A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.
Error_Record record of a module
A record of the module assistant: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
Text wire form
A wire form of the module contract: one word of a call. The address of a slice record {address, count} of UTF-8 bytes.
Table wire form
A wire form of the module contract: one word of a call. Records of one description that follow each other (a table).
Act_Table_Column record of a module
A record of the module assistant: 48 bytes, aligned on 8 bytes, 0 bytes of padding.
nameText(32)032 byteskindi64328 bytesuniti64408 bytes
Act_Table_Cell record of a module
A record of the module assistant: 72 bytes, aligned on 8 bytes, 0 bytes of padding.
textText(64)064 bytesintegeri64648 bytes
