@arcforge/types 2.0.59

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.
Files changed (59) hide show
  1. package/package.json +29 -0
  2. package/src/bench/aggregate.ts +67 -0
  3. package/src/bench/artifact.ts +39 -0
  4. package/src/bench/bench.ts +62 -0
  5. package/src/bench/contribution.ts +40 -0
  6. package/src/bench/dimension.ts +15 -0
  7. package/src/bench/execution.ts +76 -0
  8. package/src/bench/factor.ts +69 -0
  9. package/src/bench/index.ts +108 -0
  10. package/src/bench/manifest.ts +49 -0
  11. package/src/bench/measurement.ts +41 -0
  12. package/src/bench/observation.ts +42 -0
  13. package/src/bench/protocol.ts +21 -0
  14. package/src/bench/result.ts +32 -0
  15. package/src/bench/value.ts +7 -0
  16. package/src/bench/workspace.ts +76 -0
  17. package/src/blueprint.ts +125 -0
  18. package/src/capsule-config.ts +111 -0
  19. package/src/cognet/blueprint.ts +38 -0
  20. package/src/cognet/cognet.ts +69 -0
  21. package/src/cognet/hooks.ts +43 -0
  22. package/src/cognet/index.ts +3 -0
  23. package/src/config.ts +72 -0
  24. package/src/define.ts +184 -0
  25. package/src/deploy.ts +54 -0
  26. package/src/engine.ts +254 -0
  27. package/src/error.ts +88 -0
  28. package/src/handle.ts +137 -0
  29. package/src/hooks.ts +31 -0
  30. package/src/http.ts +49 -0
  31. package/src/index.ts +23 -0
  32. package/src/kernel/abi.ts +244 -0
  33. package/src/kernel/index.ts +2 -0
  34. package/src/middleware.ts +7 -0
  35. package/src/module.ts +193 -0
  36. package/src/plugin.ts +9 -0
  37. package/src/policy.ts +89 -0
  38. package/src/prompts.ts +25 -0
  39. package/src/route.ts +15 -0
  40. package/src/scope.ts +29 -0
  41. package/src/scripts.ts +21 -0
  42. package/src/session/envelope.ts +61 -0
  43. package/src/session/events/activity.ts +77 -0
  44. package/src/session/events/bench.ts +49 -0
  45. package/src/session/events/capsule.ts +114 -0
  46. package/src/session/events/cognet.ts +51 -0
  47. package/src/session/events/engine.ts +46 -0
  48. package/src/session/events/entries.ts +66 -0
  49. package/src/session/events/kernel.ts +44 -0
  50. package/src/session/events/log.ts +27 -0
  51. package/src/session/events/runtime.ts +76 -0
  52. package/src/session/events/stdio/output.ts +94 -0
  53. package/src/session/events/stdio/shared.ts +50 -0
  54. package/src/session/events/stdio/stimuli.ts +110 -0
  55. package/src/session/events/test.ts +52 -0
  56. package/src/session/index.ts +40 -0
  57. package/src/session/session.ts +107 -0
  58. package/src/tools.ts +54 -0
  59. package/tsconfig.base.json +14 -0
