@aria-cli/types 1.0.12 → 1.0.13

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 (56) hide show
  1. package/dist/errors.d.ts +1 -0
  2. package/dist/errors.d.ts.map +1 -0
  3. package/dist/errors.js.map +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +1 -10
  7. package/dist/index.js.map +1 -0
  8. package/dist/logger.d.ts +1 -0
  9. package/dist/logger.d.ts.map +1 -0
  10. package/dist/logger.js.map +1 -0
  11. package/dist/memoria.d.ts +1 -0
  12. package/dist/memoria.d.ts.map +1 -0
  13. package/dist/memoria.js.map +1 -0
  14. package/dist/models.d.ts +1 -0
  15. package/dist/models.d.ts.map +1 -0
  16. package/dist/models.js.map +1 -0
  17. package/dist/native-tools.d.ts +1 -0
  18. package/dist/native-tools.d.ts.map +1 -0
  19. package/dist/native-tools.js.map +1 -0
  20. package/dist/relaunch.d.ts +1 -0
  21. package/dist/relaunch.d.ts.map +1 -0
  22. package/dist/relaunch.js.map +1 -0
  23. package/dist/stall-phase.d.ts +1 -0
  24. package/dist/stall-phase.d.ts.map +1 -0
  25. package/dist/stall-phase.js.map +1 -0
  26. package/dist/tool-outputs.d.ts +1 -0
  27. package/dist/tool-outputs.d.ts.map +1 -0
  28. package/dist/tool-outputs.js.map +1 -0
  29. package/dist-cjs/index.js +1 -28
  30. package/package.json +1 -1
  31. package/dist/errors.js +0 -45
  32. package/dist/logger.js +0 -162
  33. package/dist/memoria.js +0 -9
  34. package/dist/models.js +0 -16
  35. package/dist/native-tools.js +0 -28
  36. package/dist/relaunch.js +0 -58
  37. package/dist/stall-phase.js +0 -13
  38. package/dist/tool-outputs.js +0 -3
  39. package/dist-cjs/errors.js +0 -50
  40. package/dist-cjs/logger.js +0 -165
  41. package/dist-cjs/memoria.js +0 -10
  42. package/dist-cjs/models.js +0 -20
  43. package/dist-cjs/native-tools.js +0 -32
  44. package/dist-cjs/relaunch.js +0 -66
  45. package/dist-cjs/src/errors.js +0 -50
  46. package/dist-cjs/src/index.js +0 -27
  47. package/dist-cjs/src/logger.js +0 -84
  48. package/dist-cjs/src/memoria.js +0 -10
  49. package/dist-cjs/src/models.js +0 -20
  50. package/dist-cjs/src/native-tools.js +0 -32
  51. package/dist-cjs/src/relaunch.js +0 -60
  52. package/dist-cjs/src/tool-outputs.js +0 -4
  53. package/dist-cjs/stall-phase.js +0 -17
  54. package/dist-cjs/tests/logger.test.js +0 -64
  55. package/dist-cjs/tool-outputs.js +0 -4
  56. package/dist-cjs/vitest.config.js +0 -18
