@arcforge/types 2.0.154 → 2.0.155
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/package.json +1 -1
- package/src/engine.ts +10 -0
- package/src/module.ts +18 -0
- package/src/session/events/runtime.ts +101 -1
- package/src/session/index.ts +1 -0
- package/src/session/session.ts +15 -0
package/package.json
CHANGED
package/src/engine.ts
CHANGED
|
@@ -125,6 +125,16 @@ export type EngineCloud = {
|
|
|
125
125
|
* the seam instead.
|
|
126
126
|
*/
|
|
127
127
|
all(): Promise<CloudModelCatalog>
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Did the last `all()` answer come off disk rather than the wire?
|
|
131
|
+
*
|
|
132
|
+
* Part of the seam because the boot trace reports it: a slow boot
|
|
133
|
+
* has to be able to say whether it paid for a cold catalogue
|
|
134
|
+
* fetch. Optional so an embedder supplying its own minimal cloud
|
|
135
|
+
* stub is not forced to implement caching it does not do.
|
|
136
|
+
*/
|
|
137
|
+
wasCached?(): boolean
|
|
128
138
|
}
|
|
129
139
|
}
|
|
130
140
|
cloud: {
|
package/src/module.ts
CHANGED
|
@@ -226,6 +226,24 @@ export type ModuleSetupAxon = {
|
|
|
226
226
|
* registration order within the module too.
|
|
227
227
|
*/
|
|
228
228
|
onDispose(fn: () => void | Promise<void>): void
|
|
229
|
+
/**
|
|
230
|
+
* Report that this module is installed but not working, and let the agent
|
|
231
|
+
* boot anyway.
|
|
232
|
+
*
|
|
233
|
+
* The alternative is throwing, and a throw in setup() is TOTAL — no later
|
|
234
|
+
* module is wired and the agent does not come up. That is the right answer
|
|
235
|
+
* for a module that is broken. It is the wrong answer for one that is
|
|
236
|
+
* merely unconfigured: a channel whose credential has not been pasted yet
|
|
237
|
+
* should leave the agent running with one sense organ unconnected, not
|
|
238
|
+
* take the whole agent down. An unbootable agent also cannot run the
|
|
239
|
+
* command that would fix it.
|
|
240
|
+
*
|
|
241
|
+
* Renders as a warning rather than an error — "the agent is fine EXCEPT
|
|
242
|
+
* for the thing you just installed" — and repeats on each boot until the
|
|
243
|
+
* cause is resolved, because a one-time notice about a permanent gap is
|
|
244
|
+
* one the user will not see again when they wonder why nothing happens.
|
|
245
|
+
*/
|
|
246
|
+
warn(message: string): Promise<void>
|
|
229
247
|
env: {
|
|
230
248
|
get(key: string): string | undefined
|
|
231
249
|
require(key: string): string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxonError } from "../../error"
|
|
2
2
|
import type { AxonLogEvents } from "./log"
|
|
3
|
-
import type { AxonSpan } from "./span"
|
|
3
|
+
import type { AxonCancellableSpan, AxonSpan } from "./span"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Runtime + continuity events — the session's own lifecycle record.
|
|
@@ -47,6 +47,63 @@ export type AxonRuntimeEvent =
|
|
|
47
47
|
// ── Runtime lifecycle ────────────────────────────────────────────────────
|
|
48
48
|
& AxonSpan<"axon:boot", { version: string; agentRoot: string; mode: "local" | "cloud" }>
|
|
49
49
|
& AxonSpan<"axon:shutdown", { reason?: string }>
|
|
50
|
+
|
|
51
|
+
// ── Boot's interior ──────────────────────────────────────────────────────
|
|
52
|
+
// axon:boot bracketed the whole runtime construction and nothing
|
|
53
|
+
// inside it, so half a boot was one unlabelled gap between
|
|
54
|
+
// axon:boot:start and the capsule coming up. These four name what
|
|
55
|
+
// actually runs in that window, in the order Axon() runs them.
|
|
56
|
+
//
|
|
57
|
+
// The trace is a user-facing surface, so the standard is that no
|
|
58
|
+
// adjacent pair of spans has a meaningful gap between them: an
|
|
59
|
+
// unlabelled hole reads as time the system cannot account for.
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Resolving the cognet bundle to a live definition — the disk read, the
|
|
63
|
+
* sha256 verification, the per-runtime copy, and the dynamic import.
|
|
64
|
+
*
|
|
65
|
+
* `cognet` carries the brain's name rather than `name`, which is
|
|
66
|
+
* span-identity by convention (the ontology guard pairs brackets on it) —
|
|
67
|
+
* a field appearing only on the closing half would split the span.
|
|
68
|
+
*
|
|
69
|
+
* hashMs/importMs are split because they grow for different reasons:
|
|
70
|
+
* hashing scales with bundle size, the import is JS compile time.
|
|
71
|
+
*/
|
|
72
|
+
& AxonSpan<
|
|
73
|
+
"axon:cognet",
|
|
74
|
+
{ specifier: string | null },
|
|
75
|
+
{ cognet: string; version: string; bytes: number; hashMs: number; importMs: number }
|
|
76
|
+
>
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Resolving declared engine roles against the user's providers.
|
|
80
|
+
*
|
|
81
|
+
* The span that was hiding the catalogue fetch. `cached` says whether the
|
|
82
|
+
* hosted catalogue came off disk or the wire — the single most useful bit
|
|
83
|
+
* for anyone asking why a boot was slow.
|
|
84
|
+
*/
|
|
85
|
+
& AxonSpan<
|
|
86
|
+
"axon:inference",
|
|
87
|
+
{ roles: string[] },
|
|
88
|
+
{ bound: number; providers: number; failures: number; cached: boolean }
|
|
89
|
+
>
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* One provider answering (or failing to answer) what it can supply.
|
|
93
|
+
*
|
|
94
|
+
* Nested inside axon:inference. These genuinely run concurrently, so they
|
|
95
|
+
* carry a spanId — the one case bracket-matching cannot recover nesting
|
|
96
|
+
* on its own.
|
|
97
|
+
*/
|
|
98
|
+
& AxonSpan<
|
|
99
|
+
"axon:inference:provider",
|
|
100
|
+
{ provider: string; spanId: string },
|
|
101
|
+
{ provider: string; spanId: string; capabilities: number; cached: boolean },
|
|
102
|
+
{ provider: string; spanId: string; error: AxonError }
|
|
103
|
+
>
|
|
104
|
+
|
|
105
|
+
/** Constructing the kernel — ring 0 coming up, before the capsule boots. */
|
|
106
|
+
& AxonSpan<"axon:kernel", {}, {}>
|
|
50
107
|
// ── Surface reload (blueprint/tools changed under a live runtime) ───────
|
|
51
108
|
& AxonSpan<
|
|
52
109
|
"axon:reload",
|
|
@@ -71,6 +128,49 @@ export type AxonRuntimeEvent =
|
|
|
71
128
|
{ key: string },
|
|
72
129
|
{ key: string; error: AxonError }
|
|
73
130
|
>
|
|
131
|
+
/**
|
|
132
|
+
* Connecting the agent to an outside surface — Discord, Telegram, Slack.
|
|
133
|
+
*
|
|
134
|
+
* A guided flow the user drives, not a background operation: each step
|
|
135
|
+
* renders a card, and the flow waits where the step says to wait. It is a
|
|
136
|
+
* MODE — either the agent is working or you are connecting something to it
|
|
137
|
+
* — which is why it is cancellable. Escape ends it the same way it stops a
|
|
138
|
+
* wake, and `:interrupted` says the user did what they meant to rather
|
|
139
|
+
* than that something broke.
|
|
140
|
+
*
|
|
141
|
+
* NO CREDENTIAL EVER LANDS HERE. The token arrives on this path, and this
|
|
142
|
+
* log is durable and syncs — the same rule as `axon:env:set`, which records
|
|
143
|
+
* the key and never the value. `summary` names WHO the credential turned
|
|
144
|
+
* out to be ("MyBot#4821"), which the platform handed back.
|
|
145
|
+
*/
|
|
146
|
+
& AxonCancellableSpan<
|
|
147
|
+
"axon:connect",
|
|
148
|
+
{ connector: string; title: string },
|
|
149
|
+
{ connector: string; summary: string },
|
|
150
|
+
{ connector: string; error: AxonError },
|
|
151
|
+
{ connector: string }
|
|
152
|
+
>
|
|
153
|
+
/**
|
|
154
|
+
* One card inside a connect flow.
|
|
155
|
+
*
|
|
156
|
+
* Carries what the card SHOWS rather than a formatted line: the renderer
|
|
157
|
+
* decides how a step reads, and the flow only commits the facts. `body` is
|
|
158
|
+
* markdown because the interaction is conversational — a step reads like
|
|
159
|
+
* the agent explaining what to do next, which is what it is.
|
|
160
|
+
*/
|
|
161
|
+
& {
|
|
162
|
+
"axon:connect:step": {
|
|
163
|
+
connector: string
|
|
164
|
+
/** The card's heading — "2/4 · paste your token". */
|
|
165
|
+
note: string
|
|
166
|
+
/** Markdown body, rendered like an agent message. */
|
|
167
|
+
body?: string
|
|
168
|
+
/** Shown as the step's link, and what Enter opens. */
|
|
169
|
+
url?: string
|
|
170
|
+
/** Lets the renderer show the right affordance for the step. */
|
|
171
|
+
stepKind?: "instruct" | "input" | "work"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
74
174
|
// ── Module install/uninstall (registry op, then a reload rides the same
|
|
75
175
|
// hot-swap path above) ─────────────────────────────────────────────
|
|
76
176
|
& AxonSpan<
|
package/src/session/index.ts
CHANGED
package/src/session/session.ts
CHANGED
|
@@ -46,6 +46,21 @@ export type AxonSession = {
|
|
|
46
46
|
*/
|
|
47
47
|
export type AxonEventMap = AxonKernelEventMap & AxonRuntimeEvent & CognetEventMap & CapsuleEventMap & BuildEventMap
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Every bracketed operation's STEM — "axon:boot", "cognet:tick", and so on.
|
|
51
|
+
*
|
|
52
|
+
* Derived from the event map rather than listed, so a span declared through
|
|
53
|
+
* AxonSpan<> is immediately callable through session.span() and a stem that
|
|
54
|
+
* was never declared is a compile error. This is what lets that helper type
|
|
55
|
+
* its own payloads: given a stem it can look up `${K}:start` and
|
|
56
|
+
* `${K}:complete` directly, which a bare `K extends string` cannot do.
|
|
57
|
+
*/
|
|
58
|
+
export type AxonSpanName = {
|
|
59
|
+
[K in keyof AxonEventMap]: K extends `${infer Stem}:start`
|
|
60
|
+
? `${Stem}:complete` extends keyof AxonEventMap ? Stem : never
|
|
61
|
+
: never
|
|
62
|
+
}[keyof AxonEventMap]
|
|
63
|
+
|
|
49
64
|
// ── Enveloped unions (what actually sits in the JSONL) ──────────────────────
|
|
50
65
|
|
|
51
66
|
/** One line in the session's kernel log — internal telemetry, never rendered to the user. */
|