@@ -0,0 +1,32 @@
1
+ import type { BenchArtifactRef } from "./artifact"
2
+ import type { BenchFault, BenchSessionRef, BenchTrialRecord } from "./execution"
3
+ import type { BenchRunManifest } from "./manifest"
4
+ import type { BenchObservation, BenchMeasurementState } from "./observation"
5
+
6
+ export type BenchCoverageMissingReason = "skipped" | "filtered" | "cancelled" | "fault" | "not_emitted"
7
+
8
+ export type BenchCoverage = {
9
+ expectedTrials: number
10
+ executedTrials: number
11
+ completedTrials: number
12
+ expectedMeasurements: number
13
+ observedMeasurements: number
14
+ missing: Partial<Record<BenchCoverageMissingReason, number>>
15
+ /** States are retained for exact audit of required measurements. */
16
+ measurements: BenchMeasurementState[]
17
+ }
18
+
19
+ /**
20
+ * Canonical run data. Aggregates and visualizations are deliberately absent:
21
+ * both are reproducible projections over this immutable record.
22
+ */
23
+ export type BenchRunResult = {
24
+ manifest: BenchRunManifest
25
+ trials: BenchTrialRecord[]
26
+ observations: BenchObservation[]
27
+ artifacts: BenchArtifactRef[]
28
+ sessions: BenchSessionRef[]
29
+ faults: BenchFault[]
30
+ coverage: BenchCoverage
31
+ }
32
+
@@ -0,0 +1,7 @@
1
+ /** JSON is the portable boundary for definitions, manifests, and observations. */
2
+ export type BenchScalar = string | number | boolean
3
+ export type BenchValue = null | BenchScalar | BenchValue[] | { [key: string]: BenchValue }
4
+
5
+ /** Content and schema identities use lowercase, algorithm-qualified hashes. */
6
+ export type BenchHash = `${string}:${string}`
7
+
@@ -0,0 +1,76 @@
1
+ import type { BenchExecutionContext, BenchTestStatus } from "./execution"
2
+ import type { BenchHash } from "./value"
3
+
4
+ export type BenchWorkspaceSource =
5
+ | { kind: "empty" }
6
+ | { kind: "directory"; path: string }
7
+
8
+ export type BenchWorkspaceRetention = "never" | "failed" | "always"
9
+
10
+ export type BenchWorkspaceDefinition = {
11
+ /** Shorthand for source: { kind: "directory", path: template }. */
12
+ template?: string
13
+ source?: BenchWorkspaceSource
14
+ retain?: BenchWorkspaceRetention
15
+ capture?: {
16
+ changes?: boolean
17
+ display?: "hidden" | "default"
18
+ ignore?: string[]
19
+ maxBytes?: number
20
+ }
21
+ }
22
+
23
+ export type BenchResolvedWorkspaceDefinition = {
24
+ source: BenchWorkspaceSource
25
+ retain: BenchWorkspaceRetention
26
+ capture: {
27
+ changes: boolean
28
+ display: "hidden" | "default"
29
+ ignore: string[]
30
+ maxBytes: number
31
+ }
32
+ }
33
+
34
+ export type BenchWorkspaceTemplate = {
35
+ kind: BenchWorkspaceSource["kind"]
36
+ hash: BenchHash
37
+ files: number
38
+ bytes: number
39
+ }
40
+
41
+ export type BenchWorkspaceInstance = {
42
+ id: string
43
+ /** Local execution detail. Never enters portable manifests or events. */
44
+ path: string
45
+ context: BenchExecutionContext
46
+ template: BenchWorkspaceTemplate
47
+ }
48
+
49
+ export type BenchWorkspaceFileState = {
50
+ hash: BenchHash
51
+ bytes: number
52
+ mode: number
53
+ ref?: string
54
+ }
55
+
56
+ export type BenchWorkspaceChange = {
57
+ path: string
58
+ kind: "added" | "modified" | "deleted"
59
+ before?: BenchWorkspaceFileState
60
+ after?: BenchWorkspaceFileState
61
+ }
62
+
63
+ export type BenchWorkspaceResult = {
64
+ workspaceId: string
65
+ templateHash: BenchHash
66
+ retained: boolean
67
+ outcome: BenchTestStatus
68
+ changes: BenchWorkspaceChange[]
69
+ summary: {
70
+ added: number
71
+ modified: number
72
+ deleted: number
73
+ bytesChanged: number
74
+ }
75
+ }
76
+
@@ -0,0 +1,125 @@
1
+ import { AxonConfig } from "./config"
2
+ import { CognetBlueprint } from "./cognet/blueprint"
3
+ import { AxonPlugin } from "./plugin"
4
+ import { AxonRoute } from "./route"
5
+ import { AxonMiddleware } from "./middleware"
6
+ import { AxonModule } from "./module"
7
+ import { AxonTool } from "./tools"
8
+ import { AxonScript } from "./scripts"
9
+ import { AxonPrompt } from "./prompts"
10
+
11
+ /**
12
+ * The blueprint is the boundary between CLI and runtime.
13
+ *
14
+ * The CLI discovers, merges, resolves conflicts, validates, and renders
15
+ * everything ahead of time. The blueprint is the output of that work —
16
+ * a single resolved object handed to Axon(). The runtime never walks
17
+ * the filesystem, never resolves module precedence, never re-validates
18
+ * config. It trusts the blueprint completely and acts on it.
19
+ *
20
+ * If a runtime code path needs to `readdir` or re-derive something the
21
+ * CLI could have resolved, that's a sign the field belongs here instead.
22
+ */
23
+ export type AxonBlueprint = {
24
+ session: {
25
+ id: string
26
+ }
27
+
28
+ agent: {
29
+ name: string
30
+ version: string
31
+ hash: {
32
+ type: "sha256" | "sha512"
33
+ value: string
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Base context — static `src/boot.md`, pre-read by the CLI, rendered as-is.
39
+ * Mutually exclusive with bootFilePath.
40
+ */
41
+ boot?: string
42
+
43
+ /**
44
+ * Base context — dynamic `src/boot.vue`. The CLI notes its existence only;
45
+ * the runtime renders it (via vstr, with the real `axon` global in
46
+ * scope) fresh on every tick, so a script-setup call to axon.tools.*
47
+ * reflects live data, not a snapshot from manifest-build time. Mutually
48
+ * exclusive with boot.
49
+ */
50
+ bootFilePath?: string
51
+
52
+ /** resolved axon.config.ts — engine, policy, environment. no raw process.env reads at runtime. */
53
+ config: AxonConfig
54
+
55
+ /**
56
+ * The brain. REQUIRED and never defaulted: an agent without a brain is
57
+ * not an agent — normalization fails loudly when it's missing. The CLI
58
+ * bundles the cognet project and passes path+hash; tests pass a live
59
+ * definition. The runtime ships no cognet of its own.
60
+ */
61
+ cognet: CognetBlueprint
62
+
63
+ /**
64
+ * Full resolved environment, key/value. The CLI is the one place that
65
+ * reads process.env — runtime never reaches for process.env directly,
66
+ * it reads from here so capsule/server/engine all see the same
67
+ * already-resolved set.
68
+ */
69
+ env: Record<string, string>
70
+
71
+ tools: AxonTool[]
72
+ prompts: AxonPrompt[]
73
+ scripts: AxonScript[]
74
+
75
+ server: AxonServerBlueprint
76
+
77
+ /**
78
+ * Installed modules, flattened. Options already validated against each
79
+ * module's optionsSchema by the CLI — runtime trusts the shape.
80
+ */
81
+ modules: AxonModule[]
82
+
83
+ paths: {
84
+ /** agent root — still needed for capsule fs-tool sandboxing, not for discovery */
85
+ root: string
86
+ data: string
87
+ }
88
+ }
89
+
90
+ /**
91
+ * What the CLI is allowed to hand over before normalization. Every field is
92
+ * optional or partial — the CLI may not have resolved everything yet (e.g.
93
+ * a fresh session has no id). normalizeBlueprint() is the one place that
94
+ * turns this into a strict AxonBlueprint; nothing downstream ever sees
95
+ * AxonPartialBlueprint.
96
+ */
97
+ export type AxonPartialBlueprint = {
98
+ session?: Partial<AxonBlueprint["session"]>
99
+ agent?: Partial<AxonBlueprint["agent"]>
100
+ boot?: string
101
+ bootFilePath?: string
102
+ config?: AxonBlueprint["config"]
103
+ cognet?: CognetBlueprint
104
+ env?: AxonBlueprint["env"]
105
+ tools?: AxonBlueprint["tools"]
106
+ prompts?: AxonBlueprint["prompts"]
107
+ scripts?: AxonBlueprint["scripts"]
108
+ server?: Partial<AxonServerBlueprint>
109
+ modules?: AxonBlueprint["modules"]
110
+ paths?: Partial<AxonBlueprint["paths"]>
111
+ }
112
+
113
+
114
+ /**
115
+ * Server shape, pre-resolved. Module routes are already merged into `routes`
116
+ * by the CLI (conflict resolution — agent-vs-module precedence, install-order
117
+ * tie-breaks — happened there). build/server/ has no module-specific
118
+ * mounting step; it only applies what it's given.
119
+ */
120
+ export type AxonServerBlueprint = {
121
+ middleware: AxonMiddleware[]
122
+ routes: AxonRoute[] // agent + module routes, fully merged and conflict-resolved
123
+ plugins: AxonPlugin[]
124
+ }
125
+
@@ -0,0 +1,111 @@
1
+ import type { CapsulePolicy, EscalationCall } from "./policy"
2
+ import type { AxonScopeModule } from "./scope"
3
+
4
+ export type CapsuleHostRequest = {
5
+ method: string
6
+ input: unknown
7
+ signal: AbortSignal
8
+ }
9
+
10
+ export type CapsuleHost = {
11
+ call(request: CapsuleHostRequest): Promise<unknown>
12
+ }
13
+
14
+ /**
15
+ * A tool loaded into the capsule's global scope at boot.
16
+ * The namespace becomes the global name inside run() — e.g. "fs" → fs.read().
17
+ */
18
+ export type CapsuleTool =
19
+ | {
20
+ namespace: string
21
+ /** Exact model-facing declarations for the globals this tool installs. */
22
+ scope: AxonScopeModule
23
+ /** Bundled TypeScript source (cloud path). Must default-export { name, exports }. */
24
+ source: string
25
+ }
26
+ | {
27
+ namespace: string
28
+ /** Exact model-facing declarations for the globals this tool installs. */
29
+ scope: AxonScopeModule
30
+ /** Absolute path to the tool file (local path). Imported directly — native addons resolve. */
31
+ path: string
32
+ }
33
+
34
+ /**
35
+ * Everything the capsule is built from. `env` merges onto the host's
36
+ * inherited environment (the trust boundary is the OS-level axon-runner,
37
+ * not env isolation) — secret stripping is the caller's compile step, not
38
+ * capsule behavior. `cwd` is where it lives, `tools` is its entire scope,
39
+ * `policy` is what it may do.
40
+ *
41
+ * Capsule(config) wires; capsule.boot() spawns.
42
+ */
43
+ export type CapsuleBlueprint = {
44
+ /** Display name for events/debugging. */
45
+ name?: string
46
+
47
+ /** Working directory of the subprocess. */
48
+ cwd: string
49
+
50
+ /** Merged onto the host's inherited environment — can override or narrow, but never starts from a blank slate. */
51
+ env: Record<string, string>
52
+
53
+ /** Tools loaded into global scope before boot() resolves. */
54
+ tools: CapsuleTool[]
55
+
56
+ /** What the sandbox may do — enforced by the in-process mediator. */
57
+ policy: CapsulePolicy
58
+
59
+ /**
60
+ * OS-level enforcement (Linux only). Runs the subprocess as this user via
61
+ * the setuid axon-runner and applies fs ACLs derived from the policy.
62
+ * Omit to run as the invoking user with mediator enforcement only.
63
+ */
64
+ userspace?: {
65
+ user: string
66
+ }
67
+
68
+ /**
69
+ * Answer policy escalations. One callback, one decision — default deny.
70
+ * Called when the mediator hits an "escalate" rule.
71
+ */
72
+ escalate?: (call: EscalationCall) => Promise<boolean>
73
+
74
+ /** Trusted host services projected into globalThis.axon through RPC. */
75
+ host?: CapsuleHost
76
+
77
+ boot?: {
78
+ /** Max ms to wait for the boot handshake. Default 10_000. */
79
+ timeoutMs?: number
80
+ }
81
+
82
+ restart?: {
83
+ /** Max crash restarts inside the window before the capsule is declared dead. Default 3. */
84
+ max?: number
85
+ /** Crash window in ms. Default 5_000. */
86
+ windowMs?: number
87
+ }
88
+
89
+ /**
90
+ * Override the default `bun run <entrypoint>` spawn. Used by tests and
91
+ * by userspace enforcement (axon-runner substitution is internal —
92
+ * callers normally never set this).
93
+ */
94
+ spawn?: {
95
+ command: string
96
+ args: string[]
97
+ }
98
+ }
99
+
100
+ /**
101
+ * What Capsule()/capsule.update() actually accept. Partial<CapsuleBlueprint>
102
+ * is shallow — policy would have to be supplied whole or not at all, which
103
+ * defeats the point of a blueprint seam. policy (and process within it) get
104
+ * their own deep-partial here so a caller can pass just the one field they
105
+ * care about; CapsuleBlueprint()/mergeCapsuleConfig() fill in the rest.
106
+ */
107
+ export type CapsulePartialConfig = Partial<Omit<CapsuleBlueprint, "policy">> & {
108
+ policy?: Partial<Omit<CapsulePolicy, "process">> & {
109
+ process?: Partial<CapsulePolicy["process"]>
110
+ }
111
+ }
@@ -0,0 +1,38 @@
1
+ import type { AxonEntryEvent } from "../session/events/entries"
2
+ import type { CognetDefinition } from "./cognet"
3
+
4
+ /**
5
+ * The cognet slot in the agent blueprint — how a brain reaches the runtime.
6
+ *
7
+ * Two carriers, one contract:
8
+ * - `path` + `hash` — the CLI form. `axon prepare` bundles the cognet
9
+ * project into `<agent>/.agent/cognet/cognet.mjs` (single self-contained
10
+ * ESM file, default export = defineCognet(...)); the blueprint stays pure
11
+ * data. The runtime imports `path?v=hash` (cache-busted per content) and
12
+ * verifies the hash BEFORE evaluating — a tampered brain never half-loads.
13
+ * - `definition` — the live-object form, for tests and embedded use. Same
14
+ * contract, no disk.
15
+ *
16
+ * Identity (name/version/abi/wakeOn) rides alongside for display, wake
17
+ * policy, and pre-load checks; the loaded definition is the authority and
18
+ * a disagreement fails loudly.
19
+ */
20
+ export type CognetBlueprint = {
21
+ name: string
22
+ version: string
23
+ /** Kernel ABI contract the artifact targets — checked again at load from the definition itself. */
24
+ abi: string
25
+ /** Declarative wake mask — overrides the definition's own default. */
26
+ wakeOn?: Array<keyof AxonEntryEvent>
27
+ } & (
28
+ | {
29
+ /** Absolute path to the compiled bundle — <agent>/.agent/cognet/cognet.mjs. */
30
+ path: string
31
+ /** sha256 (hex) of the bundle contents — integrity + reload detection + import cache-bust. */
32
+ hash: string
33
+ }
34
+ | {
35
+ /** Live definition — test/embedded path. The CLI always emits path+hash. */
36
+ definition: CognetDefinition
37
+ }
38
+ )
@@ -0,0 +1,69 @@
1
+ import type { AxonBlueprint } from "../blueprint"
2
+ import type { KernelAbi, CognetWake } from "../kernel/abi"
3
+ import type { AxonEntryEvent } from "../session/events/entries"
4
+
5
+ /**
6
+ * A cognet definition — one cognition artifact, what defineCognet()
7
+ * produces. Built as its own project (registry/cognets/*), bundled by the CLI, and
8
+ * carried into the runtime on blueprint.cognet — there is NO other way to
9
+ * load a brain. Resident for the runtime's lifetime: the kernel loads it
10
+ * once (exec), delivers wakes, and owns the execution record around every
11
+ * wake.
12
+ *
13
+ * The definition owns everything inside: grammar, context rendering,
14
+ * strategy, its own derived state (a cache of the log, rebuildable — never
15
+ * authoritative). It touches nothing but the ABI it receives at load().
16
+ */
17
+ /**
18
+ * How the scheduler decides to invoke this cognet. Part of the cognet's own
19
+ * declared identity — never blueprint-overridable, same trust direction as
20
+ * `abi`: a cognet built for invocation-based wakes was never written to
21
+ * tolerate an empty-stimuli tick, so an agent author can't flip this from
22
+ * outside.
23
+ *
24
+ * - "invocation" — invoked once per admitted stimulus arrival, handed the
25
+ * full diff accumulated since the last invocation (may be more than one
26
+ * stimulus if several arrived while the previous wake was running).
27
+ * - "continuous" — invoked on a fixed clock regardless of whether anything
28
+ * arrived; an empty diff is the ordinary steady state, not an edge case.
29
+ */
30
+ export type CognetSchedule =
31
+ | { kind: "invocation" }
32
+ | { kind: "continuous"; tickMs: number }
33
+
34
+ /**
35
+ * Cognet identity — what cognet.config.ts declares via defineCognet().
36
+ * The compiled artifact composes this with the loop the entry script
37
+ * registers; identity and behavior never live in the same file.
38
+ */
39
+ export type CognetConfig = {
40
+ name: string
41
+ version: string
42
+
43
+ /** The kernel ABI version this cognet was built against — checked at load, mismatch refuses loudly. */
44
+ abi: string
45
+
46
+ /** How the scheduler invokes this cognet. */
47
+ mode: CognetSchedule
48
+
49
+ /** Default wake mask — overridable by the blueprint's wakeOn. Absent = wake on everything. */
50
+ wakeOn?: Array<keyof AxonEntryEvent>
51
+
52
+ /** Hard safety bound for one wake. Strategy may stop earlier; default is 8 ticks. */
53
+ maxTicksPerWake?: number
54
+ }
55
+
56
+ export type CognetDefinition = CognetConfig & {
57
+
58
+ /** exec(): receives the syscall table. Runs once, before any wake. */
59
+ load(kernel: KernelAbi): Promise<void> | void
60
+
61
+ /** One scheduled episode. Returns when quiescent; throws on failure. */
62
+ wake(wake: CognetWake): Promise<void>
63
+
64
+ /** The agent changed (hot reload) — adopt the new blueprint before the next wake. */
65
+ update?(blueprint: AxonBlueprint): void
66
+
67
+ /** Brain off. Nothing durable to flush — durable writes already happened at commit time. */
68
+ unload?(): Promise<void> | void
69
+ }
@@ -0,0 +1,43 @@
1
+ import type { CognetWake } from "../kernel/abi"
2
+
3
+ /**
4
+ * Cognet lifecycle hooks — the call points the host awaits at fixed moments
5
+ * of a brain's life. Mirrors AxonHooks in shape and discipline but is a
6
+ * COMPLETELY SEPARATE surface: Axon's hooks are the runtime/server's
7
+ * lifecycle; these are the cognet's own, one ring down.
8
+ *
9
+ * Distinct from cognet:* telemetry (fire-and-forget bus narration) and from
10
+ * the world (domain facts): these are in-order, awaited-to-completion
11
+ * plumbing points. Registered via `definePlugin(({ hooks }) => ...)` in
12
+ * plugins/*.ts, fired by the host — never by the loop, never by kernel code.
13
+ *
14
+ * PLUMBING ONLY. Load/save derived state, warm caches, attach devtools.
15
+ * A domain fact ("user arrived", "tool finished") is a stimulus that folds
16
+ * into the world, NEVER a hook — the moment cognition leaks into a hook,
17
+ * the loop stops being the one place a brain's behavior is legible.
18
+ */
19
+ export type CognetHooks = {
20
+ /** Kernel bound, main() has run, loop declared — the brain is ready but not yet woken. */
21
+ "boot": () => void | Promise<void>
22
+
23
+ /** A wake is about to run. Receives the wake it brackets. */
24
+ "wake": (wake: CognetWake) => void | Promise<void>
25
+
26
+ /** One tick of a wake is about to run. Hot path — keep handlers cheap. */
27
+ "tick": (info: { tick: number }) => void | Promise<void>
28
+
29
+ /** Brain off. Release derived state; durable writes already happened at commit time. */
30
+ "shutdown": () => void | Promise<void>
31
+ }
32
+
33
+ export type CognetHookName = keyof CognetHooks
34
+
35
+ /** The surface a plugin registers against. */
36
+ export type CognetPluginContext = {
37
+ hooks: {
38
+ on<N extends CognetHookName>(name: N, fn: CognetHooks[N]): () => void
39
+ }
40
+ }
41
+
42
+ /** A cognet plugin — plumbing wired to lifecycle hooks. What definePlugin() produces. */
43
+ export type CognetPlugin = (ctx: CognetPluginContext) => void
@@ -0,0 +1,3 @@
1
+ export type { CognetConfig, CognetDefinition } from "./cognet"
2
+ export type { CognetBlueprint } from "./blueprint"
3
+ export type { CognetHooks, CognetHookName, CognetPlugin, CognetPluginContext } from "./hooks"
package/src/config.ts ADDED
@@ -0,0 +1,72 @@
1
+ import { EngineConfig } from "./engine"
2
+ import { CapsulePartialConfig } from "./capsule-config"
3
+ import { DeployConfig } from "./deploy"
4
+ import { ModuleEntry } from "./module"
5
+
6
+ /**
7
+ * Authoring configuration for an Axon agent.
8
+ *
9
+ * This is the object passed to `defineAgent()` in `axon.config.ts`. It controls
10
+ * the agent's description, inference engine, sandbox policy, environment,
11
+ * deployment, installed module options, workspace integration, and HTTP server.
12
+ *
13
+ * ```ts
14
+ * import { Axon } from "@arcforge/engines"
15
+ * import TelegramModule from "../modules/telegram/module.config"
16
+ *
17
+ * export default defineAgent({
18
+ * description: "Answers support questions from repository context",
19
+ * engine: Axon({ model: "auto" }), // curated models
20
+ * modules: [
21
+ * "@axon/github", // registry — auto-installed
22
+ * TelegramModule, // source import
23
+ * [TelegramModule, { mentionOnly: true }], // with options
24
+ * ],
25
+ * })
26
+ * ```
27
+ *
28
+ * @see https://axon.arclabs.it/docs/v2/agent/config
29
+ */
30
+ export type AxonConfig<EventMap extends Record<string, unknown> = Record<string, unknown>> = {
31
+ /** Short human-readable summary shown in registries, docs, and generated manifests. */
32
+ description?: string
33
+
34
+ /** Sandbox permissions enforced at the capsule boundary. */
35
+ policy?: CapsulePartialConfig["policy"]
36
+
37
+ /** Deployment target, runtime packages, and scaling settings. */
38
+ deploy?: DeployConfig
39
+
40
+
41
+ /** Engine used for model inference. Omit for mock/default behavior in local scaffolds. */
42
+ engine?: EngineConfig
43
+
44
+ /**
45
+ * Cognet selection — which brain the CLI bundles for this agent.
46
+ * Resolved by the CLI against its cognet workspace; defaults to "zero".
47
+ * The runtime never sees this — it reads the bundled blueprint.cognet.
48
+ */
49
+ cognet?: { name: "zero" }
50
+
51
+
52
+
53
+ /**
54
+ * Modules to load into this agent.
55
+ *
56
+ * Each entry is one of:
57
+ * - `"@axon/telegram"` — registry module, auto-installed at `axon prepare` / `axon dev`
58
+ * - `TelegramModule` — direct source import, used from its source path (no install)
59
+ * - `[module, options]` — either form paired with runtime options
60
+ *
61
+ * Modules are loaded in declaration order. Sub-modules declared inside a module
62
+ * are flattened before the agent's own list — first declaration wins on name collision.
63
+ */
64
+ modules?: ModuleEntry[]
65
+
66
+ /**
67
+ * Opt this agent into the repository workspace layer.
68
+ * When true, Axon discovers the nearest .agents/ directory (walking up from cwd)
69
+ * and merges its tools, prompts, scripts, and modules into the agent runtime.
70
+ */
71
+ workspace?: boolean
72
+ }