Table Shapes
Some functions return (or accept) a Lua table with a fixed set of keys, such as the response of
Rest.get. Each such table shape is described once here; function pages link to it.
AgentSessionResult
Section titled “AgentSessionResult”The result of a message sent in a CLI agent session.
Fields
-
successboolean - true when the CLI exited with code 0
-
exitnumber - process exit code
-
textstring - the answer of the agent
-
allstring - the complete CLI output
-
durationnumber - run time in milliseconds
-
sessionIdstring - id of the session, nil until the CLI reports it
-
messagesany[] - the answer messages as a list of strings
AgentTaskResult
Section titled “AgentTaskResult”The result of a one-off task run with a CLI agent library (Codex, Copilot, OpenCode).
Fields
-
successboolean - true when the CLI exited with code 0
-
exitnumber - process exit code
-
textstring - the final answer of the agent
-
allstring - the complete CLI output
-
durationnumber - run time in milliseconds
CouchResponse
Section titled “CouchResponse”The response of a CouchDB request made with Couch. A non-2xx status is not an error: CouchDB reports problems in the body ({"error": "not_found", "reason": "missing"}), so check status yourself.
Fields
-
statusnumber - HTTP status code, for example 200, 201 or 404
-
jsonstring - the response body as pretty-printed JSON text
-
tabletable - the response body decoded into a Lua table (the same data as json)
DashboardTextOptions
Section titled “DashboardTextOptions”A piece of dashboard text and how to show it. Only value is required. Headers ignore size (their size is the second argument of Dashboard.h).
Fields
-
valuestring - the text to show
-
colorstring optional - text color as a CSS color, for example red or #ff8800; default is the page color
-
backgroundstring optional - background color as a CSS color; default is none
-
sizenumber optional - font size in pixels, a number; default is the page font size
Used by
DownloadResponse
Section titled “DownloadResponse”The result of Rest.download: the response metadata, with the body saved to a file. The status is not checked, so a 404 or 500 body is saved too.
Fields
-
statusnumber - HTTP status code, for example 200 or 404
-
filestring - path of the saved file, relative to the project, with forward slashes
-
sizenumber - size of the saved file in bytes
-
bodystring - always an empty string (the body is in the file)
-
responsestring - always an empty string (the body is in the file)
-
headerstable - response headers by name. Each header is present under its original name and under its lower-case name. The value is a string, or a list of strings when the header occurred more than once
-
cookiesRestCookie[] - all cookies in the Rest cookie jar after this response
Used by
FileStat
Section titled “FileStat”Metadata of a file or directory, returned by Fl.stat. For a path that does not exist only path and exists (false) are set.
Fields
-
pathstring - the path relative to the workspace, with forward slashes (the workspace itself is .)
-
existsboolean - whether the path exists
-
namestring optional - the last part of the path
-
typestring optional - file, directory or other (for example a device)
-
isFileboolean optional - true for a regular file
-
isDirectoryboolean optional - true for a directory
-
sizenumber optional - size in bytes (for a directory this is whatever the file system reports, not the size of its content)
-
modifiedAtstring optional - last modification time as an ISO 8601 instant in UTC, for example 2026-01-31T12:30:00.123Z
-
createdAtstring optional - creation time as an ISO 8601 instant in UTC; some file systems report the modification time
-
accessedAtstring optional - last access time as an ISO 8601 instant in UTC
-
parentstring optional - the path of the containing directory relative to the workspace; left out when it lies outside the workspace
Used by
HttpResponse
Section titled “HttpResponse”The response of an HTTP request made with Rest. A non-2xx status is not an error: check status yourself.
Fields
-
statusnumber - HTTP status code, for example 200 or 404
-
bodystring - response body decoded as UTF-8 text, empty when the response has no body
-
responsestring - same value as body (older scripts use this name)
-
headerstable - response headers by name. Each header is present under its original name and under its lower-case name (headers["content-type"]). The value is a string, or a list of strings when the header occurred more than once (such as Set-Cookie)
-
cookiesRestCookie[] - all cookies in the Rest cookie jar after this response, not only those set by this response
MailAttachment
Section titled “MailAttachment”Metadata of an attachment of a mail message. Inline images that are referenced by the HTML body (they have a Content-ID) are not counted as attachments.
Fields
-
filenamestring - attachment file name, decoded; empty when the part has none
-
content_typestring - MIME content type, for example application/pdf; name="invoice.pdf"
-
sizenumber - size in bytes as reported by the server, 0 when unknown
MailboxSettings
Section titled “MailboxSettings”Connection settings for Mail.imap and Mail.pop. Any other key of the table is passed to JavaMail as a property, so you can add for example ["mail.imap.connectiontimeout"] = 10000 or ["mail.imap.ssl.trust"] = "mail.example.com".
Fields
-
hoststring - mail server host name (required; also accepted as mail.imap.host or mail.pop3.host)
-
userstring - user name to log in with (required; also accepted as username)
-
passwordstring - password to log in with (required; use secret())
-
portnumber optional - server port. Defaults: IMAP 993 with SSL and 143 without, POP3 995 with SSL and 110 without
-
sslboolean optional - connect over SSL/TLS from the start. Default: true for IMAP and for ports 993 and 995, false for POP3 and for ports 143 and 110
-
starttlsboolean optional - upgrade a plain connection with STARTTLS; default false
-
folderstring optional - folder to open first; default INBOX (also accepted as mailbox). POP3 only has INBOX
Used by
MailMessage
Section titled “MailMessage”A message read from a mailbox. Text fields that the message does not have are empty strings, never nil. Reading a message does not change it on the server (the mailbox is opened read-only), so seen is not set by reading.
Fields
-
numbernumber - sequence number in the folder (1 is the oldest message); use it with Mailbox.get and Mailbox.downloadAttachments. It can change when messages are added or removed, so do not store it
-
folderstring - name of the folder the message was read from
-
subjectstring - subject line, decoded
-
message_idstring - value of the Message-ID header
-
fromany[] - sender addresses, each as the server gives it: a display name followed by the address in angle brackets, or just the address (alice@example.com)
-
toany[] - recipients in the To header, formatted like from
-
ccany[] - recipients in the Cc header
-
bccany[] - recipients in the Bcc header; normally empty because senders' Bcc headers are not kept
-
reply_toany[] - addresses replies should go to
-
sent_atnumber - Date header as a Unix timestamp in milliseconds, 0 when missing
-
sent_at_isostring - Date header as an ISO 8601 UTC time such as 2025-03-01T08:30:00Z, empty when missing
-
received_atnumber - time the server received the message, in Unix milliseconds, 0 when unknown
-
received_at_isostring - time the server received the message as ISO 8601 UTC, empty when unknown
-
sizenumber - message size in bytes as reported by the server, 0 when unknown
-
content_typestring - MIME type of the whole message, for example multipart/mixed; boundary=...
-
bodystring - the plain text of the message; when it has no plain text part, the HTML source of the HTML part (not converted to text)
-
textstring - all text/plain parts joined, empty when there is none
-
htmlstring - all text/html parts joined, empty when there is none
-
attachmentsMailAttachment[] - metadata of the attachments (use Mailbox.downloadAttachments to save the files)
-
has_attachmentsboolean - true when attachments is not empty
-
seenboolean - the message has been read (always false on POP3, which has no flags)
-
answeredboolean - the message has been answered
-
deletedboolean - the message is marked as deleted
-
draftboolean - the message is a draft
-
flaggedboolean - the message is flagged
-
recentboolean - the message arrived since the last session (IMAP only)
MailSearch
Section titled “MailSearch”Search criteria for Mailbox.search and Mailbox.poll. Every key is optional and all given criteria must match. Text criteria are "contains" matches, ignoring case; they are not regular expressions. The search runs in the agent on messages it has downloaded, not on the server.
Fields
-
querystring optional - text that must appear in the subject, sender, To recipients, body or Message-ID
-
subjectstring optional - text that must appear in the subject
-
fromstring optional - text that must appear in the sender, including the display name (searching for alice finds a sender with the display name Alice Smith)
-
tostring optional - text that must appear in the To recipients (Cc and Bcc are not searched)
-
bodystring optional - text that must appear in the body (the plain text, or the HTML source when there is no plain text)
-
messageIdstring optional - text that must appear in the Message-ID header (also accepted as message_id)
-
seenboolean optional - true for only read messages, false for only unread ones (always unread on POP3)
-
unseenboolean optional - the opposite of seen; ignored when seen is given
-
hasAttachmentsboolean optional - true for only messages with attachments, false for only messages without (also accepted as has_attachments)
-
sincestring optional - only messages received on or after this moment. A date or date-time string (2025-03-01, 2025-03-01T08:00:00, 2025-03-01T08:00:00Z; without zone the agent's time zone applies) or a Unix timestamp in seconds or milliseconds. Messages without a received date never match
-
beforestring optional - only messages received before this moment, same formats as since
-
limitnumber optional - return at most this many messages; 0 or left out means no limit. Results are newest first
Used by
RestCookie
Section titled “RestCookie”A cookie stored in the Rest session.
Fields
-
namestring - cookie name
-
valuestring - cookie value
-
domainstring - domain the cookie applies to
-
pathstring - path the cookie applies to
-
secureboolean - only sent over HTTPS
-
httpOnlyboolean - not readable by page scripts
-
persistentboolean - the cookie has an expiry date
-
expirystring - expiry date in ISO 8601, nil for session cookies
Used by
SharepointItem
Section titled “SharepointItem”A file or folder in a SharePoint document library.
Fields
-
namestring - file or folder name
-
pathstring - path relative to the library root; pass it to download, move or delete
-
folderboolean - true for a folder, false for a file
-
sizenumber - size in bytes
-
webUrlstring - browser URL of the item
-
lastModifiedstring - last modified date in ISO 8601
Used by
SmtpSettings
Section titled “SmtpSettings”SMTP settings for Mail.properties. Besides the short keys below, every other key of the table is handed to JavaMail as a property, so any mail.smtp.* property works, written as a quoted key (for example ["mail.smtp.connectiontimeout"] = 10000 or ["mail.smtp.ssl.trust"] = "smtp.example.com"). The short keys host, port, auth, starttls and ssl are aliases for mail.smtp.host, mail.smtp.port, mail.smtp.auth, mail.smtp.starttls.enable and mail.smtp.ssl.enable; when both forms are present the mail.smtp.* key wins. Timeouts (["mail.smtp.connectiontimeout"] and ["mail.smtp.timeout"], in milliseconds) default to waiting forever. Values may be strings, numbers or booleans; they are converted to strings.
Fields
-
hoststring optional - SMTP server host name (alias for mail.smtp.host). Without it JavaMail tries localhost
-
portnumber optional - server port (alias for mail.smtp.port); JavaMail's default is 25
-
authboolean optional - log in with user and password (alias for mail.smtp.auth). Without it no login is attempted
-
starttlsboolean optional - upgrade the connection with STARTTLS, usually port 587 (alias for mail.smtp.starttls.enable)
-
sslboolean optional - encrypt from the start, usually port 465 (alias for mail.smtp.ssl.enable)
-
userstring - user name to log in with, also used as the sender address of every mail, so it should be a full address such as bot@example.com (also accepted as username or mail.smtp.user)
-
passwordstring - password to log in with (also accepted as mail.smtp.password); use secret()
Used by
SshResult
Section titled “SshResult”The outcome of a command run with session.run. A non-zero exit code is not an error: check exitCode yourself.
Fields
-
exitCodenumber - exit code of the command; 0 means success, -1 when the server did not report one
-
stdoutstring - everything the command wrote to standard output
-
stderrstring - everything the command wrote to standard error
Used by
TelegramCallback
Section titled “TelegramCallback”A press on an inline keyboard button.
Fields
-
idstring - callback query id (pass it to TelegramBot.ack)
-
datastring - the callback_data of the pressed button
-
fromTelegramUser - the user who pressed the button
-
messageTelegramMessage - the message the button belongs to
TelegramMessage
Section titled “TelegramMessage”A message that was sent to or received from a Telegram chat.
Fields
-
message_idnumber - Telegram message id
-
chat_idnumber - id of the chat the message belongs to
-
textstring - message text
-
datenumber - unix timestamp (seconds) when the message was sent
TelegramReply
Section titled “TelegramReply”A text reply received in the chat.
Fields
-
message_idnumber - Telegram message id
-
chat_idnumber - id of the chat the reply was sent in
-
textstring - reply text
-
fromTelegramUser - the sender, when known
Used by
TelegramUpdate
Section titled “TelegramUpdate”One update from the Telegram bot API.
Fields
-
update_idnumber - update id
-
messageTelegramMessage - the new message, when the update is a message
-
callback_queryTelegramCallback - the button press, when the update is a callback
Used by
TelegramUser
Section titled “TelegramUser”A Telegram user or bot.
Fields
-
idnumber - Telegram user id
-
usernamestring - user name without the @
-
first_namestring - first name (only present in the bot info returned by TelegramBot.me)
Used by