@akanjs/cli 3.0.0-beta.0 → 3.0.0-beta.10
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/{abstractCompactor-mjh5ppsq.js → abstractCompactor-gmkc0z8j.js} +2 -1
- package/{agent.command-d2gfxfck.js → agent.command-0q17pnrs.js} +2 -2
- package/{application.command-pj2m7584.js → application.command-18y0s485.js} +3 -3
- package/{cloud.command-jshwdq22.js → cloud.command-av97ndh6.js} +10 -9
- package/cloud.script-cm11xjdz.js +20 -0
- package/{context.command-ez8a0zyz.js → context.command-5v37ef3n.js} +10 -9
- package/{devTui-40ggmd99.js → devTui-m1atgkc9.js} +1 -1
- package/{devTuiView-c08ccbat.js → devTuiView-0hc2emhe.js} +1 -1
- package/{guideline.command-xmqwx8zm.js → guideline.command-4pz9g1rt.js} +3 -2
- package/guidelines/agentRule/agentRule.instruction.md +89 -9
- package/guidelines/conventions/conventions.instruction.md +22 -1
- package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
- package/guidelines/transportRule/transportRule.instruction.md +49 -0
- package/{index-fz5q3gd7.js → index-04bk599g.js} +1 -1
- package/{index-zry5nz81.js → index-2xp0kfkt.js} +22 -13
- package/{index-8pm30m73.js → index-5ystnsd5.js} +5 -5
- package/{index-ws5e0j51.js → index-9077wzd2.js} +1 -1
- package/{index-rwg2aa4f.js → index-a17x49vg.js} +2 -2
- package/{index-4edzf1gr.js → index-d43r08tf.js} +2 -2
- package/{index-7737gxcp.js → index-ffvk10zz.js} +1 -1
- package/{index-ne2qy0nk.js → index-k2j1hc4r.js} +1 -1
- package/index-m0xccmmm.js +228 -0
- package/{index-2hq52jq3.js → index-rtxxan88.js} +24 -18
- package/{index-v0qh106m.js → index-sj5vxr8f.js} +4 -4
- package/{index-kn1h7p1x.js → index-te54x9zm.js} +3 -225
- package/{index-259dsnz3.js → index-vxtad5bd.js} +1 -1
- package/{index-pnqbkf5p.js → index-vyvre9en.js} +1 -1
- package/{index-600zhnve.js → index-y6n8nmny.js} +6 -6
- package/index.js +18 -18
- package/{library.command-nbsky672.js → library.command-qzzbj6d8.js} +2 -2
- package/{localRegistry.command-yeq57wjr.js → localRegistry.command-vyrgg4xw.js} +7 -6
- package/{module.command-29vqzrh8.js → module.command-rq5hq3ax.js} +5 -4
- package/{package.command-axv0abmn.js → package.command-d9hd6v9n.js} +2 -2
- package/package.json +2 -2
- package/{page.command-vs9s3zrh.js → page.command-126d56te.js} +2 -2
- package/{primitive.command-cbxmqbtc.js → primitive.command-taxd1538.js} +6 -5
- package/{quality.command-gmbs7nws.js → quality.command-6gsna0a3.js} +1 -1
- package/{repair.command-bqsjptsj.js → repair.command-tq2dgy72.js} +2 -2
- package/{scalar.command-6k1vhe9s.js → scalar.command-3bcmrrkv.js} +4 -3
- package/{subspace.command-fwjfcts7.js → subspace.command-eddzqpx3.js} +90 -10
- package/{workflow.command-nwpcdc8p.js → workflow.command-gtdnzvbz.js} +8 -7
- package/{workspace.command-8s050m0h.js → workspace.command-06wvstgr.js} +18 -17
- package/{index-mak3cd28.js → index-0g7r8xz3.js} +24 -24
package/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
248a5d65f363fd5a27c6caa9355adca9158d40d43304e82483ed913ef597f0ac
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Workspace,
|
|
4
4
|
command
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-0g7r8xz3.js";
|
|
6
6
|
import"./index-q0y2jq9j.js";
|
|
7
7
|
import"./index-2tv3fdx4.js";
|
|
8
8
|
import"./index-6wwzs1bc.js";
|
|
@@ -12,7 +12,7 @@ import"./index-ktb5njgy.js";
|
|
|
12
12
|
import"./index-h7yw2z9n.js";
|
|
13
13
|
import {
|
|
14
14
|
AgentScript
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-k2j1hc4r.js";
|
|
16
16
|
|
|
17
17
|
// pkgs/@akanjs/cli/agent/agent.command.ts
|
|
18
18
|
class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
Exec,
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-0g7r8xz3.js";
|
|
10
10
|
import"./index-q0y2jq9j.js";
|
|
11
11
|
import"./index-2tv3fdx4.js";
|
|
12
12
|
import"./index-6wwzs1bc.js";
|
|
13
13
|
import {
|
|
14
14
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-
|
|
15
|
+
} from "./index-sj5vxr8f.js";
|
|
16
|
+
import"./index-vxtad5bd.js";
|
|
17
17
|
import"./index-hwkygn9s.js";
|
|
18
18
|
import {
|
|
19
19
|
AbstractDoc
|
|
@@ -2,29 +2,30 @@
|
|
|
2
2
|
import"./index-q0y2jq9j.js";
|
|
3
3
|
import {
|
|
4
4
|
GlobalConfig
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-m0xccmmm.js";
|
|
6
6
|
import {
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-0g7r8xz3.js";
|
|
10
10
|
import"./index-2tv3fdx4.js";
|
|
11
11
|
import"./index-6wwzs1bc.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
import"./index-te54x9zm.js";
|
|
13
|
+
import"./index-sj5vxr8f.js";
|
|
14
|
+
import"./index-vxtad5bd.js";
|
|
14
15
|
import"./index-hwkygn9s.js";
|
|
15
16
|
import"./index-kcxmv48c.js";
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-9077wzd2.js";
|
|
18
|
+
import"./index-rtxxan88.js";
|
|
18
19
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./index-
|
|
20
|
+
CloudScript2
|
|
21
|
+
} from "./index-2xp0kfkt.js";
|
|
21
22
|
import"./index-j9yhg404.js";
|
|
22
23
|
|
|
23
24
|
// pkgs/@akanjs/cli/cloud/cloud.command.ts
|
|
24
25
|
var localRegistryUrl = () => process.env.AKAN_NPM_REGISTRY ?? "http://127.0.0.1:4873";
|
|
25
26
|
var resolveRegistryUrl = (registry) => registry === "local" ? localRegistryUrl() : undefined;
|
|
26
27
|
|
|
27
|
-
class CloudCommand extends command("cloud", [
|
|
28
|
+
class CloudCommand extends command("cloud", [CloudScript2], ({ public: target }) => ({
|
|
28
29
|
login: target({ desc: "Login to Akan Cloud services" }).option("host", String, { desc: "host of the cloud", default: GlobalConfig.akanCloudHost }).with(Workspace).exec(async function(host, workspace) {
|
|
29
30
|
await this.cloudScript.login(workspace, host);
|
|
30
31
|
}),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
CloudScript2
|
|
4
|
+
} from "./index-2xp0kfkt.js";
|
|
5
|
+
import"./index-rtxxan88.js";
|
|
6
|
+
import"./index-sj5vxr8f.js";
|
|
7
|
+
import"./index-j9yhg404.js";
|
|
8
|
+
import"./index-vxtad5bd.js";
|
|
9
|
+
import"./index-9077wzd2.js";
|
|
10
|
+
import"./index-te54x9zm.js";
|
|
11
|
+
import"./index-m0xccmmm.js";
|
|
12
|
+
import"./index-0g7r8xz3.js";
|
|
13
|
+
import"./index-hwkygn9s.js";
|
|
14
|
+
import"./index-2tv3fdx4.js";
|
|
15
|
+
import"./index-6wwzs1bc.js";
|
|
16
|
+
import"./index-kcxmv48c.js";
|
|
17
|
+
import"./index-q0y2jq9j.js";
|
|
18
|
+
export {
|
|
19
|
+
CloudScript2 as CloudScript
|
|
20
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Workspace,
|
|
4
4
|
command
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-0g7r8xz3.js";
|
|
6
6
|
import"./index-q0y2jq9j.js";
|
|
7
7
|
import"./index-2tv3fdx4.js";
|
|
8
8
|
import"./index-6wwzs1bc.js";
|
|
@@ -11,16 +11,17 @@ import"./index-gyd220p2.js";
|
|
|
11
11
|
import"./index-ktb5njgy.js";
|
|
12
12
|
import {
|
|
13
13
|
ContextScript
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-y6n8nmny.js";
|
|
15
15
|
import"./index-wt7qrtd4.js";
|
|
16
16
|
import"./index-h7yw2z9n.js";
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
17
|
+
import"./index-04bk599g.js";
|
|
18
|
+
import"./index-ffvk10zz.js";
|
|
19
|
+
import"./index-m0xccmmm.js";
|
|
20
|
+
import"./index-te54x9zm.js";
|
|
21
|
+
import"./index-5ystnsd5.js";
|
|
22
|
+
import"./index-vyvre9en.js";
|
|
23
|
+
import"./index-d43r08tf.js";
|
|
24
|
+
import"./index-a17x49vg.js";
|
|
24
25
|
|
|
25
26
|
// pkgs/@akanjs/cli/context/context.command.ts
|
|
26
27
|
class ContextCommand extends command("context", [ContextScript], ({ public: target }) => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// pkgs/@akanjs/cli/application/devTuiView.ts
|
|
3
3
|
var createDevTuiView = async (supervisor) => {
|
|
4
|
-
const { DevTui } = await import("./devTui-
|
|
4
|
+
const { DevTui } = await import("./devTui-m1atgkc9.js");
|
|
5
5
|
return new DevTui(supervisor);
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
runner,
|
|
5
5
|
script,
|
|
6
6
|
command
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-0g7r8xz3.js";
|
|
8
8
|
import {
|
|
9
9
|
FileSys
|
|
10
10
|
} from "./index-q0y2jq9j.js";
|
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
Prompter
|
|
17
17
|
} from "./index-h7yw2z9n.js";
|
|
18
|
+
import"./index-m0xccmmm.js";
|
|
18
19
|
import {
|
|
19
20
|
AiSession
|
|
20
|
-
} from "./index-
|
|
21
|
+
} from "./index-te54x9zm.js";
|
|
21
22
|
|
|
22
23
|
// pkgs/@akanjs/cli/guideline/guideline.script.ts
|
|
23
24
|
import { Logger } from "akanjs/common";
|
|
@@ -45,10 +45,16 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
45
45
|
clear and close. `chrome={false}` drops the header bar whole, for an `inline` chat inside a panel the app
|
|
46
46
|
already titles, and `defaultDraft` opens the composer with text in it without sending it. A panel driven by a
|
|
47
47
|
controlled `open` with **no** `onOpenChange` draws no close button at all rather than an inert one. Then the
|
|
48
|
-
slots: `AgentLauncher`, `AgentBubble`, `AgentComposer`, `AgentApproval`,
|
|
48
|
+
slots: `AgentLauncher`, `AgentSteps`, `AgentBubble`, `AgentComposer`, `AgentApproval`,
|
|
49
49
|
`AgentQuestion`, `AgentQueued`, `AgentMenu`, `AgentMarkdown` and `AgentCode` each replace one part in `_overrides.tsx`, and
|
|
50
50
|
`akanjs/ui` exports every default beside them (`DefaultBubble`, `DefaultComposer`, …) so a skin composes the
|
|
51
|
-
one it is replacing. `
|
|
51
|
+
one it is replacing. **`AgentSteps` is one agent turn** — the messages between the user message that opened it
|
|
52
|
+
and the next one, with `isRunning` saying whether more are still coming — which is the grain a chat needs to
|
|
53
|
+
fold a turn's steps into a `details` and stand its answer outside them. It is the one boundary a per-message
|
|
54
|
+
slot cannot see, since neither message on either side of it knows it is at an edge. The default draws the turn's
|
|
55
|
+
messages flat into a Fragment, so a chat that binds nothing renders exactly what it did before the slot existed. The attachment row is exported on its own as `AgentAttachments`, because a replaced
|
|
56
|
+
`AgentBubble` that redraws it by hand forks the rule for which carrier is shown how — and then keeps whatever
|
|
57
|
+
that rule was on the day it was copied. `AgentCode` is where a highlighter binds — the fence's language reaches it — and a
|
|
52
58
|
replacement for `AgentBubble` carries its own `memo`, since the transcript re-renders on every delta. Only then
|
|
53
59
|
`AgentChat`, which replaces the panel whole: it also replaces the slash commands, the compaction notice and the
|
|
54
60
|
approval gate, so reach for it when the *layout* differs, not when the look does.
|
|
@@ -72,9 +78,22 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
72
78
|
fills whichever adaptor holds `LlmAdaptorRole`, reaching it as the `llmOption` use. The settings are the role's
|
|
73
79
|
rather than one provider's, so they survive a swap. **DeepSeek is the built-in default** (`deepseek-v4-flash` at
|
|
74
80
|
`https://api.deepseek.com`); with no `apiKey` the app still boots and the chat answers `llmUnavailable`. Swap
|
|
75
|
-
providers the way middleware is applied: `option.applyAdaptor(LlmAdaptorRole,
|
|
76
|
-
|
|
77
|
-
`onDelta`
|
|
81
|
+
providers the way middleware is applied: `option.applyAdaptor(LlmAdaptorRole, AnthropicLlm)`. An app may still
|
|
82
|
+
write its own — an `adapt()` class in a `srvkit/` implementing `LlmAdaptor.chat(request, onDelta?)`, where
|
|
83
|
+
ignoring `onDelta` still answers whole — but for vision it no longer has to.
|
|
84
|
+
- **Three providers ship, and only two of them read a picture.** `DeepseekLlm` is the default and declares no
|
|
85
|
+
`accepts`, which is a fact about its API rather than a gap. `OpenaiLlm` speaks the same chat-completions dialect
|
|
86
|
+
— `OpenaiDialect`, shared between them so a protocol fix lands once — against `https://api.openai.com/v1` and
|
|
87
|
+
declares `{ image: true }`, sending an image as a content part. `AnthropicLlm` is the Messages API and declares
|
|
88
|
+
`{ image: true, document: true }`; it is its own file rather than a branch, because the system prompt is a field
|
|
89
|
+
and not a message, tool calls and results are content blocks, the results ride in a *user* turn, roles must
|
|
90
|
+
alternate — so two wire turns that map to one role are merged — and `max_tokens` is required. **Both new ones
|
|
91
|
+
require `model`**: a default would age into a 404, and worse, it would decide the vision claim for the app.
|
|
92
|
+
- **`accepts` is answered per model, through `option.setLlm({ accepts })`.** An adaptor answers for an API and one
|
|
93
|
+
API serves models that differ, so the override rides beside the `model` it is a fact about. It is not a table
|
|
94
|
+
the framework keeps: a table is a claim about models that ship after it, and getting this wrong is the worst
|
|
95
|
+
failure available — a provider handed bytes it cannot decode either refuses the turn or accepts it having seen
|
|
96
|
+
nothing, and the model then answers confidently about a file it never read.
|
|
78
97
|
- **An adaptor answers `null` for "not configured" and *throws* for a refusal it can explain.** The two are
|
|
79
98
|
different things to be told: collapsing both into `null`, the way the adapter convention otherwise reads, left a
|
|
80
99
|
user reading `llmUnavailable` — "no model is configured" — about a conversation that had merely outgrown the
|
|
@@ -92,10 +111,14 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
92
111
|
prompt. **What the provider cannot read is replaced by a note naming the file**, never dropped: an attachment the
|
|
93
112
|
model never saw is one it answers about from the filename. An adaptor declares `accepts: { image, document }` and
|
|
94
113
|
`AgentService.readable` degrades the rest, so a text-only provider needs no attachment code at all — DeepSeek
|
|
95
|
-
declares none, which is why an image against the default provider is refused out loud while an extracted PDF
|
|
96
|
-
works, `text` being readable by every model there is.
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
declares none, which is why an image against the *default* provider is refused out loud while an extracted PDF
|
|
115
|
+
works, `text` being readable by every model there is. Swap in `OpenaiLlm` or `AnthropicLlm` and the same image
|
|
116
|
+
arrives as an image. `accepts.document` is one boolean over every non-image type, so an adaptor whose API has a
|
|
117
|
+
block for only some of them — Anthropic's `document` is PDF and nothing else — names the rest in the text rather
|
|
118
|
+
than dropping them, which is the wire's own rule applied at the one layer that knows which blocks exist. Persisting keeps each
|
|
119
|
+
attachment's name, type, address and `ref` and drops only its content: web storage is a few megabytes, one
|
|
120
|
+
screenshot fills a chunk of it, and a save that fails is silent — so keeping the bytes would quietly stop keeping
|
|
121
|
+
the transcript, while an id is the handle a restored conversation has left to find the file with.
|
|
99
122
|
**The ceilings are the message's, not the file's**: 4 MB per file, 8 MB and five files per message, and the same
|
|
100
123
|
file twice is refused by name. The bytes ride inside one turn's JSON, so what a provider refuses is the sum —
|
|
101
124
|
and a request that cannot be sent is one the user has to empty the composer to escape, which is why the refusal
|
|
@@ -105,6 +128,26 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
105
128
|
reader produced**, not on the file that was picked: a reader that uploads and answers a `url` has already paid
|
|
106
129
|
what the ceiling exists for, so refusing its 6 MB photo would refuse it for a cost it does not incur. Only the
|
|
107
130
|
built-in path checks the source size, and there the file itself is the carrier.
|
|
131
|
+
- **An app may also build attachments itself and hand them to `session.send([{ role: "user", text, attachments }])`**,
|
|
132
|
+
which is why `MessageAttachment` is exported from `akanjs/ui` — the composer's path is typed by the `AttachReader`
|
|
133
|
+
callback, that one is not, and an object assembled with no nameable type is the one that gets a field wrong.
|
|
134
|
+
Nothing downstream trusts the result: an attachment whose `mimeType` is not a string is noted like any other
|
|
135
|
+
unreadable one, and its chip renders its name with no preview, because the host wrote the object and the declared
|
|
136
|
+
type is a claim rather than a check. A field that arrives wrong costs that attachment, never the turn.
|
|
137
|
+
- **A `url` carrier is an address the *provider* fetches, and bytes beside it win.** A reader that uploads answers
|
|
138
|
+
`{ url }` when its storage is publicly reachable, and `{ data }` — or both — when it is not: an attachment
|
|
139
|
+
carrying both is read from its bytes and displayed from its address, so the chip draws a thumbnail and the model
|
|
140
|
+
still gets the picture. That precedence exists because the other order fails the one way nothing reports: the
|
|
141
|
+
default storage backend serves a path only the app can resolve, the adaptor would hand it over as written, and
|
|
142
|
+
the model answers about a picture it never saw. Send a provider-reachable URL **alone** — paired with bytes it
|
|
143
|
+
costs the provider hop whatever the bytes weigh, for a fetch the provider would have done itself.
|
|
144
|
+
- **An image type the provider has no block for is refused at the adaptor, not upstream.** `accepts.image` is one
|
|
145
|
+
boolean, so `AgentService.readable` passes every `image/*` through, and the built-in composer reader base64s
|
|
146
|
+
every `image/*` as well — an `AttachReader` answering `null` means "not mine" and falls through to it, so an app
|
|
147
|
+
cannot gate one either. Both shipped vision adaptors therefore match an exact set (`jpeg`, `png`, `gif`, `webp`)
|
|
148
|
+
and name the rest in the text. It matters because an unsupported type is not one unread attachment: it is a
|
|
149
|
+
block the API refuses, so the **whole turn** dies on a vendor 400 — and `image/heic`, the iPhone camera default,
|
|
150
|
+
is the likeliest one an app meets.
|
|
108
151
|
- **`MessageAttachment.ref` is the host's own handle on the file — carried, never read.** A file id, a storage key,
|
|
109
152
|
whatever turns the attachment back into something a tool can be handed. The framework only moves it: the model is
|
|
110
153
|
never shown one, and a tool the app publishes (`useFileFieldTool` below) is what spends it. Without it a host that
|
|
@@ -125,6 +168,43 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
125
168
|
WebView, **which has neither on Android or iOS**, so a `speech.plugin.ts` declares the permission and
|
|
126
169
|
the packages the native build needs. An engine answering `available()` false renders no microphone at all,
|
|
127
170
|
the same rule as publishing no tool for a control the screen does not draw.
|
|
171
|
+
- **Data the user points at rides the message too, as `references` — and its value is a snapshot.** A file is
|
|
172
|
+
something they handed over; a reference is something they pointed at while asking, so it belongs in the same
|
|
173
|
+
place and for the same reason. Screen context does not do this job: `ContextBlock`s are rebuilt from the screen
|
|
174
|
+
every turn, so what was named three turns ago is simply not in the conversation any more. A `MessageReference`
|
|
175
|
+
carries the host's own `refName`, the id, a label, an optional dotted `path` into the document, and the `value`
|
|
176
|
+
those resolved to. **The value is never re-read on a later turn**, which is the point: re-reading rewrites what
|
|
177
|
+
the person was looking at when they spoke, and the usual next thing the agent does is edit the very field it was
|
|
178
|
+
pointed at — leaving a live reference showing the result with no record of what it was changed from.
|
|
179
|
+
`refName`/`refId`/`path` travel so a tool can read the current value when the answer needs it, and
|
|
180
|
+
`AgentService.referenced` folds the whole lot into the message text in one place, so every provider carries a
|
|
181
|
+
reference without either adaptor knowing the word. **The value is masked on the way in and nowhere else**: masking
|
|
182
|
+
needs the model class, which no wire carries, so the model a host names when it stages the reference is the whole
|
|
183
|
+
of the decision about what leaves the browser — name the class that actually holds the field, because a `Light`
|
|
184
|
+
one usually does not. **The ceiling is 20,000 characters per reference**, applied as it is staged and again on
|
|
185
|
+
the server; a reference is bulkier than a tool result and outlives one, riding every later turn and being the last
|
|
186
|
+
thing compaction folds. Persisting keeps the pointer and drops the value with a note saying so, which is a better
|
|
187
|
+
restored state than an attachment can offer — the pointer is still live, so the answer is to read it again.
|
|
188
|
+
Staging lives on the **session** (`stage` / `staged` / `unstage(key)` / `clearStaged()`), not on the composer where
|
|
189
|
+
staged files live, because a reference comes from whichever component drew the data rather than from the paperclip;
|
|
190
|
+
`unstage` is keyed on `refName/refId#path` because what orders a message's references is its text, not that list.
|
|
191
|
+
- **Two ways to point at data, and which one depends on who knows the value.** `<Agent.Chat reference={[…]} />`
|
|
192
|
+
takes one `ReferenceSource` per kind of document — `refName`, a `type`, the app's own `search`, and a `resolve` —
|
|
193
|
+
and the composer's `@` menu offers whole documents from them; the token is written the moment a row is picked and
|
|
194
|
+
the value is staged when `resolve` lands, so a slow fetch never freezes the menu and one that fails leaves a
|
|
195
|
+
pointer that reads as *go and read it*. For a field *inside* a document, the component drawing it calls
|
|
196
|
+
`useAgentReference()` — it already holds the value, so there is no round trip, and it is the only thing that
|
|
197
|
+
knows a rich-text field stored as `field(Any)` reads as a paragraph rather than as the editor document it is. The
|
|
198
|
+
hook no-ops with a warning outside a session, the same call `AgentValue.publishable` makes: a card carrying a
|
|
199
|
+
reference button must not cost a route its render.
|
|
200
|
+
- **The token in the draft is what carries a reference, and the chip only draws it.** Deleting
|
|
201
|
+
`@[label](mention:refName/id#path)` by hand drops the reference exactly as removing the chip does — removing the
|
|
202
|
+
chip removes the token — so the two can never disagree, and nothing re-derives a value from text somebody edited.
|
|
203
|
+
A token pasted out of an earlier message travels as a pointer with a note, which is the same shape a restored
|
|
204
|
+
conversation produces. Staged references are the **session's**, not the composer's, because `useAgentReference`
|
|
205
|
+
is called from components the composer cannot see; writing the token is the composer's half, and `refer` warns
|
|
206
|
+
rather than staging silently when no chat is mounted on that session — the case where a card sits outside the
|
|
207
|
+
`<Agent.Zone>` its chat is inside.
|
|
128
208
|
- **`attach` and `voice` both carry functions, so a server layout cannot pass either.** A closure does not cross
|
|
129
209
|
the RSC boundary — `non-scalar-props-restricted` says so on `page/**` — so an app that wants either mounts the
|
|
130
210
|
chat from a small client component in the app's own `ui/` that calls the hook.
|
|
@@ -464,6 +464,24 @@ Full contract — credential handshake, room revalidation, socket cleanup scopin
|
|
|
464
464
|
- **A cleanup registered with `ws.on("disconnect" | "unsubscribe", fn)` is scoped to the call that registered it**
|
|
465
465
|
— a room for a `pubsub` subscribe, the socket for a `message` handler. Cleanup that must happen either way
|
|
466
466
|
registers for both.
|
|
467
|
+
- **A call's deadline is the endpoint's `{ timeout: <ms> }`, and there is nowhere else to put one.** It bounds
|
|
468
|
+
both ends: the `Timeout` middleware — registered by default, and standing aside for every endpoint that
|
|
469
|
+
declares none — rejects the call with `base.error.gatewayTimeout`, and the same value is serialized to the
|
|
470
|
+
client as that call's request budget. Declared nowhere, a call takes the client's own default of **30
|
|
471
|
+
seconds**, so an endpoint whose real work runs longer (provisioning, a firmware flow, an external
|
|
472
|
+
orchestration) has to declare one or it dies mid-flight with a transport error that does not say whether the
|
|
473
|
+
server ever received it. A caller overrides it per call with `fetch.x(…, { timeout })` — `false` waits as long
|
|
474
|
+
as the runtime will — and an app moves its own default with `fetch.instance.setTimeout(ms)`. An upload is
|
|
475
|
+
never bounded. **Losing the race does not cancel the work**: the handler runs to completion with nobody
|
|
476
|
+
holding its result, so a deadline is an answer to the caller, not an undo.
|
|
477
|
+
- **A cached answer is the endpoint's `{ cache: <ms> }`, and only a `query` taking no internal argument may have
|
|
478
|
+
one.** The `Cache` middleware is registered by default and stands aside for every endpoint that declares
|
|
479
|
+
nothing. Internal arguments are how a call learns who is asking (`.with(Self)`), so an endpoint that has them
|
|
480
|
+
answers per caller and one shared entry would be one caller's answer handed to the next — that endpoint and
|
|
481
|
+
every `mutation` are named in the log and left uncached. Guards run on every hit; what is cached is the
|
|
482
|
+
handler's result, so `resolveReturn` still masks fields and resolves relations per call; a cache backend that
|
|
483
|
+
is down is warned about and the call runs uncached. The default chain is `Logging → Timeout → Cache → handler`,
|
|
484
|
+
and there is no `Retry` middleware.
|
|
467
485
|
|
|
468
486
|
### Authorization Defaults
|
|
469
487
|
|
|
@@ -696,7 +714,9 @@ what every developer must know even when not building one.
|
|
|
696
714
|
every tool runs in the caller's own browser session, gated by guards and the approval card. Its guard is
|
|
697
715
|
`AgentRelayAccess`, which refuses every call until the app names a guard of its own —
|
|
698
716
|
`option.setAgentAccess(SignedIn)`. **The LLM is configured in `option.ts`, never through the environment**
|
|
699
|
-
(`option.setLlm({ apiKey, model, host })`).
|
|
717
|
+
(`option.setLlm({ apiKey, model, host })`). Three providers ship — `DeepseekLlm` (the default, text only),
|
|
718
|
+
`OpenaiLlm` and `AnthropicLlm` (both read images) — and swapping one in is
|
|
719
|
+
`option.applyAdaptor(LlmAdaptorRole, AnthropicLlm)`.
|
|
700
720
|
- **Declare the tool beside the control that already does it**, never as a separate surface:
|
|
701
721
|
`st.tool("x").desc("…").arg("id", ID).exec(fn)` returns the callable to hand to `onClick` — one handler for the
|
|
702
722
|
person and the agent. Publish it only where the screen already renders the control; a falsy name declares the
|
|
@@ -725,6 +745,7 @@ what every developer must know even when not building one.
|
|
|
725
745
|
- Put display and predicate logic on the `Light<Model>` class rather than in a util module — see Module File Playbook.
|
|
726
746
|
- Defaults are a literal for scalars and a thunk for anything constructed. Arrays are `field([T])`; optional is the postfix `.optional()`.
|
|
727
747
|
- **`field.visual(T)` is a field the page renders and an agent never sees** — a blur placeholder, a rendered HTML body, a serialized geometry. It stays an ordinary stored `property` (persistence, search, forms and the page response untouched) and is stripped wherever a value is masked for an AI caller: every in-page-agent read and every MCP result, along with the MCP readable schema. Unlike `hidden`/`secret` it is cost, not secrecy — nothing is refused over one. Reach for it whenever a field is bulky and useless to a model; that is cheaper than every tool learning to avoid it.
|
|
748
|
+
- **A `field.hidden` / `field.secret` value reads `null` on the client, and the type still declares it.** `SignalContext.resolveReturn` skips both field types while it builds an endpoint's response, and hydration writes `null` over the key rather than leaving it absent — the first branch of the loop in `constant/getDefault.ts`, ahead of the field's own default. So the value is a deliberate `null` behind a type promising a `string`, every use of it typechecks, and the failure lands wherever it is finally dereferenced instead of where it was read. **Guard with `??` or `== null`**: `=== undefined`, a destructuring default and an optional parameter default all catch only a missing key and sail straight past this one. A projection (`pickById(id, { secret: true })`) widens the *server's* read, never the response. If a screen needs the value, the field is neither hidden nor secret; if it only needs to be cheap for a model rather than unseen, that is `field.visual`.
|
|
728
749
|
|
|
729
750
|
### Scalar & Field Type Reference
|
|
730
751
|
|
|
@@ -9,6 +9,7 @@ Use this whenever generating constants or scalar constants. It defines the curre
|
|
|
9
9
|
- `field(Type).optional()` marks a nullable or optional business value when absence is valid.
|
|
10
10
|
- `field.hidden(Type).optional()` is for internal state that should not be treated as a normal public field.
|
|
11
11
|
- `field.secret(Type).optional()` is for sensitive values that should not be selected by default.
|
|
12
|
+
- Neither survives an endpoint response: both are stripped on the way out and hydration writes `null` over the key, while the generated type still declares the field — so a client holds a deliberate `null` behind a type that promises a value, and only `??` / `== null` catch it. A field a browser has to read is neither.
|
|
12
13
|
- `field([Type])` defines arrays; provide empty array defaults when the app expects list operations.
|
|
13
14
|
|
|
14
15
|
## Current Akan Patterns
|
|
@@ -28,6 +28,55 @@ mutation is mounted under. `conventions` carries the invariants — this is the
|
|
|
28
28
|
neither again, and cleanup that must happen either way registers for both. From a `message` handler it belongs to
|
|
29
29
|
the socket and runs at close. A handler that throws is logged and never blocks the rest of the teardown.
|
|
30
30
|
|
|
31
|
+
## Request Deadlines
|
|
32
|
+
|
|
33
|
+
- **`{ timeout: <ms> }` in an endpoint's signal option is the whole configuration surface**, and it reaches both
|
|
34
|
+
ends of the call. Server side, the `Timeout` middleware races the handler against it and answers
|
|
35
|
+
`base.error.gatewayTimeout` (504) once it is spent. Client side, `FetchSerializer` ships the value on the
|
|
36
|
+
serialized endpoint and `fetch.<endpoint>()` uses it as that request's `AbortSignal.timeout` budget, so the
|
|
37
|
+
browser does not abandon a call the server is still allowed to be working on.
|
|
38
|
+
- **The middleware is registered by default and has no default of its own.** An endpoint that declares no
|
|
39
|
+
`timeout` is passed straight through — a default here would put a deadline on every endpoint in the app that
|
|
40
|
+
nobody asked for, which is why the middleware used to be opt-in and, being opt-in, made the declared value
|
|
41
|
+
dead. It clears its timer in a `finally`: the race's loser is a pending timer per call otherwise, and with a
|
|
42
|
+
five-minute budget that is a five-minute hold on the event loop for a call that answered in a millisecond.
|
|
43
|
+
- **Without a declaration the client's own default applies — 30 seconds** (`DEFAULT_TIMEOUT_MS`,
|
|
44
|
+
`fetch/client/httpClient.ts`), and the server imposes nothing. Nothing else bounds a request: `Bun.serve` runs
|
|
45
|
+
with `idleTimeout: 0`, so a long call is only ever ended by one of these two.
|
|
46
|
+
- **Precedence is caller, then endpoint, then client default.** `fetch.x(…, { timeout: 5_000 })` overrides what
|
|
47
|
+
the endpoint declared; `{ timeout: false }` waits as long as the runtime will. An app moves its own default
|
|
48
|
+
with `fetch.instance.setTimeout(ms)` — `lib/useClient.ts` is generated, so the `timeout` option on
|
|
49
|
+
`FetchClient.build` belongs to the template that writes it, not to app code.
|
|
50
|
+
- **A file upload is never bounded**, on any of those paths: a large body on a slow uplink is a request that is
|
|
51
|
+
working, and the request body is the only thing the client can tell that from.
|
|
52
|
+
- **The deadline answers the caller; it does not undo the call.** `Promise.race` cannot cancel `next()`, so a
|
|
53
|
+
handler that timed out keeps running and keeps writing. Reach for a `timeout` to bound what a *caller* waits
|
|
54
|
+
for, not to bound an effect — an operation that must not half-happen needs its own idempotency or compensation.
|
|
55
|
+
- The failure is the same `base.error.gatewayTimeout` key whichever side gave up, so the user reads one sentence
|
|
56
|
+
in their own language either way. What differs is the status code — 504 from the server's middleware, 408 from
|
|
57
|
+
the client's own abort — and nothing downstream branches on that.
|
|
58
|
+
|
|
59
|
+
## Cached Answers
|
|
60
|
+
|
|
61
|
+
- **`{ cache: <ms> }` in an endpoint's signal option is the whole cache surface.** The `Cache` middleware is
|
|
62
|
+
registered by default and stands aside unless an endpoint declares one — it used to be opt-in and to ignore the
|
|
63
|
+
declared value for a hard-coded 60 seconds, which is the same shape the `timeout` bug had.
|
|
64
|
+
- **Only a `query` that takes no internal argument may carry one.** The handler's inputs are its declared
|
|
65
|
+
arguments plus its internal ones, so an endpoint with none of the latter answers the same thing to everyone who
|
|
66
|
+
may read it — which is the only answer a shared entry can hold. An endpoint that takes `.with(Self)` answers
|
|
67
|
+
per caller, and one entry would be one caller's answer handed to the next; that endpoint and every `mutation`
|
|
68
|
+
are named once in the log and left uncached rather than silently ignored.
|
|
69
|
+
- **The guards run on every hit.** A cache hit skips `next()`, and `next()` is what runs them, so the middleware
|
|
70
|
+
calls `context.checkGuards()` itself before handing the entry over. Shared is not public.
|
|
71
|
+
- **The entry is the handler's result, not the response.** The middleware wraps execution, so `resolveReturn`
|
|
72
|
+
still runs per call on the cached value — field masking, `hidden`/`secret` stripping and relation resolution are
|
|
73
|
+
never cached, and a relation still costs its own load. The cache saves the handler, not the serialization.
|
|
74
|
+
- **A cache backend that is down does not take the endpoint down.** A failed read is warned and the call runs
|
|
75
|
+
uncached; a failed write is warned and dropped.
|
|
76
|
+
- The default middleware chain is `Logging → Timeout → Cache → handler`: a hung cache backend is bounded by the
|
|
77
|
+
same deadline as the handler it stands in for. **`Retry` was removed** — an automatic re-run of an endpoint
|
|
78
|
+
whose failure it cannot classify replays whatever the first attempt already did.
|
|
79
|
+
|
|
31
80
|
## Binary Pubsub
|
|
32
81
|
|
|
33
82
|
- **`pubsub(Binary)` sends its payload in a websocket binary frame**, skipping the JSON `{ type: "pub" }`
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./index-ktb5njgy.js";
|
|
12
12
|
import {
|
|
13
13
|
runner
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-0g7r8xz3.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/repair/repair.runner.ts
|
|
17
17
|
var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
GlobalConfig,
|
|
4
|
-
CloudApi
|
|
5
|
-
|
|
6
|
-
} from "./index-kn1h7p1x.js";
|
|
4
|
+
CloudApi
|
|
5
|
+
} from "./index-m0xccmmm.js";
|
|
7
6
|
import {
|
|
8
7
|
PkgExecutor
|
|
9
8
|
} from "./index-2tv3fdx4.js";
|
|
9
|
+
import {
|
|
10
|
+
AiSession
|
|
11
|
+
} from "./index-te54x9zm.js";
|
|
10
12
|
import {
|
|
11
13
|
script
|
|
12
|
-
} from "./index-
|
|
14
|
+
} from "./index-0g7r8xz3.js";
|
|
13
15
|
import {
|
|
14
16
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
17
|
+
} from "./index-sj5vxr8f.js";
|
|
16
18
|
import {
|
|
17
19
|
PackageScript
|
|
18
|
-
} from "./index-
|
|
20
|
+
} from "./index-9077wzd2.js";
|
|
19
21
|
import {
|
|
20
22
|
CloudRunner
|
|
21
|
-
} from "./index-
|
|
23
|
+
} from "./index-rtxxan88.js";
|
|
22
24
|
|
|
23
25
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
24
26
|
import { Logger } from "akanjs/common";
|
|
25
|
-
class
|
|
27
|
+
class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, PackageScript]) {
|
|
26
28
|
async login(workspace, host = GlobalConfig.akanCloudHost) {
|
|
27
29
|
await this.cloudRunner.login(host, workspace);
|
|
28
30
|
}
|
|
@@ -48,16 +50,23 @@ class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, Packa
|
|
|
48
50
|
}
|
|
49
51
|
await this.cloudRunner.downloadEnvByScp(workspace);
|
|
50
52
|
}
|
|
51
|
-
async uploadEnv(workspace, {
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
async uploadEnv(workspace, {
|
|
54
|
+
host = GlobalConfig.akanCloudHost,
|
|
55
|
+
workspaceId = workspace.getWorkspaceId({ allowEmpty: true }),
|
|
56
|
+
scope,
|
|
57
|
+
archivePath
|
|
58
|
+
} = {}) {
|
|
59
|
+
if (scope && !workspaceId)
|
|
60
|
+
throw new Error("A scoped env upload needs a cloud workspace id \u2014 the scp target is workspace-wide.");
|
|
61
|
+
const { files, path } = await this.cloudRunner.gatherEnvFiles(workspace, { scope, archivePath });
|
|
54
62
|
if (workspaceId) {
|
|
55
63
|
await this.login(workspace, host);
|
|
56
64
|
const cloudApi = await CloudApi.fromHost(workspace, host);
|
|
57
65
|
await this.cloudRunner.uploadEnv(cloudApi, workspaceId, path);
|
|
58
|
-
return;
|
|
66
|
+
return { workspaceId, files };
|
|
59
67
|
}
|
|
60
68
|
await this.cloudRunner.uploadEnvByScp(workspace, path);
|
|
69
|
+
return { workspaceId: null, files };
|
|
61
70
|
}
|
|
62
71
|
async deployAkan(workspace, { test = true, registryUrl } = {}) {
|
|
63
72
|
const akanPkgs = await this.cloudRunner.getAkanPkgs(workspace);
|
|
@@ -80,4 +89,4 @@ class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, Packa
|
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
export {
|
|
92
|
+
export { CloudScript2 };
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
FileSys
|
|
4
4
|
} from "./index-q0y2jq9j.js";
|
|
5
|
-
import {
|
|
6
|
-
AiSession
|
|
7
|
-
} from "./index-kn1h7p1x.js";
|
|
8
5
|
import {
|
|
9
6
|
ModuleExecutor
|
|
10
7
|
} from "./index-2tv3fdx4.js";
|
|
8
|
+
import {
|
|
9
|
+
AiSession
|
|
10
|
+
} from "./index-te54x9zm.js";
|
|
11
11
|
import {
|
|
12
12
|
runner,
|
|
13
13
|
script
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-0g7r8xz3.js";
|
|
15
15
|
import {
|
|
16
16
|
sourceFile,
|
|
17
17
|
moduleSourcePaths,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./index-gyd220p2.js";
|
|
23
23
|
import {
|
|
24
24
|
PageScript
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-vyvre9en.js";
|
|
26
26
|
import {
|
|
27
27
|
Prompter
|
|
28
28
|
} from "./index-h7yw2z9n.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-0g7r8xz3.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./index-gyd220p2.js";
|
|
11
11
|
import {
|
|
12
12
|
AiSession
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-te54x9zm.js";
|
|
14
14
|
import {
|
|
15
15
|
Prompter
|
|
16
16
|
} from "./index-h7yw2z9n.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
script
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-0g7r8xz3.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor,
|
|
7
7
|
LibExecutor,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
} from "./index-gyd220p2.js";
|
|
43
43
|
import {
|
|
44
44
|
ModuleScript
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-5ystnsd5.js";
|
|
46
46
|
|
|
47
47
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
48
48
|
import { capitalize } from "akanjs/common";
|