@@ -1,165 +0,0 @@
1
- "use strict";
2
- /**
3
- * Lightweight leveled logger for ARIA.
4
- *
5
- * Respects `ARIA_LOG_LEVEL` env var (debug | info | warn | error | silent).
6
- * Default level: "info" — debug messages are suppressed in normal usage.
7
- *
8
- * Architecture: logs dispatch through pluggable sinks. The default console
9
- * sink writes to stdout/stderr with ANSI styling. Execution contexts that
10
- * lack a terminal (daemon, headless server) replace or supplement it with
11
- * durable sinks (e.g., JSONL file sink). This decoupling makes it impossible
12
- * for diagnostic output to silently go to /dev/null — every context
13
- * configures the sink that matches its output channel.
14
- *
15
- * Usage:
16
- * import { log } from "@aria-cli/types";
17
- * log.debug("[PhaseTimer] ..."); // only prints when ARIA_LOG_LEVEL=debug
18
- * log.info("[runner] ..."); // prints at info level and above
19
- * log.warn("[runner] ..."); // prints at warn level and above
20
- * log.error("[runner] ..."); // always prints (unless level > error)
21
- *
22
- * Sink configuration (daemon example):
23
- * import { log } from "@aria-cli/types";
24
- * log.addSink(myFileLogSink);
25
- * log.removeConsoleSink(); // stdio is /dev/null in detached mode
26
- */
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.log = void 0;
29
- const DIM_GRAY = "\x1b[2m\x1b[90m";
30
- const CYAN = "\x1b[36m";
31
- const RESET = "\x1b[0m";
32
- const LEVEL_ORDER = {
33
- debug: 0,
34
- info: 1,
35
- warn: 2,
36
- error: 3,
37
- silent: 4,
38
- };
39
- function resolveLevel() {
40
- const env = typeof process !== "undefined" ? process.env.ARIA_LOG_LEVEL : undefined;
41
- if (env && env in LEVEL_ORDER)
42
- return env;
43
- return "info";
44
- }
45
- let currentLevel = resolveLevel();
46
- function enabled(level) {
47
- return LEVEL_ORDER[level] >= LEVEL_ORDER[currentLevel];
48
- }
49
- function isBrokenPipeError(error) {
50
- if (!error || typeof error !== "object") {
51
- return false;
52
- }
53
- const maybe = error;
54
- return maybe.code === "EPIPE" || maybe.code === "ERR_STREAM_DESTROYED";
55
- }
56
- function writeSafely(method, args) {
57
- try {
58
- method(...args);
59
- }
60
- catch (error) {
61
- if (isBrokenPipeError(error)) {
62
- return;
63
- }
64
- throw error;
65
- }
66
- }
67
- function styleSystemDebugArgs(args) {
68
- if (args.length === 0)
69
- return args;
70
- const [first, ...rest] = args;
71
- if (typeof first !== "string")
72
- return args;
73
- if (!first.startsWith("["))
74
- return args;
75
- return [`${DIM_GRAY}${first}${RESET}`, ...rest];
76
- }
77
- function styleSystemInfoArgs(args) {
78
- if (args.length === 0)
79
- return args;
80
- const [first, ...rest] = args;
81
- if (typeof first !== "string")
82
- return args;
83
- if (!first.startsWith("["))
84
- return args;
85
- return [`${CYAN}${first}${RESET}`, ...rest];
86
- }
87
- // ── Sinks ────────────────────────────────────────────────────────
88
- /** Default console sink — applies ANSI styling for terminal readability. */
89
- const consoleSink = {
90
- write(level, args) {
91
- let styled;
92
- let method;
93
- switch (level) {
94
- case "debug":
95
- styled = styleSystemDebugArgs(args);
96
- method = console.debug;
97
- break;
98
- case "info":
99
- styled = styleSystemInfoArgs(args);
100
- method = console.info;
101
- break;
102
- case "warn":
103
- styled = args;
104
- method = console.warn;
105
- break;
106
- default:
107
- styled = args;
108
- method = console.error;
109
- break;
110
- }
111
- writeSafely(method, styled);
112
- },
113
- };
114
- const sinks = [consoleSink];
115
- // ── Public API ───────────────────────────────────────────────────
116
- exports.log = {
117
- debug(...args) {
118
- if (enabled("debug"))
119
- for (const s of sinks)
120
- s.write("debug", args);
121
- },
122
- info(...args) {
123
- if (enabled("info"))
124
- for (const s of sinks)
125
- s.write("info", args);
126
- },
127
- warn(...args) {
128
- if (enabled("warn"))
129
- for (const s of sinks)
130
- s.write("warn", args);
131
- },
132
- error(...args) {
133
- if (enabled("error"))
134
- for (const s of sinks)
135
- s.write("error", args);
136
- },
137
- setLevel(level) {
138
- currentLevel = level;
139
- },
140
- getLevel() {
141
- return currentLevel;
142
- },
143
- /** Add a log sink. All subsequent log calls dispatch to it. */
144
- addSink(sink) {
145
- sinks.push(sink);
146
- },
147
- /** Remove a previously added sink. */
148
- removeSink(sink) {
149
- const idx = sinks.indexOf(sink);
150
- if (idx >= 0)
151
- sinks.splice(idx, 1);
152
- },
153
- /**
154
- * Remove the built-in console sink.
155
- *
156
- * Use this in execution contexts where stdio is unavailable (detached
157
- * daemon, headless server) AFTER adding a durable file sink. Prevents
158
- * wasted console.* calls that go to /dev/null.
159
- */
160
- removeConsoleSink() {
161
- const idx = sinks.indexOf(consoleSink);
162
- if (idx >= 0)
163
- sinks.splice(idx, 1);
164
- },
165
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * Minimal IMemoria interface for consumers that need memory capabilities
4
- * without depending on the concrete @aria/memoria package.
5
- *
6
- * Structural types (MemoryItem, ToolItem, RecallResult) replace bare
7
- * `unknown` returns so consumers get usable shapes without coupling to
8
- * the full Memoria domain model.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types for ARIA's multi-model system
4
- * @module @aria/types/models
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isFunctionToolSchema = isFunctionToolSchema;
8
- exports.isNativeToolSchema = isNativeToolSchema;
9
- /**
10
- * Type guard for function tools
11
- */
12
- function isFunctionToolSchema(tool) {
13
- return tool.kind === "function";
14
- }
15
- /**
16
- * Type guard for native tools
17
- */
18
- function isNativeToolSchema(tool) {
19
- return tool.kind === "native";
20
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * Native tool types and type guards for provider-native capabilities
4
- * @module @aria/types/native-tools
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isFunctionTool = isFunctionTool;
8
- exports.isNativeTool = isNativeTool;
9
- /**
10
- * Type guard to check if a tool call is a function/custom tool
11
- * (as opposed to a native provider tool like search or code execution)
12
- */
13
- function isFunctionTool(toolCall) {
14
- // Function tools are the default - they don't have special name prefixes
15
- return !isNativeTool(toolCall);
16
- }
17
- /**
18
- * Type guard to check if a tool call is a native provider tool
19
- * Native tools have special name prefixes like "brave_search", "computer", etc.
20
- */
21
- function isNativeTool(toolCall) {
22
- const nativePrefixes = [
23
- "brave_search",
24
- "computer",
25
- "code_interpreter",
26
- "text_editor",
27
- "bash",
28
- "dalle",
29
- "file_search",
30
- ];
31
- return nativePrefixes.some((prefix) => toolCall.name.startsWith(prefix));
32
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RESTART_KIND_ENV = exports.RESUME_ARION_ENV = exports.RESUME_SESSION_ENV = exports.NO_RELAUNCH_ENV = exports.RELAUNCH_EXIT_CODE = void 0;
4
- exports.getRelaunchMarkerDir = getRelaunchMarkerDir;
5
- exports.getRelaunchMarkerPath = getRelaunchMarkerPath;
6
- exports.writeRelaunchMarker = writeRelaunchMarker;
7
- exports.readRelaunchMarker = readRelaunchMarker;
8
- exports.clearRelaunchMarker = clearRelaunchMarker;
9
- const node_fs_1 = require("node:fs");
10
- const node_os_1 = require("node:os");
11
- const node_path_1 = require("node:path");
12
- /**
13
- * Magic exit code that tells the parent supervisor to respawn the child.
14
- */
15
- exports.RELAUNCH_EXIT_CODE = 199;
16
- /**
17
- * Environment variables used by relaunch/supervisor flows.
18
- */
19
- exports.NO_RELAUNCH_ENV = "ARIA_NO_RELAUNCH";
20
- exports.RESUME_SESSION_ENV = "ARIA_RESUME_SESSION_ID";
21
- exports.RESUME_ARION_ENV = "ARIA_RESUME_ARION";
22
- exports.RESTART_KIND_ENV = "ARIA_RESTART_KIND";
23
- function getAriaDir() {
24
- const ariaHome = process.env.ARIA_HOME?.trim();
25
- if (ariaHome)
26
- return ariaHome;
27
- return (0, node_path_1.join)((0, node_os_1.homedir)(), ".aria");
28
- }
29
- function getRelaunchMarkerDir() {
30
- return (0, node_path_1.join)(getAriaDir(), "relaunch-pending");
31
- }
32
- function getRelaunchMarkerPath(pid = process.pid) {
33
- return (0, node_path_1.join)(getRelaunchMarkerDir(), `${pid}.json`);
34
- }
35
- function writeRelaunchMarker(marker) {
36
- try {
37
- const markerPath = getRelaunchMarkerPath(marker.pid);
38
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(markerPath), { recursive: true });
39
- (0, node_fs_1.writeFileSync)(markerPath, JSON.stringify(marker), "utf-8");
40
- }
41
- catch {
42
- // Best-effort — must never prevent restart
43
- }
44
- }
45
- function readRelaunchMarker(pid = process.pid) {
46
- try {
47
- const markerPath = getRelaunchMarkerPath(pid);
48
- if (!(0, node_fs_1.existsSync)(markerPath))
49
- return null;
50
- const raw = (0, node_fs_1.readFileSync)(markerPath, "utf-8");
51
- return JSON.parse(raw);
52
- }
53
- catch {
54
- return null;
55
- }
56
- }
57
- function clearRelaunchMarker(pid = process.pid) {
58
- try {
59
- const markerPath = getRelaunchMarkerPath(pid);
60
- if ((0, node_fs_1.existsSync)(markerPath))
61
- (0, node_fs_1.unlinkSync)(markerPath);
62
- }
63
- catch {
64
- // Best-effort
65
- }
66
- }
@@ -1,50 +0,0 @@
1
- "use strict";
2
- /**
3
- * Error narrowing utilities for replacing `catch (err: any)` patterns.
4
- * @module @aria-cli/types/errors
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getErrorMessage = getErrorMessage;
8
- exports.getErrorStatusCode = getErrorStatusCode;
9
- exports.isNodeError = isNodeError;
10
- /**
11
- * Extract a human-readable message from an unknown caught value.
12
- *
13
- * Replaces the pattern:
14
- * `catch (err: any) { ... err.message ... }`
15
- * with:
16
- * `catch (err: unknown) { ... getErrorMessage(err) ... }`
17
- */
18
- function getErrorMessage(err) {
19
- if (err instanceof Error)
20
- return err.message;
21
- if (typeof err === "string")
22
- return err;
23
- return String(err);
24
- }
25
- /**
26
- * Extract an HTTP-style status code from an unknown caught value.
27
- *
28
- * Replaces the pattern:
29
- * `(error as any).statusCode`
30
- * with:
31
- * `getErrorStatusCode(error)`
32
- */
33
- function getErrorStatusCode(err) {
34
- if (typeof err === "object" &&
35
- err !== null &&
36
- "statusCode" in err &&
37
- typeof err.statusCode === "number") {
38
- return err.statusCode;
39
- }
40
- return undefined;
41
- }
42
- /**
43
- * Type guard: is this caught value an Error with a `.code` property?
44
- * Common for Node.js system errors (ENOENT, ECONNREFUSED, etc.)
45
- */
46
- function isNodeError(err) {
47
- return (err instanceof Error &&
48
- "code" in err &&
49
- typeof err.code === "string");
50
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /**
3
- * @aria-cli/types - Minimal shared types
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.log = void 0;
21
- __exportStar(require("./models.js"), exports);
22
- __exportStar(require("./memoria.js"), exports);
23
- __exportStar(require("./errors.js"), exports);
24
- __exportStar(require("./native-tools.js"), exports);
25
- __exportStar(require("./relaunch.js"), exports);
26
- var logger_js_1 = require("./logger.js");
27
- Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logger_js_1.log; } });
@@ -1,84 +0,0 @@
1
- "use strict";
2
- /**
3
- * Lightweight leveled logger for ARIA.
4
- *
5
- * Respects `ARIA_LOG_LEVEL` env var (debug | info | warn | error | silent).
6
- * Default level: "info" — debug messages are suppressed in normal usage.
7
- *
8
- * Usage:
9
- * import { log } from "@aria-cli/types";
10
- * log.debug("[PhaseTimer] ..."); // only prints when ARIA_LOG_LEVEL=debug
11
- * log.info("[runner] ..."); // prints at info level and above
12
- * log.warn("[runner] ..."); // prints at warn level and above
13
- * log.error("[runner] ..."); // always prints (unless level > error)
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.log = void 0;
17
- const DIM_GRAY = "\x1b[2m\x1b[90m";
18
- const CYAN = "\x1b[36m";
19
- const RESET = "\x1b[0m";
20
- const LEVEL_ORDER = {
21
- debug: 0,
22
- info: 1,
23
- warn: 2,
24
- error: 3,
25
- silent: 4,
26
- };
27
- function resolveLevel() {
28
- const env = typeof process !== "undefined" ? process.env.ARIA_LOG_LEVEL : undefined;
29
- if (env && env in LEVEL_ORDER)
30
- return env;
31
- return "info";
32
- }
33
- let currentLevel = resolveLevel();
34
- function enabled(level) {
35
- return LEVEL_ORDER[level] >= LEVEL_ORDER[currentLevel];
36
- }
37
- function styleSystemDebugArgs(args) {
38
- if (args.length === 0)
39
- return args;
40
- const [first, ...rest] = args;
41
- if (typeof first !== "string")
42
- return args;
43
- // Style internal system-style tags like "[runner] ..." while leaving
44
- // plain debug payloads untouched.
45
- if (!first.startsWith("["))
46
- return args;
47
- return [`${DIM_GRAY}${first}${RESET}`, ...rest];
48
- }
49
- function styleSystemInfoArgs(args) {
50
- if (args.length === 0)
51
- return args;
52
- const [first, ...rest] = args;
53
- if (typeof first !== "string")
54
- return args;
55
- // Style system-tagged info lines so users can visually distinguish
56
- // internal operational info from assistant content.
57
- if (!first.startsWith("["))
58
- return args;
59
- return [`${CYAN}${first}${RESET}`, ...rest];
60
- }
61
- exports.log = {
62
- debug(...args) {
63
- if (enabled("debug"))
64
- console.debug(...styleSystemDebugArgs(args));
65
- },
66
- info(...args) {
67
- if (enabled("info"))
68
- console.info(...styleSystemInfoArgs(args));
69
- },
70
- warn(...args) {
71
- if (enabled("warn"))
72
- console.warn(...args);
73
- },
74
- error(...args) {
75
- if (enabled("error"))
76
- console.error(...args);
77
- },
78
- setLevel(level) {
79
- currentLevel = level;
80
- },
81
- getLevel() {
82
- return currentLevel;
83
- },
84
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * Minimal IMemoria interface for consumers that need memory capabilities
4
- * without depending on the concrete @aria-cli/memoria package.
5
- *
6
- * Structural types (MemoryItem, ToolItem, RecallResult) replace bare
7
- * `unknown` returns so consumers get usable shapes without coupling to
8
- * the full Memoria domain model.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types for ARIA's multi-model system
4
- * @module @aria-cli/types/models
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isFunctionToolSchema = isFunctionToolSchema;
8
- exports.isNativeToolSchema = isNativeToolSchema;
9
- /**
10
- * Type guard for function tools
11
- */
12
- function isFunctionToolSchema(tool) {
13
- return tool.kind === "function";
14
- }
15
- /**
16
- * Type guard for native tools
17
- */
18
- function isNativeToolSchema(tool) {
19
- return tool.kind === "native";
20
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * Native tool types and type guards for provider-native capabilities
4
- * @module @aria-cli/types/native-tools
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isFunctionTool = isFunctionTool;
8
- exports.isNativeTool = isNativeTool;
9
- /**
10
- * Type guard to check if a tool call is a function/custom tool
11
- * (as opposed to a native provider tool like search or code execution)
12
- */
13
- function isFunctionTool(toolCall) {
14
- // Function tools are the default - they don't have special name prefixes
15
- return !isNativeTool(toolCall);
16
- }
17
- /**
18
- * Type guard to check if a tool call is a native provider tool
19
- * Native tools have special name prefixes like "brave_search", "computer", etc.
20
- */
21
- function isNativeTool(toolCall) {
22
- const nativePrefixes = [
23
- "brave_search",
24
- "computer",
25
- "code_interpreter",
26
- "text_editor",
27
- "bash",
28
- "dalle",
29
- "file_search",
30
- ];
31
- return nativePrefixes.some((prefix) => toolCall.name.startsWith(prefix));
32
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RESTART_KIND_ENV = exports.RESUME_ARION_ENV = exports.RESUME_SESSION_ENV = exports.NO_RELAUNCH_ENV = exports.RELAUNCH_EXIT_CODE = void 0;
4
- exports.getRelaunchMarkerDir = getRelaunchMarkerDir;
5
- exports.getRelaunchMarkerPath = getRelaunchMarkerPath;
6
- exports.writeRelaunchMarker = writeRelaunchMarker;
7
- exports.readRelaunchMarker = readRelaunchMarker;
8
- exports.clearRelaunchMarker = clearRelaunchMarker;
9
- const node_fs_1 = require("node:fs");
10
- const node_os_1 = require("node:os");
11
- const node_path_1 = require("node:path");
12
- /**
13
- * Magic exit code that tells the parent supervisor to respawn the child.
14
- */
15
- exports.RELAUNCH_EXIT_CODE = 199;
16
- /**
17
- * Environment variables used by relaunch/supervisor flows.
18
- */
19
- exports.NO_RELAUNCH_ENV = "ARIA_NO_RELAUNCH";
20
- exports.RESUME_SESSION_ENV = "ARIA_RESUME_SESSION_ID";
21
- exports.RESUME_ARION_ENV = "ARIA_RESUME_ARION";
22
- exports.RESTART_KIND_ENV = "ARIA_RESTART_KIND";
23
- function getRelaunchMarkerDir() {
24
- return (0, node_path_1.join)((0, node_os_1.homedir)(), ".aria", "relaunch-pending");
25
- }
26
- function getRelaunchMarkerPath(pid = process.pid) {
27
- return (0, node_path_1.join)(getRelaunchMarkerDir(), `${pid}.json`);
28
- }
29
- function writeRelaunchMarker(marker) {
30
- try {
31
- const markerPath = getRelaunchMarkerPath(marker.pid);
32
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(markerPath), { recursive: true });
33
- (0, node_fs_1.writeFileSync)(markerPath, JSON.stringify(marker), "utf-8");
34
- }
35
- catch {
36
- // Best-effort — must never prevent restart
37
- }
38
- }
39
- function readRelaunchMarker(pid = process.pid) {
40
- try {
41
- const markerPath = getRelaunchMarkerPath(pid);
42
- if (!(0, node_fs_1.existsSync)(markerPath))
43
- return null;
44
- const raw = (0, node_fs_1.readFileSync)(markerPath, "utf-8");
45
- return JSON.parse(raw);
46
- }
47
- catch {
48
- return null;
49
- }
50
- }
51
- function clearRelaunchMarker(pid = process.pid) {
52
- try {
53
- const markerPath = getRelaunchMarkerPath(pid);
54
- if ((0, node_fs_1.existsSync)(markerPath))
55
- (0, node_fs_1.unlinkSync)(markerPath);
56
- }
57
- catch {
58
- // Best-effort
59
- }
60
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- /** Canonical output shapes for tools with dedicated renderers.
3
- * Executors MUST return these shapes. Renderers consume them directly. */
4
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setGlobalStallPhase = setGlobalStallPhase;
4
- exports.clearGlobalStallPhase = clearGlobalStallPhase;
5
- function getGlobalPhaseStore() {
6
- return globalThis;
7
- }
8
- function setGlobalStallPhase(label) {
9
- const store = getGlobalPhaseStore();
10
- store.__aria_stall_phase = label;
11
- store.__aria_stall_phase_ts = performance.now();
12
- }
13
- function clearGlobalStallPhase() {
14
- const store = getGlobalPhaseStore();
15
- store.__aria_stall_phase = undefined;
16
- store.__aria_stall_phase_ts = undefined;
17
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const logger_js_1 = require("../src/logger.js");
5
- (0, vitest_1.describe)("leveled logger", () => {
6
- let originalLevel;
7
- (0, vitest_1.beforeEach)(() => {
8
- originalLevel = logger_js_1.log.getLevel();
9
- // Reset to default "info" before each test
10
- logger_js_1.log.setLevel("info");
11
- });
12
- (0, vitest_1.afterEach)(() => {
13
- logger_js_1.log.setLevel(originalLevel);
14
- vitest_1.vi.restoreAllMocks();
15
- });
16
- (0, vitest_1.it)('default level is "info" — log.debug() does NOT call console.debug', () => {
17
- const spy = vitest_1.vi.spyOn(console, "debug").mockImplementation(() => { });
18
- logger_js_1.log.debug("should be suppressed");
19
- (0, vitest_1.expect)(spy).not.toHaveBeenCalled();
20
- });
21
- (0, vitest_1.it)('default level "info" — log.info() DOES call console.info', () => {
22
- const spy = vitest_1.vi.spyOn(console, "info").mockImplementation(() => { });
23
- logger_js_1.log.info("hello from info");
24
- (0, vitest_1.expect)(spy).toHaveBeenCalledWith("hello from info");
25
- });
26
- (0, vitest_1.it)('default level "info" — log.warn() and log.error() work', () => {
27
- const warnSpy = vitest_1.vi.spyOn(console, "warn").mockImplementation(() => { });
28
- const errorSpy = vitest_1.vi.spyOn(console, "error").mockImplementation(() => { });
29
- logger_js_1.log.warn("a warning");
30
- logger_js_1.log.error("an error");
31
- (0, vitest_1.expect)(warnSpy).toHaveBeenCalledWith("a warning");
32
- (0, vitest_1.expect)(errorSpy).toHaveBeenCalledWith("an error");
33
- });
34
- (0, vitest_1.it)('after setLevel("debug") — log.debug() DOES call console.debug', () => {
35
- logger_js_1.log.setLevel("debug");
36
- const spy = vitest_1.vi.spyOn(console, "debug").mockImplementation(() => { });
37
- logger_js_1.log.debug("debug message");
38
- (0, vitest_1.expect)(spy).toHaveBeenCalledWith("debug message");
39
- });
40
- (0, vitest_1.it)('after setLevel("silent") — nothing calls console methods', () => {
41
- logger_js_1.log.setLevel("silent");
42
- const debugSpy = vitest_1.vi.spyOn(console, "debug").mockImplementation(() => { });
43
- const infoSpy = vitest_1.vi.spyOn(console, "info").mockImplementation(() => { });
44
- const warnSpy = vitest_1.vi.spyOn(console, "warn").mockImplementation(() => { });
45
- const errorSpy = vitest_1.vi.spyOn(console, "error").mockImplementation(() => { });
46
- logger_js_1.log.debug("nope");
47
- logger_js_1.log.info("nope");
48
- logger_js_1.log.warn("nope");
49
- logger_js_1.log.error("nope");
50
- (0, vitest_1.expect)(debugSpy).not.toHaveBeenCalled();
51
- (0, vitest_1.expect)(infoSpy).not.toHaveBeenCalled();
52
- (0, vitest_1.expect)(warnSpy).not.toHaveBeenCalled();
53
- (0, vitest_1.expect)(errorSpy).not.toHaveBeenCalled();
54
- });
55
- (0, vitest_1.it)("getLevel() returns the current level", () => {
56
- (0, vitest_1.expect)(logger_js_1.log.getLevel()).toBe("info");
57
- logger_js_1.log.setLevel("debug");
58
- (0, vitest_1.expect)(logger_js_1.log.getLevel()).toBe("debug");
59
- logger_js_1.log.setLevel("error");
60
- (0, vitest_1.expect)(logger_js_1.log.getLevel()).toBe("error");
61
- logger_js_1.log.setLevel("silent");
62
- (0, vitest_1.expect)(logger_js_1.log.getLevel()).toBe("silent");
63
- });
64
- });
@@ -1,4 +0,0 @@
1
- "use strict";
2
- /** Canonical output shapes for tools with dedicated renderers.
3
- * Executors MUST return these shapes. Renderers consume them directly. */
4
- Object.defineProperty(exports, "__esModule", { value: true });