@testany/hephos 0.3.0
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/LICENSE +8 -0
- package/README.md +79 -0
- package/out/LocalExecutionEnvironment.d.ts +23 -0
- package/out/LocalExecutionEnvironment.d.ts.map +1 -0
- package/out/LocalExecutionEnvironment.js +124 -0
- package/out/LocalExecutionEnvironment.js.map +1 -0
- package/out/adapters/AdapterFactory.d.ts +55 -0
- package/out/adapters/AdapterFactory.d.ts.map +1 -0
- package/out/adapters/AdapterFactory.js +117 -0
- package/out/adapters/AdapterFactory.js.map +1 -0
- package/out/adapters/ClaudeCodeAdapter.d.ts +28 -0
- package/out/adapters/ClaudeCodeAdapter.d.ts.map +1 -0
- package/out/adapters/ClaudeCodeAdapter.js +95 -0
- package/out/adapters/ClaudeCodeAdapter.js.map +1 -0
- package/out/adapters/GenericShellAdapter.d.ts +51 -0
- package/out/adapters/GenericShellAdapter.d.ts.map +1 -0
- package/out/adapters/GenericShellAdapter.js +162 -0
- package/out/adapters/GenericShellAdapter.js.map +1 -0
- package/out/adapters/OpenAICodexAdapter.d.ts +36 -0
- package/out/adapters/OpenAICodexAdapter.d.ts.map +1 -0
- package/out/adapters/OpenAICodexAdapter.js +155 -0
- package/out/adapters/OpenAICodexAdapter.js.map +1 -0
- package/out/adapters/index.d.ts +12 -0
- package/out/adapters/index.d.ts.map +1 -0
- package/out/adapters/index.js +12 -0
- package/out/adapters/index.js.map +1 -0
- package/out/cli-layer-index.d.ts +14 -0
- package/out/cli-layer-index.d.ts.map +1 -0
- package/out/cli-layer-index.js +15 -0
- package/out/cli-layer-index.js.map +1 -0
- package/out/cli.d.ts +8 -0
- package/out/cli.d.ts.map +1 -0
- package/out/cli.js +297 -0
- package/out/cli.js.map +1 -0
- package/out/commands/AgentsCommand.d.ts +47 -0
- package/out/commands/AgentsCommand.d.ts.map +1 -0
- package/out/commands/AgentsCommand.js +487 -0
- package/out/commands/AgentsCommand.js.map +1 -0
- package/out/config/ConfigAdapter.d.ts +58 -0
- package/out/config/ConfigAdapter.d.ts.map +1 -0
- package/out/config/ConfigAdapter.js +95 -0
- package/out/config/ConfigAdapter.js.map +1 -0
- package/out/config/UIPreferences.d.ts +24 -0
- package/out/config/UIPreferences.d.ts.map +1 -0
- package/out/config/UIPreferences.js +18 -0
- package/out/config/UIPreferences.js.map +1 -0
- package/out/config/index.d.ts +9 -0
- package/out/config/index.d.ts.map +1 -0
- package/out/config/index.js +9 -0
- package/out/config/index.js.map +1 -0
- package/out/outputs/ConsoleLogger.d.ts +30 -0
- package/out/outputs/ConsoleLogger.d.ts.map +1 -0
- package/out/outputs/ConsoleLogger.js +54 -0
- package/out/outputs/ConsoleLogger.js.map +1 -0
- package/out/outputs/ConsoleOutput.d.ts +30 -0
- package/out/outputs/ConsoleOutput.d.ts.map +1 -0
- package/out/outputs/ConsoleOutput.js +49 -0
- package/out/outputs/ConsoleOutput.js.map +1 -0
- package/out/outputs/IOutput.d.ts +38 -0
- package/out/outputs/IOutput.d.ts.map +1 -0
- package/out/outputs/IOutput.js +13 -0
- package/out/outputs/IOutput.js.map +1 -0
- package/out/outputs/InkOutput.d.ts +24 -0
- package/out/outputs/InkOutput.d.ts.map +1 -0
- package/out/outputs/InkOutput.js +38 -0
- package/out/outputs/InkOutput.js.map +1 -0
- package/out/repl/ReplModeInk.d.ts +8 -0
- package/out/repl/ReplModeInk.d.ts.map +1 -0
- package/out/repl/ReplModeInk.js +1486 -0
- package/out/repl/ReplModeInk.js.map +1 -0
- package/out/repl/components/AgentsMenu.d.ts +7 -0
- package/out/repl/components/AgentsMenu.d.ts.map +1 -0
- package/out/repl/components/AgentsMenu.js +565 -0
- package/out/repl/components/AgentsMenu.js.map +1 -0
- package/out/repl/components/LoadingIndicator.d.ts +5 -0
- package/out/repl/components/LoadingIndicator.d.ts.map +1 -0
- package/out/repl/components/LoadingIndicator.js +14 -0
- package/out/repl/components/LoadingIndicator.js.map +1 -0
- package/out/repl/components/QueueDisplay.d.ts +18 -0
- package/out/repl/components/QueueDisplay.d.ts.map +1 -0
- package/out/repl/components/QueueDisplay.js +16 -0
- package/out/repl/components/QueueDisplay.js.map +1 -0
- package/out/repl/components/RestorePrompt.d.ts +25 -0
- package/out/repl/components/RestorePrompt.d.ts.map +1 -0
- package/out/repl/components/RestorePrompt.js +32 -0
- package/out/repl/components/RestorePrompt.js.map +1 -0
- package/out/repl/components/StreamingDisplay.d.ts +5 -0
- package/out/repl/components/StreamingDisplay.d.ts.map +1 -0
- package/out/repl/components/StreamingDisplay.js +27 -0
- package/out/repl/components/StreamingDisplay.js.map +1 -0
- package/out/repl/components/ThinkingIndicator.d.ts +19 -0
- package/out/repl/components/ThinkingIndicator.d.ts.map +1 -0
- package/out/repl/components/ThinkingIndicator.js +35 -0
- package/out/repl/components/ThinkingIndicator.js.map +1 -0
- package/out/repl/wizard/wizardStep1Reducer.d.ts +30 -0
- package/out/repl/wizard/wizardStep1Reducer.d.ts.map +1 -0
- package/out/repl/wizard/wizardStep1Reducer.js +189 -0
- package/out/repl/wizard/wizardStep1Reducer.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfigAdapter - 配置适配器
|
|
3
|
+
*
|
|
4
|
+
* @file src/cli/config/ConfigAdapter.ts
|
|
5
|
+
* @layer CLI
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* 将旧版 CLIConfig 拆分为 CoreTeamConfig + UIPreferences。
|
|
9
|
+
* 保持向后兼容性,用户配置文件格式无需更改。
|
|
10
|
+
*/
|
|
11
|
+
import { DEFAULT_UI_PREFERENCES } from './UIPreferences.js';
|
|
12
|
+
/**
|
|
13
|
+
* 配置适配器
|
|
14
|
+
*
|
|
15
|
+
* 将旧版 CLIConfig 拆分为 CoreTeamConfig + UIPreferences
|
|
16
|
+
*/
|
|
17
|
+
export class ConfigAdapter {
|
|
18
|
+
/**
|
|
19
|
+
* 拆分配置
|
|
20
|
+
*
|
|
21
|
+
* @param config - 旧版完整配置
|
|
22
|
+
* @returns 拆分后的 Core 配置和 UI 偏好
|
|
23
|
+
*/
|
|
24
|
+
static split(config) {
|
|
25
|
+
const conversation = config.conversation;
|
|
26
|
+
// 提取 Core 配置
|
|
27
|
+
const coreConfig = {
|
|
28
|
+
schemaVersion: config.schemaVersion,
|
|
29
|
+
agents: config.agents,
|
|
30
|
+
team: config.team,
|
|
31
|
+
maxRounds: config.maxRounds,
|
|
32
|
+
conversation: this.extractCoreConversation(conversation),
|
|
33
|
+
};
|
|
34
|
+
// 提取 UI 偏好
|
|
35
|
+
const uiPrefs = this.extractUIPreferences(conversation);
|
|
36
|
+
return { coreConfig, uiPrefs };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 提取 Core 对话配置
|
|
40
|
+
*/
|
|
41
|
+
static extractCoreConversation(conversation) {
|
|
42
|
+
if (!conversation) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
// 仅保留 Core 字段
|
|
46
|
+
const { maxAgentResponseTime } = conversation;
|
|
47
|
+
// 如果没有 Core 字段,返回 undefined
|
|
48
|
+
if (maxAgentResponseTime === undefined) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return { maxAgentResponseTime };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 提取 UI 偏好
|
|
55
|
+
*/
|
|
56
|
+
static extractUIPreferences(conversation) {
|
|
57
|
+
return {
|
|
58
|
+
showThinkingTimer: conversation?.showThinkingTimer ?? DEFAULT_UI_PREFERENCES.showThinkingTimer,
|
|
59
|
+
allowEscCancel: conversation?.allowEscCancel ?? DEFAULT_UI_PREFERENCES.allowEscCancel,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 合并配置(用于保存)
|
|
64
|
+
*
|
|
65
|
+
* @param coreConfig - Core 配置
|
|
66
|
+
* @param uiPrefs - UI 偏好
|
|
67
|
+
* @returns 合并后的旧版配置(用于保存到文件)
|
|
68
|
+
*/
|
|
69
|
+
static merge(coreConfig, uiPrefs) {
|
|
70
|
+
return {
|
|
71
|
+
schemaVersion: coreConfig.schemaVersion,
|
|
72
|
+
agents: coreConfig.agents,
|
|
73
|
+
team: coreConfig.team,
|
|
74
|
+
maxRounds: coreConfig.maxRounds,
|
|
75
|
+
conversation: {
|
|
76
|
+
...coreConfig.conversation,
|
|
77
|
+
showThinkingTimer: uiPrefs.showThinkingTimer,
|
|
78
|
+
allowEscCancel: uiPrefs.allowEscCancel,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 便捷函数:拆分配置
|
|
85
|
+
*/
|
|
86
|
+
export function splitConfig(config) {
|
|
87
|
+
return ConfigAdapter.split(config);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 便捷函数:合并配置
|
|
91
|
+
*/
|
|
92
|
+
export function mergeConfig(coreConfig, uiPrefs) {
|
|
93
|
+
return ConfigAdapter.merge(coreConfig, uiPrefs);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=ConfigAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigAdapter.js","sourceRoot":"","sources":["../../src/config/ConfigAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAsB,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEhF;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACxB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,MAAiB;QAI5B,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QAEzC,aAAa;QACb,MAAM,UAAU,GAAmB;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SA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,OAAO,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,UAA0B,EAAE,OAAsB;IAC5E,OAAO,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIPreferences - UI 偏好配置
|
|
3
|
+
*
|
|
4
|
+
* @file src/cli/config/UIPreferences.ts
|
|
5
|
+
* @layer CLI
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* 仅包含 UI 展示相关字段,与 Core 逻辑无关。
|
|
9
|
+
* Core 业务配置在 CoreTeamConfig 中定义。
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* UI 偏好配置
|
|
13
|
+
*/
|
|
14
|
+
export interface UIPreferences {
|
|
15
|
+
/** 是否显示 Agent 思考计时器 */
|
|
16
|
+
showThinkingTimer: boolean;
|
|
17
|
+
/** 是否允许 ESC 键取消操作 */
|
|
18
|
+
allowEscCancel: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 默认 UI 偏好
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_UI_PREFERENCES: UIPreferences;
|
|
24
|
+
//# sourceMappingURL=UIPreferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIPreferences.d.ts","sourceRoot":"","sources":["../../src/config/UIPreferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAE3B,qBAAqB;IACrB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIPreferences - UI 偏好配置
|
|
3
|
+
*
|
|
4
|
+
* @file src/cli/config/UIPreferences.ts
|
|
5
|
+
* @layer CLI
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* 仅包含 UI 展示相关字段,与 Core 逻辑无关。
|
|
9
|
+
* Core 业务配置在 CoreTeamConfig 中定义。
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 默认 UI 偏好
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_UI_PREFERENCES = {
|
|
15
|
+
showThinkingTimer: true,
|
|
16
|
+
allowEscCancel: true,
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=UIPreferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIPreferences.js","sourceRoot":"","sources":["../../src/config/UIPreferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,iBAAiB,EAAE,IAAI;IACvB,cAAc,EAAE,IAAI;CACrB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Config Module Exports
|
|
3
|
+
*
|
|
4
|
+
* @file src/cli/config/index.ts
|
|
5
|
+
* @layer CLI
|
|
6
|
+
*/
|
|
7
|
+
export { type UIPreferences, DEFAULT_UI_PREFERENCES } from './UIPreferences.js';
|
|
8
|
+
export { ConfigAdapter, splitConfig, mergeConfig } from './ConfigAdapter.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Config Module Exports
|
|
3
|
+
*
|
|
4
|
+
* @file src/cli/config/index.ts
|
|
5
|
+
* @layer CLI
|
|
6
|
+
*/
|
|
7
|
+
export { DEFAULT_UI_PREFERENCES } from './UIPreferences.js';
|
|
8
|
+
export { ConfigAdapter, splitConfig, mergeConfig } from './ConfigAdapter.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAsB,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConsoleLogger - CLI implementation of ILogger
|
|
3
|
+
*
|
|
4
|
+
* Provides console-based logging for CLI/REPL usage.
|
|
5
|
+
* Implements ILogger interface from Core.
|
|
6
|
+
*/
|
|
7
|
+
import type { ILogger } from '@testany/agent-chatter-core';
|
|
8
|
+
export interface ConsoleLoggerOptions {
|
|
9
|
+
/** Enable colored output (default: true) */
|
|
10
|
+
colors?: boolean;
|
|
11
|
+
/** Show debug messages (default: false) */
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
/** Prefix for all messages (default: none) */
|
|
14
|
+
prefix?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Console-based logger implementation
|
|
18
|
+
*
|
|
19
|
+
* Maps ILogger methods to console.* calls with optional color formatting.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ConsoleLogger implements ILogger {
|
|
22
|
+
private options;
|
|
23
|
+
constructor(options?: ConsoleLoggerOptions);
|
|
24
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
25
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
26
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
27
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
28
|
+
private format;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ConsoleLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../src/outputs/ConsoleLogger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,OAAO,CAAuE;gBAE1E,OAAO,GAAE,oBAAyB;IAQ9C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAU/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAM9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAM9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAM/D,OAAO,CAAC,MAAM;CAOf"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConsoleLogger - CLI implementation of ILogger
|
|
3
|
+
*
|
|
4
|
+
* Provides console-based logging for CLI/REPL usage.
|
|
5
|
+
* Implements ILogger interface from Core.
|
|
6
|
+
*/
|
|
7
|
+
import { colorize } from '@testany/agent-chatter-core';
|
|
8
|
+
/**
|
|
9
|
+
* Console-based logger implementation
|
|
10
|
+
*
|
|
11
|
+
* Maps ILogger methods to console.* calls with optional color formatting.
|
|
12
|
+
*/
|
|
13
|
+
export class ConsoleLogger {
|
|
14
|
+
options;
|
|
15
|
+
constructor(options = {}) {
|
|
16
|
+
this.options = {
|
|
17
|
+
colors: options.colors ?? true,
|
|
18
|
+
debug: options.debug ?? false,
|
|
19
|
+
prefix: options.prefix,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
debug(message, context) {
|
|
23
|
+
if (!this.options.debug) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const formatted = this.format(message, context);
|
|
27
|
+
const text = this.options.colors ? colorize(formatted, 'dim') : formatted;
|
|
28
|
+
// Debug output goes to stderr for easy redirection
|
|
29
|
+
console.error(text);
|
|
30
|
+
}
|
|
31
|
+
info(message, context) {
|
|
32
|
+
const formatted = this.format(message, context);
|
|
33
|
+
const text = this.options.colors ? colorize(formatted, 'cyan') : formatted;
|
|
34
|
+
console.log(text);
|
|
35
|
+
}
|
|
36
|
+
warn(message, context) {
|
|
37
|
+
const formatted = this.format(message, context);
|
|
38
|
+
const text = this.options.colors ? colorize(formatted, 'yellow') : formatted;
|
|
39
|
+
console.warn(text);
|
|
40
|
+
}
|
|
41
|
+
error(message, context) {
|
|
42
|
+
const formatted = this.format(message, context);
|
|
43
|
+
const text = this.options.colors ? colorize(formatted, 'red') : formatted;
|
|
44
|
+
console.error(text);
|
|
45
|
+
}
|
|
46
|
+
format(message, context) {
|
|
47
|
+
let result = this.options.prefix ? `${this.options.prefix} ${message}` : message;
|
|
48
|
+
if (context && Object.keys(context).length > 0) {
|
|
49
|
+
result += ` ${JSON.stringify(context)}`;
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ConsoleLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.js","sourceRoot":"","sources":["../../src/outputs/ConsoleLogger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAWvD;;;;GAIG;AACH,MAAM,OAAO,aAAa;IAChB,OAAO,CAAuE;IAEtF,YAAY,UAAgC,EAAE;QAC5C,IAAI,CAAC,OAAO,GAAG;YACb,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;YAC9B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;YAC7B,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,OAAiC;QACtD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,mDAAmD;QACnD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,OAAiC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3E,OAAO,CAAC,GA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|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Console-backed implementation of IOutput.
|
|
8
|
+
* Used by CLI/legacy REPL to centralize formatting, colors, and verbosity control.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConsoleOutput implements IOutput {
|
|
11
|
+
private options;
|
|
12
|
+
constructor(options?: ConsoleOutputOptions);
|
|
13
|
+
info(message: string): void;
|
|
14
|
+
success(message: string): void;
|
|
15
|
+
warn(message: string): void;
|
|
16
|
+
error(message: string): void;
|
|
17
|
+
progress(message: string, options?: {
|
|
18
|
+
current?: number;
|
|
19
|
+
total?: number;
|
|
20
|
+
}): void;
|
|
21
|
+
separator(char?: string, length?: number): void;
|
|
22
|
+
keyValue(key: string, value: string, options?: {
|
|
23
|
+
indent?: number;
|
|
24
|
+
}): void;
|
|
25
|
+
/**
|
|
26
|
+
* Apply optional color and delegate to the provided console function.
|
|
27
|
+
*/
|
|
28
|
+
private log;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ConsoleOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleOutput.d.ts","sourceRoot":"","sources":["../../src/outputs/ConsoleOutput.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC/B,OAAO,CAAC,OAAO;gBAAP,OAAO,GAAE,oBAAyB;IAKtD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAS/E,SAAS,CAAC,IAAI,GAAE,MAAY,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI;IAIxD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKzE;;OAEG;IACH,OAAO,CAAC,GAAG;CAIZ"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { colorize } from '@testany/agent-chatter-core';
|
|
2
|
+
/**
|
|
3
|
+
* Console-backed implementation of IOutput.
|
|
4
|
+
* Used by CLI/legacy REPL to centralize formatting, colors, and verbosity control.
|
|
5
|
+
*/
|
|
6
|
+
export class ConsoleOutput {
|
|
7
|
+
options;
|
|
8
|
+
constructor(options = {}) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
this.options.colors = this.options.colors ?? true;
|
|
11
|
+
this.options.verbose = this.options.verbose ?? true;
|
|
12
|
+
}
|
|
13
|
+
info(message) {
|
|
14
|
+
this.log(message, 'cyan', console.log);
|
|
15
|
+
}
|
|
16
|
+
success(message) {
|
|
17
|
+
this.log(message, 'green', console.log);
|
|
18
|
+
}
|
|
19
|
+
warn(message) {
|
|
20
|
+
this.log(message, 'yellow', console.warn);
|
|
21
|
+
}
|
|
22
|
+
error(message) {
|
|
23
|
+
this.log(message, 'red', console.error);
|
|
24
|
+
}
|
|
25
|
+
progress(message, options) {
|
|
26
|
+
if (!this.options.verbose)
|
|
27
|
+
return;
|
|
28
|
+
let text = message;
|
|
29
|
+
if (options?.current !== undefined && options?.total !== undefined) {
|
|
30
|
+
text += ` (${options.current}/${options.total})`;
|
|
31
|
+
}
|
|
32
|
+
this.log(text, 'dim', console.log);
|
|
33
|
+
}
|
|
34
|
+
separator(char = '─', length = 60) {
|
|
35
|
+
this.log(char.repeat(length), 'dim', console.log);
|
|
36
|
+
}
|
|
37
|
+
keyValue(key, value, options) {
|
|
38
|
+
const indent = ' '.repeat(options?.indent ?? 2);
|
|
39
|
+
this.log(`${indent}${key}: ${value}`, 'dim', console.log);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Apply optional color and delegate to the provided console function.
|
|
43
|
+
*/
|
|
44
|
+
log(message, color, fn) {
|
|
45
|
+
const text = this.options.colors ? colorize(message, color) : message;
|
|
46
|
+
fn(text);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=ConsoleOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleOutput.js","sourceRoot":"","sources":["../../src/outputs/ConsoleOutput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,6BAA6B,CAAC;AAQvE;;;GAGG;AACH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,UAAgC,EAAE;QAAlC,YAAO,GAAP,OAAO,CAA2B;QACpD,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;IACtD,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,OAAe;QACrB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC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AC;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ColorName } from '@testany/agent-chatter-core';
|
|
2
|
+
/**
|
|
3
|
+
* Output abstraction for presentation/UI layers.
|
|
4
|
+
*/
|
|
5
|
+
export interface IOutput {
|
|
6
|
+
info(message: string): void;
|
|
7
|
+
success(message: string): void;
|
|
8
|
+
warn(message: string): void;
|
|
9
|
+
error(message: string): void;
|
|
10
|
+
progress(message: string, options?: {
|
|
11
|
+
current?: number;
|
|
12
|
+
total?: number;
|
|
13
|
+
}): void;
|
|
14
|
+
separator(char?: string, length?: number): void;
|
|
15
|
+
keyValue(key: string, value: string, options?: {
|
|
16
|
+
indent?: number;
|
|
17
|
+
color?: ColorName;
|
|
18
|
+
}): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Silent implementation for headless/test/default cases.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SilentOutput implements IOutput {
|
|
24
|
+
info(_message: string): void;
|
|
25
|
+
success(_message: string): void;
|
|
26
|
+
warn(_message: string): void;
|
|
27
|
+
error(_message: string): void;
|
|
28
|
+
progress(_message: string, _options?: {
|
|
29
|
+
current?: number;
|
|
30
|
+
total?: number;
|
|
31
|
+
}): void;
|
|
32
|
+
separator(_char?: string, _length?: number): void;
|
|
33
|
+
keyValue(_key: string, _value: string, _options?: {
|
|
34
|
+
indent?: number;
|
|
35
|
+
color?: ColorName;
|
|
36
|
+
}): void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=IOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IOutput.d.ts","sourceRoot":"","sources":["../../src/outputs/IOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,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;KAAE,GAAG,IAAI;CAChG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Silent implementation for headless/test/default cases.
|
|
3
|
+
*/
|
|
4
|
+
export class SilentOutput {
|
|
5
|
+
info(_message) { }
|
|
6
|
+
success(_message) { }
|
|
7
|
+
warn(_message) { }
|
|
8
|
+
error(_message) { }
|
|
9
|
+
progress(_message, _options) { }
|
|
10
|
+
separator(_char, _length) { }
|
|
11
|
+
keyValue(_key, _value, _options) { }
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=IOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IOutput.js","sourceRoot":"","sources":["../../src/outputs/IOutput.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB,IAAI,CAAC,QAAgB,IAAS,CAAC;IAC/B,OAAO,CAAC,QAAgB,IAAS,CAAC;IAClC,IAAI,CAAC,QAAgB,IAAS,CAAC;IAC/B,KAAK,CAAC,QAAgB,IAAS,CAAC;IAChC,QAAQ,CAAC,QAAgB,EAAE,QAA+C,IAAS,CAAC;IACpF,SAAS,CAAC,KAAc,EAAE,OAAgB,IAAS,CAAC;IACpD,QAAQ,CAAC,IAAY,EAAE,MAAc,EAAE,QAAiD,IAAS,CAAC;CACnG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IOutput } from './IOutput.js';
|
|
3
|
+
export interface InkOutputOptions {
|
|
4
|
+
setOutput: React.Dispatch<React.SetStateAction<React.ReactNode[]>>;
|
|
5
|
+
getNextKey: () => string;
|
|
6
|
+
}
|
|
7
|
+
export declare class InkOutput implements IOutput {
|
|
8
|
+
private options;
|
|
9
|
+
constructor(options: InkOutputOptions);
|
|
10
|
+
info(message: string): void;
|
|
11
|
+
success(message: string): void;
|
|
12
|
+
warn(message: string): void;
|
|
13
|
+
error(message: string): void;
|
|
14
|
+
progress(message: string, options?: {
|
|
15
|
+
current?: number;
|
|
16
|
+
total?: number;
|
|
17
|
+
}): void;
|
|
18
|
+
separator(char?: string, length?: number): void;
|
|
19
|
+
keyValue(key: string, value: string, options?: {
|
|
20
|
+
indent?: number;
|
|
21
|
+
}): void;
|
|
22
|
+
private push;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=InkOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkOutput.d.ts","sourceRoot":"","sources":["../../src/outputs/InkOutput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACnE,UAAU,EAAE,MAAM,MAAM,CAAC;CAC1B;AAED,qBAAa,SAAU,YAAW,OAAO;IAC3B,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,gBAAgB;IAE7C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAQ/E,SAAS,CAAC,IAAI,GAAE,MAAY,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI;IAIxD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKzE,OAAO,CAAC,IAAI;CAGb"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
export class InkOutput {
|
|
4
|
+
options;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
info(message) {
|
|
9
|
+
this.push(_jsx(Text, { color: "cyan", children: message }, `info-${this.options.getNextKey()}`));
|
|
10
|
+
}
|
|
11
|
+
success(message) {
|
|
12
|
+
this.push(_jsx(Text, { color: "green", children: message }, `success-${this.options.getNextKey()}`));
|
|
13
|
+
}
|
|
14
|
+
warn(message) {
|
|
15
|
+
this.push(_jsx(Text, { color: "yellow", children: message }, `warn-${this.options.getNextKey()}`));
|
|
16
|
+
}
|
|
17
|
+
error(message) {
|
|
18
|
+
this.push(_jsx(Text, { color: "red", children: message }, `error-${this.options.getNextKey()}`));
|
|
19
|
+
}
|
|
20
|
+
progress(message, options) {
|
|
21
|
+
let text = message;
|
|
22
|
+
if (options?.current !== undefined && options?.total !== undefined) {
|
|
23
|
+
text += ` (${options.current}/${options.total})`;
|
|
24
|
+
}
|
|
25
|
+
this.push(_jsx(Text, { dimColor: true, children: text }, `progress-${this.options.getNextKey()}`));
|
|
26
|
+
}
|
|
27
|
+
separator(char = '─', length = 60) {
|
|
28
|
+
this.push(_jsx(Text, { dimColor: true, children: char.repeat(length) }, `sep-${this.options.getNextKey()}`));
|
|
29
|
+
}
|
|
30
|
+
keyValue(key, value, options) {
|
|
31
|
+
const indent = ' '.repeat(options?.indent ?? 2);
|
|
32
|
+
this.push(_jsxs(Text, { dimColor: true, children: [indent, key, ": ", value] }, `kv-${this.options.getNextKey()}`));
|
|
33
|
+
}
|
|
34
|
+
push(node) {
|
|
35
|
+
this.options.setOutput(prev => [...prev, node]);
|
|
36
|
+
}
|
|
37
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