@aria-cli/types 1.0.12 → 1.0.14

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.
@@ -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 });
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("vitest/config");
4
- const vitest_shared_ts_1 = require("../../vitest.shared.ts");
5
- exports.default = (0, config_1.defineConfig)({
6
- test: {
7
- ...vitest_shared_ts_1.sharedPoolConfig,
8
- globals: true,
9
- exclude: (0, vitest_shared_ts_1.getExcludes)(),
10
- coverage: {
11
- provider: "v8",
12
- reporter: ["text", "json", "html"],
13
- reportOnFailure: true,
14
- include: ["src/**"],
15
- exclude: ["**/__tests__/**", "**/*.test.ts"],
16
- },
17
- },
18
- });