@arcforge/types 2.0.153 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforge/types",
3
- "version": "2.0.153",
3
+ "version": "2.0.155",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./src/index.ts",
package/src/config.ts CHANGED
@@ -110,6 +110,34 @@ export type AxonConfig<EventMap extends Record<string, unknown> = Record<string,
110
110
  */
111
111
  providers?: ProviderEntry[]
112
112
 
113
+ /**
114
+ * @deprecated Removed — use `model:` for a pin, `providers:` for sources.
115
+ *
116
+ * ```ts
117
+ * engine: Codex({ model: "gpt-5.6-terra" }) // before
118
+ * model: "codex:gpt-5.6-terra" // after
119
+ * ```
120
+ *
121
+ * This field named ONE model for the whole agent. It could not survive a
122
+ * cognet declaring several roles, and it put the choice in the wrong
123
+ * place besides — which model to use is the user's, expressed once on
124
+ * their profile, while an agent only says what sources it needs beyond
125
+ * what they already have.
126
+ *
127
+ * Typed as `never` rather than deleted outright. Deleting it made an
128
+ * `engine:` key an ordinary excess property that TypeScript accepted on
129
+ * any non-literal path and the runtime then silently ignored — so an
130
+ * agent kept booting, on whatever the profile pool ranked first, while
131
+ * its config still said otherwise. A dead field that reads as honoured is
132
+ * worse than a missing one. Declaring it `never` makes every assignment a
133
+ * compile error that names the replacement, and `Config()` refuses the
134
+ * key at load for anything that reaches the runtime untypechecked.
135
+ *
136
+ * Remove after the deprecation window, once no published agent carries
137
+ * it.
138
+ */
139
+ engine?: never
140
+
113
141
  /**
114
142
  * Cognet selection — which brain this agent runs.
115
143
  *
package/src/define.ts CHANGED
@@ -25,7 +25,7 @@ export type AgentDefinition<EventMap extends Record<string, unknown> = Record<st
25
25
  *
26
26
  * export default defineAgent({
27
27
  * description: "Reviews incoming pull requests",
28
- * engine: Axon({ model: "claude-sonnet-4-6" }),
28
+ * providers: [Axon()],
29
29
  * policy: {
30
30
  * fs: { read: ["./src/**"], write: ["./reports/**"] },
31
31
  * network: { allow: ["api.github.com"] },
package/src/engine.ts CHANGED
@@ -7,15 +7,13 @@ import { AxonEngineEvent } from "./session/events/engine"
7
7
  * resolved to a live driver by the runtime's Engine() manager — the one
8
8
  * seam every boot path shares — via @arcforge/engines' resolveEngine().
9
9
  *
10
- * ```ts
11
- * export default defineAgent({
12
- * engine: { provider: "axon", model: "claude-sonnet-4-6" },
13
- * // or, for advanced wiring:
14
- * // engine: Axon({ model: "claude-sonnet-4-6", url: "ws://localhost:8787" }),
15
- * })
16
- * ```
10
+ * NOT an `axon.config.ts` field. `engine:` is deprecated there — an agent
11
+ * declares `providers:` (sources) and `model:` (a cortex preference), and
12
+ * resolution picks a driver per role from that pool. This type is the
13
+ * INTERNAL shape a resolved driver is built from, which is why it still
14
+ * exists and why nothing user-facing should reference it.
17
15
  *
18
- * @see https://axon.arclabs.it/docs/v2/api/config/engine
16
+ * @see https://axon.arclabs.it/docs/v2/agent/config
19
17
  */
20
18
  export type EngineConfig = AxonEngineDef | EngineRef
21
19
 
@@ -127,6 +125,16 @@ export type EngineCloud = {
127
125
  * the seam instead.
128
126
  */
129
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
130
138
  }
131
139
  }
