@arcforge/err 2.0.167 → 2.0.168

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 (3) hide show
  1. package/package.json +2 -2
  2. package/src/map.ts +19 -1
  3. package/src/stack.ts +24 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforge/err",
3
- "version": "2.0.167",
3
+ "version": "2.0.168",
4
4
  "description": "Structured Axon errors — the code map every user-facing failure is rendered from.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -15,7 +15,7 @@
15
15
  "deploy": "echo \"This package is published ONLY by apps/tui/scripts/release.ts, which pins workspace:* deps to concrete versions first. Publishing it directly ships an unresolvable dependency.\" && exit 1"
16
16
  },
17
17
  "dependencies": {
18
- "@arcforge/types": "2.0.167"
18
+ "@arcforge/types": "2.0.168"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/bun": "latest",
package/src/map.ts CHANGED
@@ -529,6 +529,15 @@ export const errorMap = {
529
529
  * carried in `detail` — this code says WHERE it failed, not what went
530
530
  * wrong, which is the script's own business.
531
531
  */
532
+ SCRIPT_NOT_LOCAL: {
533
+ code: "AX-SCRIPT-501",
534
+ title: "Scripts Are Local Only",
535
+ description: "This agent is a deployment reached over the network. A script is code that runs INSIDE an agent's own process, so a deployment runs its own — driving one from here would be this terminal reaching across the boundary that exists to stop it.",
536
+ source: "runtime",
537
+ severity: "fatal",
538
+ expected: true,
539
+ },
540
+
532
541
  SCRIPT_FAILED: {
533
542
  code: "AX-SCRIPT-500",
534
543
  title: "Script Failed",
@@ -2210,6 +2219,15 @@ export const errorMap = {
2210
2219
  severity: "fatal",
2211
2220
  },
2212
2221
 
2222
+ NOT_SIGNED_IN: {
2223
+ code: "AX-TUI-053",
2224
+ title: "You Are Not Signed In",
2225
+ description: "The backend refused the request because this machine has no valid session. Run `axon login`. Resolving an engine, publishing, and deploying all need an account; building and running an agent against a local model do not.",
2226
+ source: "cli",
2227
+ severity: "fatal",
2228
+ expected: true,
2229
+ },
2230
+
2213
2231
  TEST_PRELOAD_MISSING: {
2214
2232
  code: "AX-TUI-036",
2215
2233
  title: "Test API Loaded Without Its Preload",
@@ -2351,7 +2369,7 @@ export const errorMap = {
2351
2369
  severity: "degraded",
2352
2370
  expected: true,
2353
2371
  },
2354
- MODEL_NOT_CACHED: {
2372
+ MODEL_NOT_ON_MACHINE: {
2355
2373
  code: "AX-MODEL-035",
2356
2374
  title: "That Model Is Not On This Machine",
2357
2375
  description: "A weight was asked for that has not been fetched. The daemon caches models content-addressed and machine-wide, so one download serves every agent — but it only serves what has actually been downloaded.",
package/src/stack.ts CHANGED
@@ -96,6 +96,14 @@ function withSource(frame: Omit<AxonStackFrame, "source">): AxonStackFrame {
96
96
  }
97
97
 
98
98
  /** `CONTEXT_LINES` of real source ± the reported line, captured as plain data — no disk access after this point. */
99
+ /**
100
+ * Past this, a line is machine-generated and there is no snippet to show.
101
+ *
102
+ * Generous — real source wraps long before this, and the failure mode being
103
+ * prevented is a single line of hundreds of thousands of characters.
104
+ */
105
+ const MAX_LINE_WIDTH = 400
106
+
99
107
  function readSourceWindow(fileName: string | null, lineNumber: number | null): AxonSourceLine[] | null {
100
108
  if (!fileName || lineNumber === null) return null
101
109
 
@@ -110,6 +118,22 @@ function readSourceWindow(fileName: string | null, lineNumber: number | null): A
110
118
  const targetIdx = lineNumber - 1
111
119
  if (targetIdx < 0 || targetIdx >= lines.length) return null
112
120
 
121
+ /**
122
+ * A MINIFIED file has no useful source window.
123
+ *
124
+ * The guard above anticipated a bundle being unreadable. A published
125
+ * bundle is perfectly readable — and minified, so one "line" is hundreds
126
+ * of kilobytes. Every unclassified error in a released build printed three
127
+ * of them: a wall of `function G8A(e){N8A.getStore()?.(e)...` where a code
128
+ * frame should be, which is the worst thing a user can be shown and made
129
+ * the actual message impossible to find.
130
+ *
131
+ * Judged by line WIDTH rather than by filename: `.min.js` is a convention,
132
+ * a 200KB line is the actual problem, and any file with one cannot produce
133
+ * a frame worth rendering.
134
+ */
135
+ if ((lines[targetIdx]?.length ?? 0) > MAX_LINE_WIDTH) return null
136
+
113
137
  const from = Math.max(0, targetIdx - CONTEXT_LINES)
114
138
  const to = Math.min(lines.length - 1, targetIdx + CONTEXT_LINES)
115
139