@arcforge/types 2.0.143 → 2.0.145

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/src/tui.ts CHANGED
@@ -195,7 +195,7 @@ export type PickOption<T> = {
195
195
  * `false` for `confirm`. That is in the return type deliberately: a caller is
196
196
  * forced to handle the user walking away.
197
197
  */
198
- export type PaletteApi = {
198
+ export type AxonPalette = {
199
199
  /** Register a palette. Throws if `name` is taken. */
200
200
  create: (name: string, definition: PaletteDefinition) => PaletteHandle
201
201
 
@@ -359,7 +359,7 @@ export type BuiltinMode =
359
359
 
360
360
  export type ModeName = BuiltinMode | (string & {})
361
361
 
362
- export type ModeApi = {
362
+ export type AxonMode = {
363
363
  /** Switch modes. Throws on an unknown mode rather than silently doing nothing. */
364
364
  set: (mode: ModeName) => Promise<void>
365
365
  /** The active mode. */
@@ -394,8 +394,18 @@ export type AgentInstance = {
394
394
  readonly name: string
395
395
  /** True for the instance currently on screen. */
396
396
  readonly focused: boolean
397
- /** Null when idle. */
398
- readonly activity: "booting" | "rebooting" | "shutting-down" | "working" | null
397
+ /**
398
+ * Null when idle.
399
+ *
400
+ * The last two are ATTACHED instances only — an agent reached over a URL,
401
+ * whose wire can drop without the agent itself stopping. A local instance
402
+ * never reports them: its runtime lives in this process, so there is no
403
+ * connection to lose.
404
+ *
405
+ * Kept in step with `AgentActivity` in the TUI and with the copy in
406
+ * tui-contract.ts, which is what a user's own config typechecks against.
407
+ */
408
+ readonly activity: "booting" | "rebooting" | "shutting-down" | "working" | "reconnecting" | "disconnected" | null
399
409
  }
400
410
 
401
411
  /** An agent that can be started — a local project or a deployment. */
@@ -935,7 +945,7 @@ export type LineContent = {
935
945
  *
936
946
  * Precedence, narrowest first: placement → this → `lines.style()`.
937
947
  */
938
- style?: LineStyle
948
+ style?: AxonLineStyle
939
949
  }
940
950
 
941
951
  /**
@@ -1051,10 +1061,16 @@ export interface AxonCommandRegistry {}
1051
1061
  * to configure — which is what stops two configs disagreeing about what a
1052
1062
  * status bar looks like.
1053
1063
  */
1054
- export type LineStyle =
1055
- /** No glyphs. Components separated by spacing alone — the default. */
1064
+ export type AxonLineStyle =
1065
+ /** No glyphs. Components separated by spacing alone. */
1056
1066
  | "plain"
1057
- /** Filled arrows between sections, hairlines within. Needs a Nerd Font. */
1067
+ /**
1068
+ * Filled arrows between sections, hairlines within — the default.
1069
+ *
1070
+ * The separator block (`U+E0B0`–`U+E0B7`) predates Nerd Fonts and ships far
1071
+ * more widely than the icon range, so a terminal that draws a git icon as a
1072
+ * box still renders these. One without even that sets `"plain"`.
1073
+ */
1058
1074
  | "powerline"
1059
1075
  /** The same, with round caps. Needs a Nerd Font. */
1060
1076
  | "rounded"
@@ -1086,7 +1102,7 @@ export type LineDefinition = LineContent | readonly string[]
1086
1102
  * only needed when this particular placement differs from what the line
1087
1103
  * declared.
1088
1104
  */
1089
- export type LineEntry = LineName | LinePlacement
1105
+ export type AxonLineEntry = LineName | AxonLinePlacement
1090
1106
 
1091
1107
  /**
1092
1108
  * How ONE line is placed in ONE stack.
@@ -1107,11 +1123,11 @@ export type LineEntry = LineName | LinePlacement
1107
1123
  * Precedence, narrowest first: this placement → the line's own default →
1108
1124
  * `lines.style()`.
1109
1125
  */
1110
- export type LinePlacement = {
1126
+ export type AxonLinePlacement = {
1111
1127
  /** The registered line this entry places. */
1112
1128
  line: LineName
1113
1129
  /** How it draws here, overriding the line's default and the stack's. */
1114
- style?: LineStyle
1130
+ style?: AxonLineStyle
1115
1131
  /**
1116
1132
  * Start hidden, keeping its place in the stack.
1117
1133
  *
@@ -1140,7 +1156,7 @@ export type Line = {
1140
1156
  name: string
1141
1157
  content: LineContent
1142
1158
  /** How it draws. Falls back to the stack default when the line declared none. */
1143
- style: LineStyle
1159
+ style: AxonLineStyle
1144
1160
  /** False when hidden. A hidden line keeps its place in the stack. */
1145
1161
  visible: boolean
1146
1162
  }
@@ -1157,7 +1173,7 @@ export type Line = {
1157
1173
  * many things; a component comes from one provider — conflating the two would
1158
1174
  * make every component name read like an import path.
1159
1175
  */
1160
- export type ComponentsApi = {
1176
+ export type AxonComponents = {
1161
1177
  /**
1162
1178
  * Register a component. Throws if the name is taken. Returns a disposer.
1163
1179
  *
@@ -1183,7 +1199,7 @@ export type ComponentsApi = {
1183
1199
  * surface extensible: an extension `create`s lines without deciding where they
1184
1200
  * go, and the user `set`s the stack without knowing who authored what.
1185
1201
  */
1186
- export type LinesApi = {
1202
+ export type AxonLines = {
1187
1203
  /**
1188
1204
  * Register a line. Throws if the name is taken, or if it names a component
1189
1205
  * that does not exist — a config error the loader can contain, reported
@@ -1202,8 +1218,8 @@ export type LinesApi = {
1202
1218
  * Called with no argument, returns the current default.
1203
1219
  */
1204
1220
  style: {
1205
- (style: LineStyle): void
1206
- (): LineStyle
1221
+ (style: AxonLineStyle): void
1222
+ (): AxonLineStyle
1207
1223
  }
1208
1224
 
1209
1225
  /**
@@ -1220,9 +1236,9 @@ export type LinesApi = {
1220
1236
  */
1221
1237
  top: {
1222
1238
  /** Set it by name, with placement options. */
1223
- (name: LineName, options?: Omit<LinePlacement, "line">): void
1239
+ (name: LineName, options?: Omit<AxonLinePlacement, "line">): void
1224
1240
  /** Set it from a placement object, or clear it with null. */
1225
- (entry: LineEntry | null): void
1241
+ (entry: AxonLineEntry | null): void
1226
1242
  /** Read what is currently set. */
1227
1243
  (): Line | null
1228
1244
  }
@@ -1235,7 +1251,7 @@ export type LinesApi = {
1235
1251
  * the line's own defaults — see LinePlacement. Registered lines left out
1236
1252
  * of the array are not shown; an unknown name is reported.
1237
1253
  */
1238
- set: (entries: readonly LineEntry[]) => void
1254
+ set: (entries: readonly AxonLineEntry[]) => void
1239
1255
 
1240
1256
  /**
1241
1257
  * Move one line within the stack. Addressed by NAME, never by index —
@@ -1263,7 +1279,7 @@ export type LinesApi = {
1263
1279
  * for real, because a preview that rendered differently from the result would
1264
1280
  * be worth nothing.
1265
1281
  */
1266
- export type ThemeApi = {
1282
+ export type AxonTheme = {
1267
1283
  /**
1268
1284
  * Register a theme. Throws if the name is taken. Returns a disposer.
1269
1285
  *
@@ -1294,7 +1310,7 @@ export type NoticeOptions = {
1294
1310
  ms: number
1295
1311
  }
1296
1312
 
1297
- export type TuiApi = {
1313
+ export type AxonTui = {
1298
1314
  /**
1299
1315
  * Go to an agent: focus the instance the user was last on, booting one if
1300
1316
  * none is live. The `~` key's behaviour.
@@ -1930,6 +1946,30 @@ export type ProfileConfig = {
1930
1946
  extensions?: ExtensionEntry[]
1931
1947
  /** Platform settings — see ProfileSettings. */
1932
1948
  settings?: ProfileSettings
1949
+ /**
1950
+ * The machine-wide policy CEILING every agent on this profile runs under.
1951
+ *
1952
+ * A top-level key rather than a setting: `ProfileSettings` is the set the
1953
+ * TERMINAL acts on, and this is read by the runtime and enforced inside
1954
+ * the capsule. Folding it in would widen that set's meaning to "anything
1955
+ * configurable" and lose the boundary it draws.
1956
+ *
1957
+ * An agent narrows within this and can never widen it. Set `process.run`
1958
+ * to `false` here and no agent on the machine gets a shell, whatever its
1959
+ * own axon.config.ts says. Set a rule to `"escalate"` and every agent asks
1960
+ * you — an agent author cannot suppress the prompt by allowing it.
1961
+ *
1962
+ * policy: {
1963
+ * process: { run: { allow: ["bun *", "git *"] }, spawn: false },
1964
+ * network: { "api.anthropic.com:443": true, "*": "escalate" },
1965
+ * tools: { github: "escalate" },
1966
+ * }
1967
+ *
1968
+ * Silence is no opinion, never a denial: a capability neither layer
1969
+ * mentions falls through to the agent's own policy, so adding one rule
1970
+ * here cannot lock out everything else.
1971
+ */
1972
+ policy?: ProfilePolicy
1933
1973
  /**
1934
1974
  * Extension settings, keyed by the extension's own scoped name.
1935
1975
  *
@@ -1939,6 +1979,65 @@ export type ProfileConfig = {
1939
1979
  [extension: `@${string}/${string}`]: unknown
1940
1980
  }
1941
1981
 
1982
+ /**
1983
+ * One capability's rule.
1984
+ *
1985
+ * `true` allows, `false` denies, `"escalate"` asks. The object form matches
1986
+ * the first string argument — a command, a host, a path — by glob, where `*`
1987
+ * stops at a `/` and `**` crosses it. Inside one rule the strictest matching
1988
+ * clause wins: deny, then escalate, then allow, regardless of the order they
1989
+ * are written in.
1990
+ *
1991
+ * Declared INLINE rather than imported from the policy module, because this
1992
+ * file is copied verbatim into profile type frames and a profile directory has
1993
+ * no node_modules for an import to resolve through. `tui-policy.test.ts`
1994
+ * asserts it stays structurally identical to the real `PolicyRule` — a drift
1995
+ * here means a config that typechecks and does not enforce.
1996
+ */
1997
+ export type ProfilePolicyRule =
1998
+ | boolean
1999
+ | "escalate"
2000
+ | {
2001
+ allow?: string[]
2002
+ deny?: string[]
2003
+ escalate?: string[]
2004
+ }
2005
+
2006
+ /**
2007
+ * The subset of a capsule policy a PROFILE may declare.
2008
+ *
2009
+ * `fs` and `limits` are OS-layer facts (bind mounts, cgroups) rather than
2010
+ * per-call verdicts, and are taken from the profile wholesale when present —
2011
+ * a ceiling a bind mount ignores is not a ceiling.
2012
+ */
2013
+ export type ProfilePolicy = {
2014
+ /**
2015
+ * OS confinement tier — Linux only, a no-op elsewhere. An agent may harden
2016
+ * beyond this but never drop below it.
2017
+ */
2018
+ isolation?: "none" | "auto" | "hardened"
2019
+ /** Filesystem view. Enforced by the mount namespace under `auto`/`hardened`. */
2020
+ fs?: {
2021
+ read?: string[]
2022
+ write?: string[]
2023
+ }
2024
+ /** Network destinations, keyed by `host:port` glob. */
2025
+ network?: Record<string, ProfilePolicyRule>
2026
+ /** Shell access. `run` is a one-shot command, `spawn` a long-lived child. */
2027
+ process?: {
2028
+ spawn?: ProfilePolicyRule
2029
+ run?: ProfilePolicyRule
2030
+ }
2031
+ /** OS resource caps, applied to the whole process tree. */
2032
+ limits?: {
2033
+ memory?: string
2034
+ cpu?: string
2035
+ pids?: number
2036
+ }
2037
+ /** Tool namespaces, keyed by the name a tool registers under. */
2038
+ tools?: Record<string, ProfilePolicyRule>
2039
+ }
2040
+
1942
2041
  /**
1943
2042
  * A glyph vocabulary.
1944
2043
  *