@sixb/agent 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +31 -2
- package/dist/abort.d.ts +6 -0
- package/dist/abort.d.ts.map +1 -0
- package/dist/agent-prompt.d.ts +120 -0
- package/dist/agent-prompt.d.ts.map +1 -0
- package/dist/agent-runtime/errors.d.ts +13 -0
- package/dist/agent-runtime/errors.d.ts.map +1 -0
- package/dist/agent-runtime/preflight.d.ts +18 -0
- package/dist/agent-runtime/preflight.d.ts.map +1 -0
- package/dist/agent-runtime/profile.d.ts +14 -0
- package/dist/agent-runtime/profile.d.ts.map +1 -0
- package/dist/artifacts/layout-check/layout-check.d.ts +87 -0
- package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -0
- package/dist/artifacts/materialize.d.ts +115 -0
- package/dist/artifacts/materialize.d.ts.map +1 -0
- package/dist/artifacts/publish-tool.d.ts +86 -0
- package/dist/artifacts/publish-tool.d.ts.map +1 -0
- package/dist/ask-parent-tool.d.ts +36 -0
- package/dist/ask-parent-tool.d.ts.map +1 -0
- package/dist/attachments.d.ts +68 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/child-files.d.ts +96 -0
- package/dist/child-files.d.ts.map +1 -0
- package/dist/child-questions.d.ts +24 -0
- package/dist/child-questions.d.ts.map +1 -0
- package/dist/computer-runner.d.ts +65 -0
- package/dist/computer-runner.d.ts.map +1 -0
- package/dist/context-budget.d.ts +28 -0
- package/dist/context-budget.d.ts.map +1 -0
- package/dist/context-compaction.d.ts +48 -0
- package/dist/context-compaction.d.ts.map +1 -0
- package/dist/conversation-memory.d.ts +21 -0
- package/dist/conversation-memory.d.ts.map +1 -0
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution-plan.d.ts +34 -0
- package/dist/execution-plan.d.ts.map +1 -0
- package/dist/failure.d.ts +14 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/family-mailbox.d.ts +60 -0
- package/dist/family-mailbox.d.ts.map +1 -0
- package/dist/file-ref.d.ts +6 -0
- package/dist/file-ref.d.ts.map +1 -0
- package/dist/image-attachments.d.ts +34 -0
- package/dist/image-attachments.d.ts.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12168 -0
- package/dist/index.js.map +65 -0
- package/dist/message-authors.d.ts +34 -0
- package/dist/message-authors.d.ts.map +1 -0
- package/dist/message-times.d.ts +8 -0
- package/dist/message-times.d.ts.map +1 -0
- package/dist/model-adapters.d.ts +55 -0
- package/dist/model-adapters.d.ts.map +1 -0
- package/dist/model-lines.d.ts +16 -0
- package/dist/model-lines.d.ts.map +1 -0
- package/dist/requester.d.ts +15 -0
- package/dist/requester.d.ts.map +1 -0
- package/dist/run-agent-turn.d.ts +63 -0
- package/dist/run-agent-turn.d.ts.map +1 -0
- package/dist/run-child.d.ts +77 -0
- package/dist/run-child.d.ts.map +1 -0
- package/dist/run-conversation-turn.d.ts +42 -0
- package/dist/run-conversation-turn.d.ts.map +1 -0
- package/dist/run-credential.d.ts +22 -0
- package/dist/run-credential.d.ts.map +1 -0
- package/dist/run-environment.d.ts +115 -0
- package/dist/run-environment.d.ts.map +1 -0
- package/dist/run-fate.d.ts +15 -0
- package/dist/run-fate.d.ts.map +1 -0
- package/dist/run-sandbox.d.ts +60 -0
- package/dist/run-sandbox.d.ts.map +1 -0
- package/dist/run-subagent.d.ts +51 -0
- package/dist/run-subagent.d.ts.map +1 -0
- package/dist/run-workflow-agent-node.d.ts +41 -0
- package/dist/run-workflow-agent-node.d.ts.map +1 -0
- package/dist/sandbox-api-context.d.ts +34 -0
- package/dist/sandbox-api-context.d.ts.map +1 -0
- package/dist/sandbox-file-registry.d.ts +9 -0
- package/dist/sandbox-file-registry.d.ts.map +1 -0
- package/dist/sandbox-files.d.ts +71 -0
- package/dist/sandbox-files.d.ts.map +1 -0
- package/dist/sandbox-handle.d.ts +15 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-readiness.d.ts +8 -0
- package/dist/sandbox-readiness.d.ts.map +1 -0
- package/dist/skills/built-in.d.ts +15 -0
- package/dist/skills/built-in.d.ts.map +1 -0
- package/dist/subagent-continuation.d.ts +27 -0
- package/dist/subagent-continuation.d.ts.map +1 -0
- package/dist/subagent-inbox.d.ts +53 -0
- package/dist/subagent-inbox.d.ts.map +1 -0
- package/dist/subagent-tools.d.ts +282 -0
- package/dist/subagent-tools.d.ts.map +1 -0
- package/dist/thread-context.d.ts +12 -0
- package/dist/thread-context.d.ts.map +1 -0
- package/dist/tools/attachments.d.ts +11 -0
- package/dist/tools/attachments.d.ts.map +1 -0
- package/dist/tools/bash.d.ts +60 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/model-spec.d.ts +4 -0
- package/dist/tools/model-spec.d.ts.map +1 -0
- package/dist/tools/read.d.ts +43 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/result-media.d.ts +22 -0
- package/dist/tools/result-media.d.ts.map +1 -0
- package/dist/tools/result-output.d.ts +18 -0
- package/dist/tools/result-output.d.ts.map +1 -0
- package/dist/tools/tool-files.d.ts +59 -0
- package/dist/tools/tool-files.d.ts.map +1 -0
- package/dist/tools/view-file.d.ts +40 -0
- package/dist/tools/view-file.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/turn-runtime.d.ts +19 -0
- package/dist/turn-runtime.d.ts.map +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workflow-input-attachments.d.ts +18 -0
- package/dist/workflow-input-attachments.d.ts.map +1 -0
- package/package.json +59 -4
- package/src/abort.ts +40 -0
- package/src/agent-prompt.ts +758 -0
- package/src/agent-runtime/errors.ts +44 -0
- package/src/agent-runtime/preflight.ts +314 -0
- package/src/agent-runtime/profile.ts +23 -0
- package/src/artifacts/layout-check/check.cjs +478 -0
- package/src/artifacts/layout-check/layout-check.ts +460 -0
- package/src/artifacts/materialize.ts +380 -0
- package/src/artifacts/publish-tool.ts +700 -0
- package/src/ask-parent-tool.ts +100 -0
- package/src/attachments.ts +850 -0
- package/src/child-files.ts +540 -0
- package/src/child-questions.ts +42 -0
- package/src/computer-runner.ts +284 -0
- package/src/context-budget.ts +161 -0
- package/src/context-compaction.ts +529 -0
- package/src/conversation-memory.ts +45 -0
- package/src/errors.ts +85 -0
- package/src/execution-plan.ts +50 -0
- package/src/failure.ts +71 -0
- package/src/family-mailbox.ts +189 -0
- package/src/file-ref.ts +18 -0
- package/src/image-attachments.ts +322 -0
- package/src/index.ts +54 -0
- package/src/message-authors.ts +77 -0
- package/src/message-times.ts +21 -0
- package/src/model-adapters.ts +227 -0
- package/src/model-lines.ts +28 -0
- package/src/requester.ts +21 -0
- package/src/run-agent-turn.ts +347 -0
- package/src/run-child.ts +319 -0
- package/src/run-conversation-turn.ts +257 -0
- package/src/run-credential.ts +55 -0
- package/src/run-environment.ts +769 -0
- package/src/run-fate.ts +51 -0
- package/src/run-sandbox.ts +63 -0
- package/src/run-subagent.ts +347 -0
- package/src/run-workflow-agent-node.ts +270 -0
- package/src/sandbox-api-context.ts +234 -0
- package/src/sandbox-file-registry.ts +26 -0
- package/src/sandbox-files.ts +326 -0
- package/src/sandbox-handle.ts +19 -0
- package/src/sandbox-readiness.ts +22 -0
- package/src/skills/built-in.ts +183 -0
- package/src/skills/sixb-artifacts/SKILL.md +95 -0
- package/src/skills/sixb-artifacts/canvas.md +104 -0
- package/src/skills/sixb-artifacts/document.md +63 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/first-job.html +42 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/region.html +29 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/shared.css +35 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/welcome.html +31 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/canvas.json +107 -0
- package/src/skills/sixb-artifacts/examples/canvas/retro/canvas.json +158 -0
- package/src/skills/sixb-artifacts/examples/document/incident-report/document.md +35 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/document.md +41 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/figures/restorations.svg +1 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/index.html +169 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/data/dispatch.json +234 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/index.html +245 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/data/plan.json +53 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/index.html +462 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/data/service.json +276 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/index.html +549 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/workbook.json +30 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Inventory.csv +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Spend.csv +6 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/workbook.json +47 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Quarters.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Regions.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/workbook.json +78 -0
- package/src/skills/sixb-artifacts/examples/slides/launch-plan/index.html +63 -0
- package/src/skills/sixb-artifacts/examples/slides/q3-review/index.html +133 -0
- package/src/skills/sixb-artifacts/file.md +17 -0
- package/src/skills/sixb-artifacts/page.md +215 -0
- package/src/skills/sixb-artifacts/queries.md +66 -0
- package/src/skills/sixb-artifacts/references.md +68 -0
- package/src/skills/sixb-artifacts/sheet.md +223 -0
- package/src/skills/sixb-artifacts/slides.md +137 -0
- package/src/skills/sixb-memory/SKILL.md +68 -0
- package/src/skills/text-assets.d.ts +25 -0
- package/src/subagent-continuation.ts +51 -0
- package/src/subagent-inbox.ts +101 -0
- package/src/subagent-tools.ts +1609 -0
- package/src/thread-context.ts +25 -0
- package/src/tools/attachments.ts +28 -0
- package/src/tools/bash.ts +217 -0
- package/src/tools/model-spec.ts +22 -0
- package/src/tools/read.ts +262 -0
- package/src/tools/result-media.ts +147 -0
- package/src/tools/result-output.ts +44 -0
- package/src/tools/tool-files.ts +204 -0
- package/src/tools/view-file.ts +155 -0
- package/src/turn-runtime.ts +33 -0
- package/src/types.ts +79 -0
- package/src/workflow-input-attachments.ts +140 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# References
|
|
2
|
+
|
|
3
|
+
An artifact can show or link to another one by its address, so a report shows the chart its sheet
|
|
4
|
+
draws and stays current when the sheet changes.
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
artifact:<id>[@<version>][/<file>][#<part>]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
| Address | Points at |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `artifact:art_k3m9q2x7tp` | The artifact, at its latest version |
|
|
13
|
+
| `artifact:art_k3m9q2x7tp@2` | Version 2, which never changes |
|
|
14
|
+
| `artifact:art_k3m9q2x7tp/figures/revenue.svg` | A file inside it |
|
|
15
|
+
| `artifact:art_k3m9q2x7tp#Summary` | A sheet |
|
|
16
|
+
| `artifact:art_k3m9q2x7tp#Summary!A1:D6` | A range of a sheet; row 1 is the header row |
|
|
17
|
+
| `artifact:art_k3m9q2x7tp#chart=revenue` | A chart in a workbook |
|
|
18
|
+
| `artifact:art_k3m9q2x7tp#methodology` | A document's section |
|
|
19
|
+
| `artifact:art_k3m9q2x7tp#4` | A deck's slide 4 |
|
|
20
|
+
|
|
21
|
+
Copy addresses from `$SIXB_ARTIFACTS`: each artifact lists its `address` and the `parts` it has,
|
|
22
|
+
each with two addresses written out:
|
|
23
|
+
|
|
24
|
+
- `address` follows the artifact's latest version. Use it in a document, a sheet, or a deck, which
|
|
25
|
+
you revise as the artifact changes.
|
|
26
|
+
- `pinned` names the version you read, such as `artifact:art_k3m9q2x7tp@2#chart=revenue`. Use it in
|
|
27
|
+
a reply: a reply's words describe that version, so what it shows must stay that version.
|
|
28
|
+
|
|
29
|
+
In a Markdown link, write a space as `%20`: `artifact:art_k3m9q2x7tp#Q3%20numbers!A1:D6`.
|
|
30
|
+
|
|
31
|
+
## Show or link
|
|
32
|
+
|
|
33
|
+
| In | Show it in place | Link to it |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| A document | `` | `[the methodology](artifact:…#methodology)` |
|
|
36
|
+
| A reply | `` | `[the methodology](artifact:…@2#methodology)` |
|
|
37
|
+
| A deck or a page | `<sixb-embed src="artifact:…#chart=revenue"></sixb-embed>`, or `<img src="artifact:…/figure.png">` for a file | `<a href="artifact:…#methodology">the methodology</a>` |
|
|
38
|
+
| A sheet | An `image` column cell holding the address | A `link` column cell holding the address |
|
|
39
|
+
|
|
40
|
+
- Show a chart or a range when the reader needs to see it there. Link when they only need to know
|
|
41
|
+
where it is.
|
|
42
|
+
- When the numbers are in a published sheet, show its range instead of retyping them in a Markdown
|
|
43
|
+
table: the range cannot drift from the sheet. A live sheet's chart or range shows each reader
|
|
44
|
+
their own rows, so a document that shows it stays current too. Asked for "the first three regions as a table",
|
|
45
|
+
show `artifact:…@2#Regions!A1:D4`, the header row and three rows.
|
|
46
|
+
- The text in `![…]` is the caption under what it shows. Say what the figure shows, not "Chart".
|
|
47
|
+
- In a reply, show at most one chart or a range of about a dozen rows. Publish anything larger and
|
|
48
|
+
link to it.
|
|
49
|
+
- A page shown in a document or a reply (``) runs live at the width of
|
|
50
|
+
the text, as tall as it lays out up to 800px, then scrolls. Show one the reader works with there,
|
|
51
|
+
such as a small calculator; link to a page that needs the whole window.
|
|
52
|
+
- Something shown inside a shown artifact appears as a link: one level shows in place.
|
|
53
|
+
|
|
54
|
+
## Keep addresses working
|
|
55
|
+
|
|
56
|
+
An address names a sheet, a chart, or a section by name, so a new version that renames one moves
|
|
57
|
+
its address:
|
|
58
|
+
|
|
59
|
+
- A chart's `name` is its address. Keep it the same in every version; to rename what readers see,
|
|
60
|
+
change its `title`.
|
|
61
|
+
- Renaming a sheet or editing a heading moves its address too. Do it only when the user asks.
|
|
62
|
+
|
|
63
|
+
## When an address breaks
|
|
64
|
+
|
|
65
|
+
Publishing refuses an address that resolves to nothing and says what the target has instead: fix
|
|
66
|
+
the address and publish again. When a new version renames or removes something another artifact
|
|
67
|
+
shows, it publishes with a warning naming that artifact: publish that artifact's next version with
|
|
68
|
+
an address that resolves.
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Sheets
|
|
2
|
+
|
|
3
|
+
A sheet is tabular data the reader explores: a grid with typed columns, one or more sheets, and
|
|
4
|
+
charts the app draws from them. The reader sorts columns, selects a range to see its sum and
|
|
5
|
+
average, copies cells, and downloads each sheet as CSV. Publish one for metrics, lists, trackers,
|
|
6
|
+
and exports. A column can compute from the others, as an Excel table's does. When the user asked for
|
|
7
|
+
an `.xlsx`, or needs formulas across cells rather than columns, publish a `file` instead.
|
|
8
|
+
|
|
9
|
+
## Layout
|
|
10
|
+
|
|
11
|
+
A sheet is a directory: `workbook.json`, and one CSV per sheet under `sheets/`, named for the sheet.
|
|
12
|
+
A sheet of the project's data reads its rows from a query instead, and has no CSV (Live rows).
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
work/service-metrics/
|
|
16
|
+
├── workbook.json
|
|
17
|
+
└── sheets/
|
|
18
|
+
├── Quarters.csv
|
|
19
|
+
└── Regions.csv
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Values
|
|
23
|
+
|
|
24
|
+
Each CSV is UTF-8. Its first line names the columns, and each name is unique. Quote a field that
|
|
25
|
+
holds a comma, a quote, or a line break, and double a quote inside one: `"Harbor Point, ""B"""`.
|
|
26
|
+
|
|
27
|
+
Write values raw. The workbook formats them in the reader's locale:
|
|
28
|
+
|
|
29
|
+
| Type | Write | Shows as |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| `number` | `1284` or `-3.5` | 1,284 |
|
|
32
|
+
| `currency` | `182400` | $182,400 |
|
|
33
|
+
| `percent` | `0.961`, a fraction | 96.1% |
|
|
34
|
+
| `date` | `2026-09-30`, or an ISO 8601 date and time | Sep 30, 2026 |
|
|
35
|
+
| `link` | `https://example.com/cases/4182`, or an `artifact:` address | example.com/cases/4182 |
|
|
36
|
+
| `image` | `photos/unit-7.jpg`, a file in the artifact, or an `artifact:` address | A thumbnail |
|
|
37
|
+
| `boolean` | `true` or `false` | A checkbox |
|
|
38
|
+
| `tag` | A short label from a small set: `Late`, `On track` | A chip, in its tone |
|
|
39
|
+
| `text` | Anything | As written |
|
|
40
|
+
|
|
41
|
+
- No symbols, thousands separators, or units in numbers: `4120000`, not `$4.12M` or `4,120,000`.
|
|
42
|
+
Put the unit in the column name: `Lead time (weeks)`.
|
|
43
|
+
- An empty cell is a gap; it is not drawn as zero.
|
|
44
|
+
- One row per record. Leave out total rows, notes, and blank rows: a chart would plot a total as
|
|
45
|
+
one more record. Give the sheet `totals` instead.
|
|
46
|
+
|
|
47
|
+
A sheet holds at most 200 columns and 100,000 rows; a workbook, 20 sheets and 10 charts.
|
|
48
|
+
|
|
49
|
+
## workbook.json
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"sheets": [
|
|
54
|
+
{
|
|
55
|
+
"name": "Regions",
|
|
56
|
+
"frozenColumns": 1,
|
|
57
|
+
"columns": {
|
|
58
|
+
"Visits": "number",
|
|
59
|
+
"Within SLA": { "type": "percent", "decimals": 1 },
|
|
60
|
+
"Change": { "type": "percent", "decimals": 1, "signed": true },
|
|
61
|
+
"Parts cost": { "type": "currency", "currency": "USD", "compact": true }
|
|
62
|
+
},
|
|
63
|
+
"widths": { "Region": 140 },
|
|
64
|
+
"descriptions": { "Within SLA": "Priority calls restored inside the agreed time." },
|
|
65
|
+
"totals": { "Visits": "sum", "Within SLA": "average", "Parts cost": "sum" }
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"charts": [
|
|
69
|
+
{ "name": "sla", "type": "bar", "sheet": "Regions", "x": "Region", "y": "Within SLA", "title": "Within SLA by region" }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Key | Means | Default |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| `name` | The sheet's tab, and its file: `sheets/<name>.csv` | Required |
|
|
77
|
+
| `columns` | A type for each column by name, or `{ type, currency, decimals, compact, signed, tones, highlight }` | Text |
|
|
78
|
+
| `frozenRows` | Rows that stay in view while scrolling, header included, 0 to 10 | 1 |
|
|
79
|
+
| `frozenColumns` | Columns that stay in view while scrolling sideways, 0 to 5 | 0 |
|
|
80
|
+
| `widths` | Column widths in pixels, 40 to 800 | Fitted to the values |
|
|
81
|
+
| `descriptions` | What a column means, by name, at most 300 characters; shown on its header | None |
|
|
82
|
+
| `totals` | A row pinned under the sheet: `sum`, `average`, `min`, or `max` of a numeric column, or `count` of any column's values | None |
|
|
83
|
+
|
|
84
|
+
A tag column names its colors in `tones`, by value: `positive`, `warning`, `negative`, or
|
|
85
|
+
`neutral` for what a status means, or `chart-1` to `chart-5` for categories. A value not named is
|
|
86
|
+
neutral. Use a tag for a status or a category, not for free text.
|
|
87
|
+
|
|
88
|
+
`highlight` shades a number, currency, or percent column by value, across the whole column:
|
|
89
|
+
`bars` draws a bar in each cell from zero, for amounts to compare at a glance; `scale` shades from
|
|
90
|
+
light to dark, for rates and scores; `diverging` shades positive values green and negative ones
|
|
91
|
+
red, for changes and variances. Highlight the one or two columns the reader should scan, not
|
|
92
|
+
every column.
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
"Status": { "type": "tag", "tones": { "Late": "negative", "At risk": "warning", "On track": "positive" } },
|
|
96
|
+
"Revenue": { "type": "currency", "highlight": "bars" },
|
|
97
|
+
"Change": { "type": "percent", "signed": true, "highlight": "diverging" }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`currency` is an ISO 4217 code and defaults to USD. `decimals` is 0 to 6; without it a column shows
|
|
101
|
+
the decimals its values need. `compact: true` shows a number or currency short, `$4.1M` or `12K`,
|
|
102
|
+
for large amounts read at a glance. `signed: true` shows `+` on positive values, for changes and
|
|
103
|
+
variances. Sheets appear in the order listed. Freeze the first column when it names each row and
|
|
104
|
+
the sheet is wider than a screen.
|
|
105
|
+
|
|
106
|
+
Totals cover the rows the reader sees, so a filter changes them, and the first column without a
|
|
107
|
+
total reads "Total". Describe a column whose name alone could be read two ways: how it is
|
|
108
|
+
counted, what it includes, its source.
|
|
109
|
+
|
|
110
|
+
## Computed columns
|
|
111
|
+
|
|
112
|
+
A column with a `formula` computes each row from the others, as a column of an Excel table does.
|
|
113
|
+
Name it in the CSV header and leave its values empty: the formula fills them, and the reader sees
|
|
114
|
+
the formula in the formula bar.
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
"Margin": { "type": "percent", "decimals": 1, "formula": "([@Revenue]-[@Cost])/[@Revenue]" }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Write | Means |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `[@Revenue]` | This row's Revenue |
|
|
123
|
+
| `[@[Lead time (weeks)]]` | A name with spaces, brackets, or symbols, bracketed again |
|
|
124
|
+
| `[Revenue]` | The whole column, only inside `SUM`, `AVERAGE`, `MIN`, `MAX`, `COUNT`: `[@Revenue]/SUM([Revenue])` |
|
|
125
|
+
| `"Late"`, `12.5`, `TRUE` | Text in double quotes, numbers, booleans |
|
|
126
|
+
|
|
127
|
+
- Operators: `+ - * / ^`, `&` joins text, and `= <> < <= > >=` compare.
|
|
128
|
+
- Functions: `IF`, `IFERROR`, `AND`, `OR`, `NOT`, `ISBLANK`, `ROUND`, `ABS`, `MIN`, `MAX`, `SUM`,
|
|
129
|
+
`AVERAGE`, `COUNT`, `LEN`, `LOWER`, `UPPER`, `CONCAT`, `YEAR`, `MONTH`, `DAYS`. Nothing that
|
|
130
|
+
changes by itself, such as `TODAY`: a version computes the same values forever.
|
|
131
|
+
- It computes as Excel does, and the `.xlsx` download keeps each cell's formula: an empty cell
|
|
132
|
+
reads as 0, or as empty text with `&`. Use `IF(ISBLANK([@Cost]),"",…)` where a blank should stay
|
|
133
|
+
blank.
|
|
134
|
+
- A division by zero shows `#DIV/0!` and text where a number belongs `#VALUE!`. Publishing warns
|
|
135
|
+
with the rows that do; `IFERROR([@Cost]/[@Revenue],"")` gives them a value.
|
|
136
|
+
- The formula's result must fit the column's type: a number in a number, currency, or percent
|
|
137
|
+
column, a date in a date column (`[@Opened]+30`), true or false in a boolean one; anything in
|
|
138
|
+
text.
|
|
139
|
+
|
|
140
|
+
Compute what follows from other columns: margins, shares, ratios, differences, days between dates,
|
|
141
|
+
flags. Write values the source gives, and totals in `totals`, not in a computed column.
|
|
142
|
+
|
|
143
|
+
## Charts
|
|
144
|
+
|
|
145
|
+
The app draws each chart from its sheet, in the theme's colors, beside the grid and in its own tab.
|
|
146
|
+
Do not draw chart images for a sheet.
|
|
147
|
+
|
|
148
|
+
| Key | Means |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `name` | Lowercase letters, digits, and hyphens: `revenue`. It is the chart's address: keep it in every version, and change `title` to rename the chart |
|
|
151
|
+
| `type` | `line` for a trend over time, `bar` to compare categories, `area` for parts of a total over time, `pie` for the share of a whole, `scatter` for how two numbers move together, a point per row |
|
|
152
|
+
| `sheet` | The sheet it plots |
|
|
153
|
+
| `x` | The column along the x axis, or a pie's slice labels; a number column for a scatter |
|
|
154
|
+
| `y` | A column to plot, or a list of up to five; each is a number, currency, or percent column |
|
|
155
|
+
| `line` | A bar chart's columns drawn as lines over its bars: a rate over amounts. A line of another type than the bars reads on a right axis |
|
|
156
|
+
| `aggregate` | `sum` or `average` of `y` for each `x` value, or `count` of rows with no `y`: charts raw rows, such as one per job, by region |
|
|
157
|
+
| `title` | What it shows, at most 120 characters: `Service revenue by quarter` |
|
|
158
|
+
| `stacked` | `true` stacks a bar or area chart's series |
|
|
159
|
+
|
|
160
|
+
A pie has one `y` column and at most five rows, or five `x` values when it aggregates. Series in one
|
|
161
|
+
chart share an axis, so plot columns of the same type and scale together; a bar chart's `line`
|
|
162
|
+
columns of another type share one right axis, so give them one type. Bars and lines together plot at
|
|
163
|
+
most five columns.
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{ "name": "revenue-margin", "type": "bar", "sheet": "Quarters", "x": "Quarter", "y": "Revenue", "line": "Margin" },
|
|
167
|
+
{ "name": "jobs-by-region", "type": "bar", "sheet": "Jobs", "x": "Region", "aggregate": "count" },
|
|
168
|
+
{ "name": "cost-visits", "type": "scatter", "sheet": "Regions", "x": "Visits", "y": "Parts cost" }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Live rows
|
|
172
|
+
|
|
173
|
+
A sheet of the project's objects reads its rows from one of the artifact's queries
|
|
174
|
+
(`queries.md`), each time it is opened, as whoever opens it. Make a sheet of project data live
|
|
175
|
+
unless the user asked for a snapshot. A live sheet has no `sheets/<name>.csv`: it names its query in
|
|
176
|
+
`"query"`, and each column the property it shows in `"from"`.
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"name": "Overdue",
|
|
181
|
+
"query": "overdue",
|
|
182
|
+
"columns": {
|
|
183
|
+
"Invoice": { "from": "number" },
|
|
184
|
+
"Customer": { "from": "customer.name" },
|
|
185
|
+
"Amount": { "from": "amount", "type": "currency" },
|
|
186
|
+
"Paid": { "from": "paid", "type": "currency" },
|
|
187
|
+
"Due": { "from": "dueDate" },
|
|
188
|
+
"Outstanding": { "type": "currency", "formula": "[@Amount]-[@Paid]" }
|
|
189
|
+
},
|
|
190
|
+
"totals": { "Amount": "sum" }
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- The columns are those `columns` lists, in its order. Each has `from`, a property of the rows, or
|
|
195
|
+
`<link>.<property>` of a link the query expands, or a `formula`; not both. Name columns with a
|
|
196
|
+
letter first: JSON puts a name of digits, such as `2024`, before the others.
|
|
197
|
+
- Without `type`, a column takes its property's: numbers, dates, true or false, an enum as a tag,
|
|
198
|
+
anything else as text. Give `type` for what the property doesn't say, such as `currency` or
|
|
199
|
+
`percent`, and any format key a CSV sheet's column takes.
|
|
200
|
+
- Totals, charts, highlights, and formulas work as on any sheet. A link that reaches several objects
|
|
201
|
+
shows their values joined by commas.
|
|
202
|
+
- A value the reader is not cleared for shows locked, as does a total over it. A live sheet is not
|
|
203
|
+
edited in the app: change its query or columns, and publish its next version.
|
|
204
|
+
- The sheet shows up to 10,000 rows, and says when there were more: filter or limit the query.
|
|
205
|
+
- Publishing refuses a `from` its query's rows don't hold, such as a link the query doesn't
|
|
206
|
+
expand, and a facets query: a sheet shows rows.
|
|
207
|
+
|
|
208
|
+
## Check before publishing
|
|
209
|
+
|
|
210
|
+
Open each CSV and check its header and a few rows. A refusal names the file, row, and column to fix:
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
'sheets/Regions.csv' row 3, column 'Within SLA': "93.4%" is not a number: write a percent as a fraction, such as 0.351 for 35.1%.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Examples
|
|
217
|
+
|
|
218
|
+
`examples/sheet/` holds three finished workbooks to start from: service metrics with two sheets,
|
|
219
|
+
totals, descriptions, compact and signed numbers, a computed margin, and line, bar, bar-and-line,
|
|
220
|
+
and scatter charts; a parts
|
|
221
|
+
inventory with a frozen first column, a status tag, bars, a checkbox, dates, links, a pie, and a
|
|
222
|
+
chart that counts rows by category; and overdue invoices, a live sheet of the project's invoices
|
|
223
|
+
with their customer, a computed balance, and a chart that sums it by customer.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Slides
|
|
2
|
+
|
|
3
|
+
A deck is HTML: one `<section class="slide">` per 1280×720 slide. Sixb adds its kit and runtime to
|
|
4
|
+
the page, which lay the slides out, scale them to fit, number them, apply the app's theme and dark
|
|
5
|
+
mode, and give the reader previous and next, an overview, and present. Write slides;
|
|
6
|
+
do not write navigation, scaling, or slide numbers.
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
work/q3-review/
|
|
10
|
+
├── index.html
|
|
11
|
+
├── deck.css optional, for what the layouts don't cover
|
|
12
|
+
└── img/fleet.jpg images, by relative path
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<!doctype html>
|
|
17
|
+
<html lang="en">
|
|
18
|
+
<head>
|
|
19
|
+
<meta charset="utf-8">
|
|
20
|
+
<title>Q3 review</title>
|
|
21
|
+
<link rel="stylesheet" href="deck.css">
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<section class="slide title">
|
|
25
|
+
<p class="eyebrow"><span>Q3 2026</span><span>Operations review</span></p>
|
|
26
|
+
<h1>Q3 review</h1>
|
|
27
|
+
<p>Restorations within SLA reached 94% while calls rose 12%</p>
|
|
28
|
+
<p class="source">October 22, 2026</p>
|
|
29
|
+
</section>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Layouts
|
|
35
|
+
|
|
36
|
+
Pick one per slide with a class beside `slide`. Use the layouts before writing CSS.
|
|
37
|
+
|
|
38
|
+
| Class | For | Holds |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| `title` | The opening slide | `.eyebrow`, a short `<h1>` (2 or 3 words), a `<p>` with the takeaway, the date as `.source` |
|
|
41
|
+
| `section` | A divider between parts | `.eyebrow`, `<h2>` |
|
|
42
|
+
| `stat` | The numbers that matter | `<h2>`, then `<div class="stats">` holding up to 4 of `<div><div class="value">94%</div><div class="label">…</div></div>` |
|
|
43
|
+
| `split` | A list beside a figure, a callout, or a table | `<h2>`, then two blocks |
|
|
44
|
+
| `chart` | A chart | `<h2>`, `<figure>` with a `.legend` and an inline `<svg>` |
|
|
45
|
+
| `table` | Up to about 8 rows | `<h2>`, `<table>`; `class="num"` on number cells |
|
|
46
|
+
| `quote` | A customer's or a leader's words | `<blockquote>`, `<cite>` |
|
|
47
|
+
| `image` | A photo or a diagram | `<h2>`, `<img>`; `image bleed` fills the slide |
|
|
48
|
+
|
|
49
|
+
Without a layout class, a slide stacks its heading and content from the top.
|
|
50
|
+
|
|
51
|
+
Chrome on any slide: `<p class="eyebrow">` above the heading (two `<span>`s inside sit at either
|
|
52
|
+
end), and `<p class="source">` for where its numbers come from, in the footer. The footer is a rule
|
|
53
|
+
with the source on the left and the slide's number on the right; add `no-number` to a slide to drop
|
|
54
|
+
the number.
|
|
55
|
+
|
|
56
|
+
Inside a slide: `<div class="callout">` sets the one point to remember on a shaded panel,
|
|
57
|
+
`<span class="tag">` is a small pill label such as a status, and `class="note"` sets an aside in
|
|
58
|
+
smaller, muted text.
|
|
59
|
+
|
|
60
|
+
## Write
|
|
61
|
+
|
|
62
|
+
- One idea per slide. Its heading states the takeaway ("Restorations within SLA reached 94%"),
|
|
63
|
+
not the topic ("SLA").
|
|
64
|
+
- At most about 40 words on a slide besides its heading. Put detail in a document and link to it.
|
|
65
|
+
- Every number has a period and a source: `<p class="source">Field service records, Q3 2026</p>`.
|
|
66
|
+
- Nothing smaller than 18px; the kit's sizes already are.
|
|
67
|
+
- No emoji as icons, no decorative gradients, glows, or drop shadows.
|
|
68
|
+
- 6 to 12 slides for most decks.
|
|
69
|
+
|
|
70
|
+
## Theme
|
|
71
|
+
|
|
72
|
+
Colors come from the theme, so a deck follows the app's light and dark mode. Use the variables, not
|
|
73
|
+
fixed colors: `--foreground`, `--muted-foreground`, `--background`, `--muted`, `--primary`,
|
|
74
|
+
`--border`, `--chart-1` to `--chart-5`, `--font-sans`, `--font-serif`, `--radius`. Only when the
|
|
75
|
+
user asks for a look, add `theme.json` (see `document.md`) or set the variables in `deck.css`.
|
|
76
|
+
|
|
77
|
+
## Charts
|
|
78
|
+
|
|
79
|
+
Draw a chart as an inline `<svg>` in the slide, colored with the theme's chart variables so it
|
|
80
|
+
follows the theme: `fill="var(--chart-1)"`. Draw the series that matters in `--chart-1` and the
|
|
81
|
+
others in `--chart-4`; light gridlines in `--border`; axis labels and values in
|
|
82
|
+
`--muted-foreground`, at 20px or more. Name two or more series in a legend above the chart:
|
|
83
|
+
`<ul class="legend"><li style="--swatch: var(--chart-1)">Restored within SLA</li>…</ul>`. Label the
|
|
84
|
+
axes or the bars and give the units.
|
|
85
|
+
|
|
86
|
+
## Show another artifact
|
|
87
|
+
|
|
88
|
+
When the numbers live in a published sheet, show its chart or range on the slide instead of
|
|
89
|
+
redrawing or retyping them: it is the same chart the sheet draws, and it cannot drift from it.
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<section class="slide chart">
|
|
93
|
+
<p class="eyebrow">Service levels</p>
|
|
94
|
+
<h2>Within-SLA rose every quarter, fastest in Q3</h2>
|
|
95
|
+
<sixb-embed src="artifact:art_k3m9q2x7tp#chart=sla-trend" title="SLA trend"></sixb-embed>
|
|
96
|
+
<p class="source">Source: Q3 service metrics</p>
|
|
97
|
+
</section>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- `<sixb-embed src="artifact:…">` shows a chart (`#chart=…`), a range (`#Regions!A1:D5`, the
|
|
101
|
+
header row and up to a dozen rows fit a slide), a document's section (`#methodology`), or a slide
|
|
102
|
+
of another deck (`#4`). It is a block as wide as its column, 16:9 unless the deck's CSS sizes it;
|
|
103
|
+
in the `chart` layout it takes the slide's height. `title` names it where it is not drawn yet,
|
|
104
|
+
such as in the slide thumbnails.
|
|
105
|
+
- `<img src="artifact:…/figures/map.png">` shows an image file of another artifact, laid out like
|
|
106
|
+
any image.
|
|
107
|
+
- `<a href="artifact:…">the Q3 numbers</a>` opens the artifact beside the conversation.
|
|
108
|
+
- A deck reads the project's objects live with `sixb.query`, as a page does (`page.md`); for a
|
|
109
|
+
chart a live sheet already draws, embed the sheet's chart instead.
|
|
110
|
+
- The layout check sees what a slide shows from another artifact as an empty box of its size, and
|
|
111
|
+
the screenshots show it so: it is drawn when the reader opens the deck.
|
|
112
|
+
|
|
113
|
+
## Check
|
|
114
|
+
|
|
115
|
+
Publishing refuses a deck without `index.html` or without a `section.slide`.
|
|
116
|
+
|
|
117
|
+
Once a deck publishes, Sixb lays it out in the sandbox's browser as the reader will see it, with
|
|
118
|
+
its `theme.json`, in light and in dark mode or in the one mode it pins, and warns about each
|
|
119
|
+
slide that has something past its edge, running
|
|
120
|
+
into the footer, drawn over other text, or cut off; text under 18px; text under WCAG AA contrast;
|
|
121
|
+
an image that did not load; or an error while the deck loaded. Each warning names the slide, the
|
|
122
|
+
element as CSS names it (`p.kicker`), and where it is on the 1280×720 slide. The result names
|
|
123
|
+
the screenshots, one per slide, under `.sixb/agent/checks/`.
|
|
124
|
+
|
|
125
|
+
1. Open the screenshots with `view_file`, at least the slides a warning names, and look at each
|
|
126
|
+
as the reader will: is anything crowded, misaligned, or unreadable?
|
|
127
|
+
2. Fix what the warnings name and what you see, in the deck's files.
|
|
128
|
+
3. Publish the next version with `publish_artifact_version`, and check again.
|
|
129
|
+
|
|
130
|
+
Contrast that fails only in dark mode means a fixed color: use the theme's variables. When the
|
|
131
|
+
result says the check did not run, read `index.html` slide by slide instead.
|
|
132
|
+
|
|
133
|
+
## Examples
|
|
134
|
+
|
|
135
|
+
`examples/slides/` holds two finished decks built from the layouts and classes above, with no CSS
|
|
136
|
+
of their own: a quarterly review with a chart, a stat, and a table, and a launch plan with a
|
|
137
|
+
timeline, a callout, and a table of owners.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sixb-memory
|
|
3
|
+
description: Organize the memory into topic files, and merge a save that conflicts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory
|
|
7
|
+
|
|
8
|
+
The memory is a folder of Markdown files under `$SIXB_MEMORY_DIR/<repo>/`. Later conversations
|
|
9
|
+
start from its `MEMORY.md` and open the other files when a topic comes up.
|
|
10
|
+
|
|
11
|
+
- `user/` is this user's own memory: only their conversations read it.
|
|
12
|
+
- `project/` is built up from every user's conversations, and everyone who uses the agent in this
|
|
13
|
+
project reads it, including people who cannot see the data this user sees. Put in it what holds
|
|
14
|
+
for everyone, such as the team's vocabulary, a convention, or how something is measured, and
|
|
15
|
+
only what users told you: nothing about a particular person, and nothing learned from records or
|
|
16
|
+
data.
|
|
17
|
+
|
|
18
|
+
## Topic files
|
|
19
|
+
|
|
20
|
+
`MEMORY.md` is a list of one-line entries that every conversation reads. When a subject outgrows a
|
|
21
|
+
line or two, move it into a topic file with one subject, such as `projects/payments.md` or
|
|
22
|
+
`team_structure.md`, and leave one entry in `MEMORY.md` that links it with a few words on what it
|
|
23
|
+
holds.
|
|
24
|
+
|
|
25
|
+
Link a file with `[[path]]`, from the repo root, leaving out `.md`: `[[projects/payments]]`. Other
|
|
26
|
+
files keep their extension: `[[metrics/keep_rate.sql]]`.
|
|
27
|
+
|
|
28
|
+
```md
|
|
29
|
+
# Memory
|
|
30
|
+
|
|
31
|
+
- Prefers summaries as short bullet lists (added 2026-10-04)
|
|
32
|
+
- Report invoice amounts excluding VAT (added 2026-10-21)
|
|
33
|
+
- Billing projects and how invoices are measured: [[projects/payments]] (added 2026-10-12)
|
|
34
|
+
- The query behind the weekly keep rate: [[metrics/keep_rate.sql]] (added 2026-10-15)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Writing an entry
|
|
38
|
+
|
|
39
|
+
- One bullet on one line, ending with the date it was added: `(added YYYY-MM-DD)`.
|
|
40
|
+
- Write it so a conversation that never saw this one understands it.
|
|
41
|
+
- Edit in place. When the user corrects an entry, change or remove it; never leave two entries that
|
|
42
|
+
disagree.
|
|
43
|
+
- Save how to find project data, such as the object type, the query or the property, never the
|
|
44
|
+
data itself: the memory outlives the user's access to it.
|
|
45
|
+
|
|
46
|
+
## Saving
|
|
47
|
+
|
|
48
|
+
End every edit with the save of the repo you edited, in the same command:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
echo '- Report invoice amounts excluding VAT (added 2026-10-21)' >> "$SIXB_MEMORY_DIR/user/MEMORY.md" && sixb memory save user -m "Invoice amounts excluding VAT"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Only the files are remembered. The chat shows the message under your reply, so keep it to a few
|
|
55
|
+
words saying what you learned. Save once per thing learned, after all of its edits.
|
|
56
|
+
|
|
57
|
+
The command prints JSON:
|
|
58
|
+
|
|
59
|
+
- `"saved": true`: the edits are stored. `warnings` lists `[[links]]` that point at no file; fix
|
|
60
|
+
them and save again.
|
|
61
|
+
- `"saved": false` with `conflicts`: another conversation saved the same files first. Each of their
|
|
62
|
+
versions is next to yours as `<file>.theirs`. Merge it into your file, delete the `.theirs` file,
|
|
63
|
+
and save again. `"theirs": null` means they deleted the file; keep yours only if it is still
|
|
64
|
+
right.
|
|
65
|
+
- `"saved": false` with `"changed": []`: nothing changed since the files were loaded.
|
|
66
|
+
|
|
67
|
+
A save is rejected with what to change when `MEMORY.md` is over 16 KB, a file over 256 KB, or the
|
|
68
|
+
repo over 4 MB, or when a path is absolute, has a `..` segment, or names a dotfile.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// The built-in skills' files, and the scripts the worker runs in the sandbox, are bundled as text.
|
|
2
|
+
declare module "*.md" {
|
|
3
|
+
const text: string
|
|
4
|
+
export default text
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module "*.svg" {
|
|
8
|
+
const text: string
|
|
9
|
+
export default text
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module "*.csv" {
|
|
13
|
+
const text: string
|
|
14
|
+
export default text
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module "*.cjs" {
|
|
18
|
+
const text: string
|
|
19
|
+
export default text
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module "*.css" {
|
|
23
|
+
const text: string
|
|
24
|
+
export default text
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AgentMessagePart } from "@sixb/core"
|
|
2
|
+
import type { AgentMessageRecord, SubagentRunRecord } from "@sixb/core/storage"
|
|
3
|
+
import { renderCurrentTime } from "./agent-prompt"
|
|
4
|
+
import { mailPart } from "./subagent-inbox"
|
|
5
|
+
|
|
6
|
+
// A child that paused continues as the next run of its thread under a later turn: once its held
|
|
7
|
+
// calls are decided, in the turn that resumes, or once its parent answers the question it paused
|
|
8
|
+
// on, in the turn the parent answers it. The same key, model and task. Its history is its thread,
|
|
9
|
+
// and what it goes on with is the message that starts the run.
|
|
10
|
+
|
|
11
|
+
/** What a child run reads of its thread: its messages, and the paused run it continues (`AgentChildContext`). */
|
|
12
|
+
export interface SubagentHistory {
|
|
13
|
+
readonly messages: readonly AgentMessageRecord[]
|
|
14
|
+
/** The run of the thread that paused on its held calls, when this run continues it. */
|
|
15
|
+
readonly paused?: SubagentRunRecord
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The message a continuation starts with: how each of its calls ended, as its own, or its parent's
|
|
20
|
+
* answer to its question; the messages its parent sent that the paused run never read; what came
|
|
21
|
+
* back to its new sandbox, and when it continues. It stays in
|
|
22
|
+
* the thread, so a later continuation replays the same bytes.
|
|
23
|
+
*
|
|
24
|
+
* A child whose workspace is kept finds it as it left it, and is told nothing about it here. If
|
|
25
|
+
* its files turn out lost, its system prompt says so, as a turn's does.
|
|
26
|
+
*/
|
|
27
|
+
export function continuationTrigger(input: {
|
|
28
|
+
/** The outcomes as the child reads them, without their caller, or the answer's `mail` part. */
|
|
29
|
+
readonly goesOnWith: readonly AgentMessagePart[]
|
|
30
|
+
readonly paused: SubagentRunRecord
|
|
31
|
+
/** Whether the sandbox provider keeps the child's workspace while it pauses. */
|
|
32
|
+
readonly keepsWorkspace: boolean
|
|
33
|
+
readonly createdAt: Date
|
|
34
|
+
readonly timeZone: string
|
|
35
|
+
}): readonly AgentMessagePart[] {
|
|
36
|
+
return [
|
|
37
|
+
...input.goesOnWith,
|
|
38
|
+
...(input.paused.result?.unread ?? []).map((mail) => mailPart(mail)),
|
|
39
|
+
...(input.keepsWorkspace
|
|
40
|
+
? []
|
|
41
|
+
: [{ type: "text" as const, text: sandboxRestarted(input.paused) }]),
|
|
42
|
+
{ type: "text", text: `\n\n${renderCurrentTime(input.createdAt, input.timeZone)}` },
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function sandboxRestarted(paused: SubagentRunRecord): string {
|
|
47
|
+
const outputsError = paused.result?.filesError
|
|
48
|
+
return outputsError === undefined
|
|
49
|
+
? "Your sandbox restarted: the files you were handed and your out/ are back; nothing else is."
|
|
50
|
+
: `Your sandbox restarted: the files you were handed are back, but not your out/, which could not be kept (${outputsError}). Nothing else is.`
|
|
51
|
+
}
|