@akanjs/cli 3.1.0-rc.13 → 3.1.0-rc.15
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/.build-stamp +1 -1
- package/guidelines/agentRule/agentRule.instruction.md +22 -7
- package/guidelines/conventions/conventions.instruction.md +6 -2
- package/guidelines/modelStore/modelStore.instruction.md +7 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +2 -0
- package/package.json +2 -2
package/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
0462ae6cd06c1ee2d9d1dfa1d0d7da7a3b795b2312f3094265c359e2ac042d60
|
|
@@ -180,6 +180,14 @@ pages declaring one name never clash, and a registry kept outside the surface re
|
|
|
180
180
|
stores its uploads keeps a map beside the transcript keyed on name and size — the same guess `Attachment.same`
|
|
181
181
|
has to make, and the one that is wrong for two crops of one export. So when both sides carry a `ref`, it *is* the
|
|
182
182
|
answer to "the same file twice", and the heuristic is what is left for when they do not.
|
|
183
|
+
- **A tool hands the model a file with `ToolReturn.attach(result, [attachment])`** (`akanjs/store`), which lands in
|
|
184
|
+
`ToolCallResult.attachments` beside the value — a `result` reaches the model as JSON text, so a URL in it is read
|
|
185
|
+
as letters and base64 as a wall of them. It takes a user attachment's shape and meets the same `accepts` check and
|
|
186
|
+
type allow-list; Anthropic carries it inside the `tool_result`, the chat-completions dialect (whose `tool` message
|
|
187
|
+
holds text alone) in one user message after the turn's tool messages. It is outside the 20,000-character ceiling
|
|
188
|
+
and held to the 4 MB per-file one, and only the latest turn's ride as bytes: an earlier one becomes a note telling
|
|
189
|
+
the model to call the tool again while the picture is on screen, since one picture costs over a thousand tokens on
|
|
190
|
+
every turn it rides.
|
|
183
191
|
- **Speech is one engine contract and the framework's own policy.** `<Agent.Chat voice={engine} />` takes a
|
|
184
192
|
`VoiceEngine` — `listen(handlers)` and `speak(sentence)`, both cancellable — and the chat decides everything
|
|
185
193
|
else: a press-to-talk microphone whose transcript lands in the composer to be corrected, one utterance per
|
|
@@ -398,6 +406,10 @@ pages declaring one name never clash, and a registry kept outside the surface re
|
|
|
398
406
|
renders one editor per row, and at most one of them is ever open, so one name is registered rather than fifty.
|
|
399
407
|
It also means the verb is absent from the catalogue while nothing is open, which is honest — and costs the
|
|
400
408
|
agent nothing, because the catalogue is re-read on the turn that follows the tool call that opened the form.
|
|
409
|
+
- **A shell's `submit<Model>` refuses while an upload is in flight.** `Model.EditModal` (also while its submit is
|
|
410
|
+
disabled) and `Model.ViewEditModal` disable the button and answer `The <model> form is not ready to submit.` while
|
|
411
|
+
`<model>FormUploading` is not empty. That key is read `{ agent: false }`, so the refusal is how an agent learns of
|
|
412
|
+
the upload: call `submit<Model>` again once the file has landed, rather than setting the field a second time.
|
|
401
413
|
|
|
402
414
|
## Forms
|
|
403
415
|
- **A form control publishes its own setter, and reading a form publishes one tool that fills several at once.**
|
|
@@ -614,14 +626,17 @@ pages declaring one name never clash, and a registry kept outside the surface re
|
|
|
614
626
|
row, Tab completing its name, and Escape closing the menu and then, pressed again, the panel.
|
|
615
627
|
|
|
616
628
|
## Built-In Tools
|
|
617
|
-
- The framework publishes
|
|
629
|
+
- The framework publishes six built-ins on every store surface: `navigate` (internal paths only, the same router
|
|
618
630
|
`Link` rides), `goBack` (this session's history — global, because history is not a control a page owns and a page
|
|
619
631
|
that draws no back link is not one you may not leave — a screen that must not be left withholds them with `builtins`,
|
|
620
632
|
not with prose), `readScreen` (the rendered DOM as compact text — headings, links, control values, and `(disabled)`
|
|
621
633
|
on a control or button that has it; the chat's own UI is skipped via `data-agent-ui`, and a password value is never
|
|
622
634
|
read), `readState(key)` (one masked store key — a key that is unknown or that this screen does not read is refused
|
|
623
|
-
*with the keys it can* read, the way `readScreen` names its sections),
|
|
624
|
-
|
|
635
|
+
*with the keys it can* read, the way `readScreen` names its sections), `highlight(target)`, and `viewImage(src)` (one
|
|
636
|
+
`<img>` on screen, redrawn as a JPEG at most 1568px long and attached to the result — `src` must be one this view
|
|
637
|
+
shows, as `readScreen({ images: true })` printed it, so the agent cannot have the browser fetch an address of its
|
|
638
|
+
own, and a `data:` one is refused). Declaring a hook tool under one of those names shadows the built-in, so reuse
|
|
639
|
+
them only to mean that. **There is no general-purpose wait**:
|
|
625
640
|
a built-in one was reachable on every screen and a model spent it on whatever key it liked, parking turns nobody
|
|
626
641
|
asked to park. Waiting belongs to the screen that knows what is worth waiting for — publish an `st.tool` beside the
|
|
627
642
|
control that starts the work, and let it await the work.
|
|
@@ -630,8 +645,8 @@ pages declaring one name never clash, and a registry kept outside the surface re
|
|
|
630
645
|
awaits `ScreenSettle.wait()` — DOM quiescence, bounded, because the client router hands its promise to nobody —
|
|
631
646
|
and the session awaits it after every tool that did not declare `settle: false` before taking the change report.
|
|
632
647
|
Without it the report describes the moment before the change landed and the `readScreen` that follows reads the
|
|
633
|
-
page the user left. The reading built-ins (`readScreen`, `readState`, `highlight`) declare it,
|
|
634
|
-
costs 120ms of quiet at the very least and they change nothing a resource holds.
|
|
648
|
+
page the user left. The reading built-ins (`readScreen`, `readState`, `highlight`, `viewImage`) declare it,
|
|
649
|
+
because a wait costs 120ms of quiet at the very least and they change nothing a resource holds.
|
|
635
650
|
New tools and state from a fresh route are still only listed from the next turn: the catalogue is snapshotted
|
|
636
651
|
when the turn starts.
|
|
637
652
|
- **A tool that waits for its own work costs no model turns; one that returns early costs one round trip per
|
|
@@ -665,8 +680,8 @@ pages declaring one name never clash, and a registry kept outside the surface re
|
|
|
665
680
|
- **An image is always named, and its address rides only when asked for.** `readScreen` prints `[image: <alt>]`,
|
|
666
681
|
and `[image]` for one with no `alt` — dropping the unlabelled one left a card that renders a picture reading
|
|
667
682
|
exactly like a card that renders nothing, and "this page shows no image" is the one answer the screen cannot
|
|
668
|
-
support. `readScreen({ images: true })` appends `(<src>)` to each, for handing one to
|
|
669
|
-
picture; it is off by default because a gallery is one long URL per thumbnail, which is the read's whole budget
|
|
683
|
+
support. `readScreen({ images: true })` appends `(<src>)` to each, for handing one to `viewImage` or another tool
|
|
684
|
+
that takes a picture; it is off by default because a gallery is one long URL per thumbnail, which is the read's whole budget
|
|
670
685
|
spent on the part of the screen it can say the least about. A `data:` URL is never printed — that is the bytes
|
|
671
686
|
themselves rather than somewhere to fetch them.
|
|
672
687
|
- **A screen is only aimable if its names are printed.** `readScreen` writes `(#anchor)` beside a heading that
|
|
@@ -374,8 +374,8 @@ orchestration in `service`, client state in `store`; `Template` is forms, `Unit`
|
|
|
374
374
|
### Calls, Queries, Agents (summaries)
|
|
375
375
|
|
|
376
376
|
- **Wire (`transportRule`)**: a deadline is the endpoint's `{ timeout: <ms> }` (undeclared, the client quits at
|
|
377
|
-
30 s; the handler is not cancelled); `{ cache }` only on a `query` with no internal argument,
|
|
378
|
-
`invalidate(endpoint, args?)` on a plugged `EndpointCacheControl`; `{ rateLimit }` per endpoint,
|
|
377
|
+
30 s; the handler is not cancelled); `{ cache }` only on a `query` with no internal argument, capped at one day,
|
|
378
|
+
dropped early by `invalidate(endpoint, args?)` on a plugged `EndpointCacheControl`; `{ rateLimit }` per endpoint,
|
|
379
379
|
`option.setRateLimit` per app, `plug(RateLimit)` for a business key. `socketId` names a connection, not a caller. A
|
|
380
380
|
device proves itself with a `MachineToken`. Server to server, `fetch.clone({ origin })` opens no socket
|
|
381
381
|
without `connect: true`, retries through `retry`, and rethrows a remote `Err` as is — never wrapped or re-keyed.
|
|
@@ -417,6 +417,10 @@ orchestration in `service`, client state in `store`; `Template` is forms, `Unit`
|
|
|
417
417
|
`plug(StorageAdaptorRole)` · `use<T>()` only for a legacy `option.ts` singleton · `env(...)` for config.
|
|
418
418
|
- `memory(...)` takes a scalar or model class (`memory(Map, { of: CallStateInput })`); never hand-encode JSON into a
|
|
419
419
|
`String` memory.
|
|
420
|
+
- A file your own code stored through `plug(StorageAdaptorRole)` has its disk path at
|
|
421
|
+
`storage.resolveLocalPath?.(path, access)` (`fieldRule`): `null` means refused (answer 404, never fall back to
|
|
422
|
+
`readData()`), `undefined` means the adaptor keeps no local files, and a key that comes from a request passes
|
|
423
|
+
`access: "public"`. A `File` field is not one: `libs/shared` stores it through its own `StorageApi`.
|
|
420
424
|
- **A new adapter is an `adapt()` singleton in `srvkit/`**, injected with `plug(TheClass)`, key `as const`. Never
|
|
421
425
|
register it in `lib/option.ts` (it self-registers); never construct a `Logger` in it (`this.logger` exists);
|
|
422
426
|
lifecycle work in `override async onInit()`. A per-use value object is a plain class. Legacy
|
|
@@ -42,6 +42,13 @@ Generate client state coordination for a module. Store connects generated fetch
|
|
|
42
42
|
- A model whose form holds a large `field.visual` body can pass the 256KB per-draft cap, and a draft over it is
|
|
43
43
|
dropped with a warning rather than truncated.
|
|
44
44
|
|
|
45
|
+
## File Uploads
|
|
46
|
+
- `upload<Field>On<Model>(fileList, idx?)` is generated for every `File` field. `Field.Img` / `Imgs` / `File` /
|
|
47
|
+
`Files` handed the generated `set<Field>On<Model>` upload through it, so do not write an upload action.
|
|
48
|
+
- `<model>FormUploading` holds the uploads in flight per field (`{}` when idle). The generated submit paths save
|
|
49
|
+
nothing until it is empty; a hand-written submit reads `Object.keys(st.use.<model>FormUploading()).length`. Full
|
|
50
|
+
contract: `fieldRule`.
|
|
51
|
+
|
|
45
52
|
## Review Checklist
|
|
46
53
|
- The instruction points to current docs pages, not removed docs routes.
|
|
47
54
|
- Generated examples use current Akan builder APIs and scanner-friendly filenames.
|
|
@@ -571,6 +571,8 @@ akan sync automatically generates APIs across all layers. Only write custom logi
|
|
|
571
571
|
| `[slice]List`, `[slice]InitList`, `[slice]Insight`, `[slice]Selection`, `hasMoreOf[Slice]` | Slice states |
|
|
572
572
|
| `init[Slice](args)`, `refresh[Slice]()`, `setPageOf[Slice](page)`, `loadMoreOf[Slice]()` | Slice actions |
|
|
573
573
|
| `set[Field]On[Model](value)` | Auto-setters for each model field |
|
|
574
|
+
| `upload[Field]On[Model](fileList, idx?)` | Upload into a `File` field, scoped to the form that started it |
|
|
575
|
+
| `[model]FormUploading` | Pending uploads per `File` field (`{}` when idle); submits save nothing until empty |
|
|
574
576
|
|
|
575
577
|
**Rule**: Write custom store actions only for toast messages (`msg.loading`/`msg.success`) or multi-step workflows. State fields and CRUD actions are already auto-generated.
|
|
576
578
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.15",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@earendil-works/pi-tui": "1.3.0",
|
|
40
40
|
"@inquirer/prompts": "^8.7.3",
|
|
41
41
|
"@tailwindcss/node": "^4.3.3",
|
|
42
|
-
"akanjs": "3.1.0-rc.
|
|
42
|
+
"akanjs": "3.1.0-rc.15",
|
|
43
43
|
"chalk": "^6.0.1",
|
|
44
44
|
"commander": "^15.0.0",
|
|
45
45
|
"dayjs": "^1.11.23",
|