132
140
  cloud: {
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./deploy"
6
6
  export * from "./engine"
7
7
  export * from "./inference"
8
8
  export * from "./error"
9
+ export * from "./report"
9
10
  export * from "./http"
10
11
  export * from "./instance"
11
12
  export * from "./handle"
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
package/src/report.ts ADDED
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The crash-report wire contract.
3
+ *
4
+ * One payload shape, posted by every side of the platform to
5
+ * POST /api/reports. Lives here because three independent packages
6
+ * construct it — @arclabs/cloud (HTTP failures), @axon/err (runtime
7
+ * failures), and the backend's own 5xx handler — and a contract owned by
8
+ * any one of them would make the other two depend on a transport.
9
+ *
10
+ * This is NOT a trace or a span. There is no parent, no tree, no duration.
11
+ * A report says "this failed, here is enough to debug it" and nothing more —
12
+ * the deliberate opposite of the event pipeline this replaced.
13
+ */
14
+
15
+ /** Which side of the platform produced a report. */
16
+ export type ReportSource = "cloud" | "runtime" | "backend"
17
+
18
+ /**
19
+ * One occurrence, as sent over the wire.
20
+ *
21
+ * The server derives the grouping fingerprint from this — clients never send
22
+ * one. Fingerprinting is a server concern because it decides what counts as
23
+ * "the same failure", and a client that computed its own could split a group
24
+ * simply by shipping a different version of the hashing code.
25
+ */
26
+ export type ErrorReport = {
27
+ source: ReportSource
28
+
29
+ /**
30
+ * errorMap code (e.g. "AX-BOOT-001") when the failure went through err().
31
+ * Absent for raw HTTP and network failures, which never had one — that
32
+ * absence is meaningful and must not be filled with a placeholder.
33
+ */
34
+ code?: string
35
+
36
+ /** Short headline. The map's title, or a summary of the HTTP failure. */
37
+ message: string
38
+
39
+ severity?: "error" | "fatal"
40
+
41
+ /**
42
+ * The release this occurred on. Without it a group cannot distinguish
43
+ * "fixed two versions ago" from "still happening on HEAD", which is the
44
+ * first question an operator asks.
45
+ */
46
+ release?: string
47
+
48
+ /** Coarse runtime descriptor, e.g. "bun-1.1/linux". Never a hostname or a username. */
49
+ platform?: string
50
+
51
+ stack?: string
52
+
53
+ /**
54
+ * Structured frames when the source has them (err() captures these).
55
+ * Preferred over `stack` for fingerprinting: a parsed frame survives
56
+ * minification and path differences that break naive stack-string hashing.
57
+ */
58
+ frames?: ReportFrame[]
59
+
60
+ /**
61
+ * Caller-supplied detail. SCRUBBED BEFORE SENDING — see scrubContext()
62
+ * in @arclabs/cloud. This is the one field that can carry user data
63
+ * (paths, prompt text, agent names), so it is the one field that must
64
+ * never be forwarded raw.
65
+ */
66
+ context?: Record<string, unknown>
67
+
68
+ /** Flattened cause chain, outermost first. */
69
+ cause?: string
70
+ }
71
+
72
+ /** A stack frame, reduced to what fingerprinting and display need. */
73
+ export type ReportFrame = {
74
+ functionName: string | null
75
+ fileName: string | null
76
+ lineNumber: number | null
77
+ }
78
+
79
+ /** What POST /api/reports answers. */
80
+ export type ErrorReportAck = {
81
+ /** The group this occurrence landed in. */
82
+ fingerprint: string
83
+ /** How many times this group has now been seen. */
84
+ occurrences: number
85
+ }
@@ -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<
@@ -46,6 +46,7 @@ export type {
46
46
  AxonEntry,
47
47
  AxonEntryOf,
48
48
  AxonEventMap,
49
+ AxonSpanName,
49
50
  AxonKernelEvent,
50
51
  AxonKernelEventOf,
51
52
  AxonSession,
@@ -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. */