Office

Reports

The 4 tools for reports. Before an agent first makes one, it reads guide topic reports.

create_report

Make a report: a document people read and share — a briefing, an explainer, a research write-up, a product spec, a proposal, an investor update, a quarterly or campaign review. It is one HTML page on Artifacts' standard report look: theme.css (added for you; link it with <link rel="stylesheet" href="theme.css">) gives the title and meta line, headline numbers, figures for charts and diagrams, cards, panels, tables and the rest, as a kit you compose freely: any arrangement of pictures, charts, numbers, cards and text the content needs, with your own HTML and CSS (on its tokens) for what the kit lacks. theme picks its fonts and colors. A written report cites what it relies on in the page; a report that shows the space's numbers names them in sources (a sheet range, a database table, or another item) and draws them from window.ARTIFACTS. The page gets window.ARTIFACTS = { read_at, data: { <name>: … }, errors: { <name>: why }, sources: { <name>: { reads, title, url, note } } } before any of its scripts run. A sheet or database source is { kind, from, columns, rows (numbers as numbers), text (as people see them: "$1,234", "12%"), records (each row as an object by column) }; another item is { kind, from, content }. Draw from it in JavaScript (a chart library from a CDN, or your own SVG and tables); never type its numbers into the HTML. Read guide topic "reports" first: it has the classes, with the HTML of each block. Give the head and the first finished part; update_report adds the rest, a section a call. Run it with render_report once it is whole.

Parameters

space_idstringrequired
titlestringrequired
sourcesobject[]
Show child attributes
namestringrequired
What the page calls it: window.ARTIFACTS.data.<name>. Letters, digits and "_", starting with a letter: "revenue", "pipeline_by_stage".
notestring
What it is, for people reading the sources ("USD, closed deals only").
sheetstring
A spreadsheet of the space (its item id), read by range.
rangestring
With sheet: "Revenue!A1:E13" — a header row, then the rows.
databaseobject
A table of a database of the space, read as a sheet range would be.
Show child attributes
itemstringrequired
The database item.
tablestringrequired
fieldsstring[]required
The fields, in order. With group_by, the first is the group and the number fields are totalled.
group_bystring
totalstring
sum, avg, min, max of each number field per group, or count (records per group). Without group_by: one total over all records, given as total and total_text. One of sum, avg, min, max, count.
filtersobject[]
Show child attributes
fieldstringrequired
opstringrequired
One of is, is_not, contains, not_contains, gt, gte, lt, lte, empty, not_empty.
valuestring | number | boolean
sortobject[]
Show child attributes
fieldstringrequired
descboolean
limitinteger
itemstring
Another item of the space, read whole as it is now: dashboard, kanban, calendar, poll, timeline, compare, form, invoice, wiki, database, map, catalog, diagram, stock, weather. A dashboard gives its tiles with their numbers; a Kanban board its columns and cards; a calendar its events; a poll its results; a form its responses.
themestring
Its fonts and colors. Default paper. Guide topic "reports" says what each is for. One of paper, slate, ink, forest, midnight.
htmlstringrequired
index.html: a whole document that links theme.css. Its head and first finished part; update_report adds the rest.
filesobject[]
Files beside it: app.js, JSON, SVG. theme.css is added for you.
Show child attributes
pathstringrequired
Where it goes: "src/app.ts", "README.md" (folders with /).
contentstringrequired
messagestring

read_report

A report as it is now: its files (people's live edits included; numbered: true puts line numbers in front), its version, its sources, and what each source gives the page now — columns and the first rows of a table, or the content of an item. The page gets window.ARTIFACTS = { read_at, data: { <name>: … }, errors: { <name>: why }, sources: { <name>: { reads, title, url, note } } } before any of its scripts run. A sheet or database source is { kind, from, columns, rows (numbers as numbers), text (as people see them: "$1,234", "12%"), records (each row as an object by column) }; another item is { kind, from, content }. Draw from it in JavaScript (a chart library from a CDN, or your own SVG and tables); never type its numbers into the HTML.

Parameters

item_idstringrequired
pathsstring[]
numberedboolean
databoolean
Default true: what each source gives now.

update_report

Change a report: its files (the same edits as edit_page — replace exact text, write a whole file, delete, rename; index.html stays), its sources, its theme, or any of them. sources, when given, is the whole list in its new form: keep the ones that stay. theme restyles the whole report (its fonts and colors) without touching its HTML. To build an empty report or rewrite one: guide topic "reports" first (the standard look and the HTML of each block), then one section a call. Everyone with it open gets the new report at once; file edits become a new version with your message. read_report first (people may have edited it), render_report after.

Parameters

item_idstringrequired
messagestringrequired
What changed, as a commit message.
editsobject[]
Show child attributes
opstringrequired
write (a whole file, made if new), replace (exact text in a file — prefer this for small changes, so people typing elsewhere in the file are untouched), delete, rename. One of write, replace, delete, rename.
pathstring
The file. A page's or a report's edit without one is to index.html; a code item's edit needs it.
contentstring
write: the whole file.
findstring
replace: the exact text now in the file (spaces and line breaks too); include enough lines that it matches once.
replacestring
replace: what it becomes.
allboolean
replace: change every match, not just one.
tostring
rename: the new path.
sourcesobject[]
Show child attributes
namestringrequired
What the page calls it: window.ARTIFACTS.data.<name>. Letters, digits and "_", starting with a letter: "revenue", "pipeline_by_stage".
notestring
What it is, for people reading the sources ("USD, closed deals only").
sheetstring
A spreadsheet of the space (its item id), read by range.
rangestring
With sheet: "Revenue!A1:E13" — a header row, then the rows.
databaseobject
A table of a database of the space, read as a sheet range would be.
Show child attributes
itemstringrequired
The database item.
tablestringrequired
fieldsstring[]required
The fields, in order. With group_by, the first is the group and the number fields are totalled.
group_bystring
totalstring
sum, avg, min, max of each number field per group, or count (records per group). Without group_by: one total over all records, given as total and total_text. One of sum, avg, min, max, count.
filtersobject[]
Show child attributes
fieldstringrequired
opstringrequired
One of is, is_not, contains, not_contains, gt, gte, lt, lte, empty, not_empty.
valuestring | number | boolean
sortobject[]
Show child attributes
fieldstringrequired
descboolean
limitinteger
itemstring
Another item of the space, read whole as it is now: dashboard, kanban, calendar, poll, timeline, compare, form, invoice, wiki, database, map, catalog, diagram, stock, weather. A dashboard gives its tiles with their numbers; a Kanban board its columns and cards; a calendar its events; a poll its results; a form its responses.
themestring
Switch its fonts and colors to this theme. One of paper, slate, ink, forest, midnight.

render_report

Run a report as people see it, with its data read now, and check all of it in one call: JavaScript errors, console errors and failed requests; its layout at desktop and phone widths, in words; pictures of the whole page; sources that could not be read, and Artifacts's and whether it is on the standard look. steps clicks and types through it as in render_page. Call it once the report is built, not after every edit. Fix every error and every source that can't be read before you hand it over.

Parameters

item_idstringrequired
widthinteger
The width the pictures are taken at. Default 1280. The layout is checked at this width and at a phone's (390) either way.
heightinteger
Default 800.
from_yinteger
Where the pictures start, in px from the top (default 0). A call shows the whole page, up to eight screens; a longer page says where to continue.
picturesboolean
false: errors and layout findings only, no pictures. For re-checking after a fix.
stepsobject[]
Show child attributes
clickstring
typeobject
Show child attributes
selectorstringrequired
textstringrequired
pressstring
scrollnumber
waitnumber