praisonai 1.5.0 → 1.5.1

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 (58) hide show
  1. package/dist/cli/commands/context.d.ts +5 -3
  2. package/dist/cli/commands/context.js +115 -80
  3. package/dist/cli/commands/hooks.d.ts +12 -0
  4. package/dist/cli/commands/hooks.js +193 -0
  5. package/dist/cli/features/enhanced-flow-display.d.ts +81 -0
  6. package/dist/cli/features/enhanced-flow-display.js +203 -0
  7. package/dist/cli/spec/cli-spec.js +10 -0
  8. package/dist/context/budgeter.d.ts +92 -0
  9. package/dist/context/budgeter.js +143 -0
  10. package/dist/context/index.d.ts +7 -0
  11. package/dist/context/index.js +21 -0
  12. package/dist/context/manager.d.ts +132 -0
  13. package/dist/context/manager.js +188 -0
  14. package/dist/context/optimizer.d.ts +78 -0
  15. package/dist/context/optimizer.js +171 -0
  16. package/dist/eval/base.d.ts +115 -0
  17. package/dist/eval/base.js +211 -0
  18. package/dist/eval/index.d.ts +2 -0
  19. package/dist/eval/index.js +14 -1
  20. package/dist/eval/results.d.ts +121 -0
  21. package/dist/eval/results.js +190 -0
  22. package/dist/hooks/callbacks.d.ts +147 -0
  23. package/dist/hooks/callbacks.js +204 -0
  24. package/dist/hooks/index.d.ts +8 -0
  25. package/dist/hooks/index.js +33 -0
  26. package/dist/hooks/manager.d.ts +151 -0
  27. package/dist/hooks/manager.js +331 -0
  28. package/dist/hooks/workflow-hooks.d.ts +96 -0
  29. package/dist/hooks/workflow-hooks.js +150 -0
  30. package/dist/index.d.ts +7 -3
  31. package/dist/index.js +61 -8
  32. package/dist/mcp/index.d.ts +2 -0
  33. package/dist/mcp/index.js +13 -1
  34. package/dist/mcp/security.d.ts +156 -0
  35. package/dist/mcp/security.js +220 -0
  36. package/dist/mcp/session.d.ts +222 -0
  37. package/dist/mcp/session.js +319 -0
  38. package/dist/mcp/transports.d.ts +109 -0
  39. package/dist/mcp/transports.js +285 -0
  40. package/dist/memory/file-memory.d.ts +52 -0
  41. package/dist/memory/file-memory.js +177 -0
  42. package/dist/session/hierarchy.d.ts +110 -0
  43. package/dist/session/hierarchy.js +192 -0
  44. package/dist/session/index.d.ts +3 -0
  45. package/dist/session/index.js +15 -1
  46. package/dist/session/parts.d.ts +124 -0
  47. package/dist/session/parts.js +222 -0
  48. package/dist/session/store.d.ts +90 -0
  49. package/dist/session/store.js +208 -0
  50. package/dist/telemetry/index.d.ts +2 -0
  51. package/dist/telemetry/index.js +13 -1
  52. package/dist/telemetry/integration.d.ts +159 -0
  53. package/dist/telemetry/integration.js +228 -0
  54. package/dist/telemetry/performance.d.ts +132 -0
  55. package/dist/telemetry/performance.js +208 -0
  56. package/dist/tools/utility-tools.d.ts +109 -0
  57. package/dist/tools/utility-tools.js +326 -0
  58. package/package.json +1 -1
@@ -1,11 +1,13 @@
1
1
  /**
2
- * Context command - Manage conversation context
2
+ * Context command - Manage context windows
3
3
  */
4
4
  export interface ContextOptions {
5
- model?: string;
6
5
  verbose?: boolean;
7
6
  output?: 'json' | 'text' | 'pretty';
8
7
  json?: boolean;
9
- maxMessages?: number;
8
+ budget?: number;
9
+ priority?: number;
10
+ target?: number;
11
+ strategy?: string;
10
12
  }
11
13
  export declare function execute(args: string[], options: ContextOptions): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Context command - Manage conversation context
3
+ * Context command - Manage context windows
4
4
  */
5
5
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
@@ -37,24 +37,39 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.execute = execute;
40
- const context_1 = require("../../agent/context");
41
- const resolve_1 = require("../config/resolve");
42
40
  const json_1 = require("../output/json");
43
41
  const pretty = __importStar(require("../output/pretty"));
44
42
  const cli_spec_1 = require("../spec/cli-spec");
45
43
  const errors_1 = require("../output/errors");
44
+ let currentManager = null;
46
45
  async function execute(args, options) {
47
46
  const action = args[0] || 'help';
48
47
  const actionArgs = args.slice(1);
49
48
  const outputFormat = options.json ? 'json' : (options.output || 'pretty');
50
- const config = (0, resolve_1.resolveConfig)(options);
51
49
  try {
50
+ // Lazy load to avoid import overhead
51
+ const { ContextManager, ContextBudgeter, ContextOptimizer } = await Promise.resolve().then(() => __importStar(require('../../context')));
52
52
  switch (action) {
53
- case 'chat':
54
- await chatWithContext(actionArgs, options, config, outputFormat);
53
+ case 'create':
54
+ await createContext(options, outputFormat, ContextManager);
55
55
  break;
56
- case 'summarize':
57
- await summarizeContext(actionArgs, options, config, outputFormat);
56
+ case 'add':
57
+ await addContent(actionArgs, options, outputFormat);
58
+ break;
59
+ case 'stats':
60
+ await showStats(outputFormat);
61
+ break;
62
+ case 'budget':
63
+ await manageBudget(actionArgs, options, outputFormat, ContextBudgeter);
64
+ break;
65
+ case 'optimize':
66
+ await optimizeContext(options, outputFormat, ContextOptimizer);
67
+ break;
68
+ case 'build':
69
+ await buildContext(outputFormat);
70
+ break;
71
+ case 'clear':
72
+ await clearContext(outputFormat);
58
73
  break;
59
74
  case 'help':
60
75
  default:
@@ -72,95 +87,120 @@ async function execute(args, options) {
72
87
  process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
73
88
  }
74
89
  }
75
- async function chatWithContext(args, options, config, outputFormat) {
76
- const message = args.join(' ');
77
- if (!message) {
90
+ async function createContext(options, outputFormat, ContextManager) {
91
+ const budget = options.budget || 4000;
92
+ currentManager = new ContextManager({ maxTokens: budget });
93
+ if (outputFormat === 'json') {
94
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ created: true, budget }));
95
+ }
96
+ else {
97
+ await pretty.success(`Context manager created with budget: ${budget} tokens`);
98
+ }
99
+ }
100
+ async function addContent(args, options, outputFormat) {
101
+ if (!currentManager) {
102
+ const { ContextManager } = await Promise.resolve().then(() => __importStar(require('../../context')));
103
+ currentManager = new ContextManager({ maxTokens: options.budget || 4000 });
104
+ }
105
+ const content = args.join(' ');
106
+ const priority = options.priority || 0.5;
107
+ currentManager.add({ content, priority, type: 'user' });
108
+ if (outputFormat === 'json') {
109
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ added: true, priority, tokenEstimate: Math.ceil(content.length / 4) }));
110
+ }
111
+ else {
112
+ await pretty.success(`Added content with priority ${priority}`);
113
+ }
114
+ }
115
+ async function showStats(outputFormat) {
116
+ if (!currentManager) {
78
117
  if (outputFormat === 'json') {
79
- (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a message'));
118
+ (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'No context manager created'));
80
119
  }
81
120
  else {
82
- await pretty.error('Please provide a message');
121
+ await pretty.warn('No context manager created. Run: praisonai context create');
83
122
  }
84
- process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
85
- }
86
- const startTime = Date.now();
87
- if (outputFormat !== 'json') {
88
- await pretty.info('Processing with context...');
89
- }
90
- const agent = (0, context_1.createContextAgent)({
91
- llm: config.model,
92
- instructions: 'You are a helpful assistant with context awareness.',
93
- contextWindow: options.maxMessages || 10,
94
- verbose: options.verbose
95
- });
96
- const result = await agent.chat(message);
97
- const duration = Date.now() - startTime;
123
+ return;
124
+ }
125
+ const stats = {
126
+ itemCount: currentManager.getItems?.()?.length || 0,
127
+ tokenCount: currentManager.getTokenCount?.() || 0,
128
+ maxTokens: currentManager.maxTokens || 4000
129
+ };
98
130
  if (outputFormat === 'json') {
99
- (0, json_1.outputJson)((0, json_1.formatSuccess)({
100
- message,
101
- response: result.text
102
- }, {
103
- duration_ms: duration,
104
- model: config.model
105
- }));
131
+ (0, json_1.outputJson)((0, json_1.formatSuccess)(stats));
106
132
  }
107
133
  else {
108
- await pretty.heading('Response');
109
- await pretty.plain(result.text);
110
- await pretty.newline();
111
- await pretty.success(`Completed in ${duration}ms`);
134
+ await pretty.heading('Context Stats');
135
+ await pretty.plain(` Items: ${stats.itemCount}`);
136
+ await pretty.plain(` Tokens: ${stats.tokenCount}/${stats.maxTokens}`);
112
137
  }
113
138
  }
114
- async function summarizeContext(args, options, config, outputFormat) {
115
- const context = args.join(' ');
116
- if (!context) {
139
+ async function manageBudget(args, options, outputFormat, ContextBudgeter) {
140
+ const subAction = args[0] || 'show';
141
+ if (subAction === 'show') {
117
142
  if (outputFormat === 'json') {
118
- (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide context to summarize'));
143
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ budget: options.budget || 4000 }));
119
144
  }
120
145
  else {
121
- await pretty.error('Please provide context to summarize');
146
+ await pretty.heading('Budget Configuration');
147
+ await pretty.plain(` Total: ${options.budget || 4000} tokens`);
122
148
  }
123
- process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
124
- }
125
- const startTime = Date.now();
126
- if (outputFormat !== 'json') {
127
- await pretty.info('Summarizing context...');
128
- }
129
- const agent = (0, context_1.createContextAgent)({
130
- llm: config.model,
131
- instructions: 'You are a summarization assistant. Provide concise summaries.',
132
- verbose: options.verbose
133
- });
134
- // Use chat to summarize
135
- const result = await agent.chat(`Please summarize the following text concisely:\n\n${context}`);
136
- const duration = Date.now() - startTime;
149
+ }
150
+ }
151
+ async function optimizeContext(options, outputFormat, ContextOptimizer) {
152
+ const target = options.target || 4000;
153
+ const strategy = options.strategy || 'truncate-low-priority';
154
+ const optimizer = new ContextOptimizer({ targetTokens: target, strategies: [strategy] });
155
+ if (outputFormat === 'json') {
156
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ optimized: true, target, strategy }));
157
+ }
158
+ else {
159
+ await pretty.success(`Optimization applied: ${strategy} (target: ${target} tokens)`);
160
+ }
161
+ }
162
+ async function buildContext(outputFormat) {
163
+ if (!currentManager) {
164
+ if (outputFormat === 'json') {
165
+ (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'No context manager'));
166
+ }
167
+ else {
168
+ await pretty.warn('No context manager. Run: praisonai context create');
169
+ }
170
+ return;
171
+ }
172
+ const built = currentManager.build?.() || '';
137
173
  if (outputFormat === 'json') {
138
- (0, json_1.outputJson)((0, json_1.formatSuccess)({
139
- originalLength: context.length,
140
- summary: result.text
141
- }, {
142
- duration_ms: duration,
143
- model: config.model
144
- }));
174
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ context: built, length: built.length }));
145
175
  }
146
176
  else {
147
- await pretty.heading('Summary');
148
- await pretty.plain(result.text);
149
- await pretty.newline();
150
- await pretty.dim(`Original: ${context.length} chars`);
151
- await pretty.success(`Summarized in ${duration}ms`);
177
+ console.log(built);
178
+ }
179
+ }
180
+ async function clearContext(outputFormat) {
181
+ if (currentManager) {
182
+ currentManager.clear?.();
183
+ }
184
+ currentManager = null;
185
+ if (outputFormat === 'json') {
186
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ cleared: true }));
187
+ }
188
+ else {
189
+ await pretty.success('Context cleared');
152
190
  }
153
191
  }
154
192
  async function showHelp(outputFormat) {
155
193
  const help = {
156
194
  command: 'context',
157
195
  subcommands: [
158
- { name: 'chat <message>', description: 'Chat with context management' },
159
- { name: 'summarize <text>', description: 'Summarize context' },
196
+ { name: 'create', description: 'Create context manager', options: ['--budget'] },
197
+ { name: 'add <content>', description: 'Add content', options: ['--priority'] },
198
+ { name: 'stats', description: 'Show context stats' },
199
+ { name: 'budget', description: 'Manage token budget' },
200
+ { name: 'optimize', description: 'Optimize context', options: ['--target', '--strategy'] },
201
+ { name: 'build', description: 'Build context string' },
202
+ { name: 'clear', description: 'Clear context' },
160
203
  { name: 'help', description: 'Show this help' }
161
- ],
162
- flags: [
163
- { name: '--max-messages', description: 'Maximum messages to keep in context' }
164
204
  ]
165
205
  };
166
206
  if (outputFormat === 'json') {
@@ -168,15 +208,10 @@ async function showHelp(outputFormat) {
168
208
  }
169
209
  else {
170
210
  await pretty.heading('Context Command');
171
- await pretty.plain('Manage conversation context\n');
211
+ await pretty.plain('Manage Agent context windows\n');
172
212
  await pretty.plain('Subcommands:');
173
213
  for (const cmd of help.subcommands) {
174
214
  await pretty.plain(` ${cmd.name.padEnd(25)} ${cmd.description}`);
175
215
  }
176
- await pretty.newline();
177
- await pretty.plain('Flags:');
178
- for (const flag of help.flags) {
179
- await pretty.plain(` ${flag.name.padEnd(20)} ${flag.description}`);
180
- }
181
216
  }
182
217
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hooks CLI command - Manage hooks and callbacks
3
+ */
4
+ export interface HooksOptions {
5
+ verbose?: boolean;
6
+ output?: 'json' | 'text' | 'pretty';
7
+ json?: boolean;
8
+ event?: string;
9
+ enabled?: boolean;
10
+ logging?: boolean;
11
+ }
12
+ export declare function execute(args: string[], options: HooksOptions): Promise<void>;
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ /**
3
+ * Hooks CLI command - Manage hooks and callbacks
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.execute = execute;
40
+ const json_1 = require("../output/json");
41
+ const pretty = __importStar(require("../output/pretty"));
42
+ const cli_spec_1 = require("../spec/cli-spec");
43
+ const errors_1 = require("../output/errors");
44
+ async function execute(args, options) {
45
+ const action = args[0] || 'help';
46
+ const actionArgs = args.slice(1);
47
+ const outputFormat = options.json ? 'json' : (options.output || 'pretty');
48
+ try {
49
+ const { HooksManager, createHooksManager, registerDisplayCallback, getRegisteredDisplayTypes, clearAllCallbacks, DisplayTypes } = await Promise.resolve().then(() => __importStar(require('../../hooks')));
50
+ switch (action) {
51
+ case 'list':
52
+ await listHooks(outputFormat);
53
+ break;
54
+ case 'events':
55
+ await listEvents(outputFormat);
56
+ break;
57
+ case 'display-types':
58
+ await listDisplayTypes(outputFormat, getRegisteredDisplayTypes, DisplayTypes);
59
+ break;
60
+ case 'clear':
61
+ await clearHooks(outputFormat, clearAllCallbacks);
62
+ break;
63
+ case 'stats':
64
+ await showStats(outputFormat);
65
+ break;
66
+ case 'help':
67
+ default:
68
+ await showHelp(outputFormat);
69
+ break;
70
+ }
71
+ }
72
+ catch (error) {
73
+ if (outputFormat === 'json') {
74
+ (0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
75
+ }
76
+ else {
77
+ await pretty.error(error instanceof Error ? error.message : String(error));
78
+ }
79
+ process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
80
+ }
81
+ }
82
+ async function listHooks(outputFormat) {
83
+ const { HooksManager } = await Promise.resolve().then(() => __importStar(require('../../hooks')));
84
+ const manager = new HooksManager({ logging: false });
85
+ const hookEvents = [
86
+ 'pre_read_code', 'post_read_code',
87
+ 'pre_write_code', 'post_write_code',
88
+ 'pre_run_command', 'post_run_command',
89
+ 'pre_user_prompt', 'post_user_prompt',
90
+ 'pre_mcp_tool_use', 'post_mcp_tool_use',
91
+ 'pre_llm_call', 'post_llm_call',
92
+ 'pre_tool_call', 'post_tool_call',
93
+ 'agent_start', 'agent_complete',
94
+ 'run_started', 'run_completed'
95
+ ];
96
+ if (outputFormat === 'json') {
97
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ events: hookEvents, count: hookEvents.length }));
98
+ }
99
+ else {
100
+ await pretty.heading('Available Hook Events');
101
+ await pretty.plain(`\nOperation Hooks:`);
102
+ await pretty.plain(` pre_read_code, post_read_code`);
103
+ await pretty.plain(` pre_write_code, post_write_code`);
104
+ await pretty.plain(` pre_run_command, post_run_command`);
105
+ await pretty.plain(` pre_user_prompt, post_user_prompt`);
106
+ await pretty.plain(` pre_mcp_tool_use, post_mcp_tool_use`);
107
+ await pretty.plain(`\nLLM/Tool Hooks:`);
108
+ await pretty.plain(` pre_llm_call, post_llm_call`);
109
+ await pretty.plain(` pre_tool_call, post_tool_call`);
110
+ await pretty.plain(`\nLifecycle Hooks:`);
111
+ await pretty.plain(` agent_start, agent_complete`);
112
+ await pretty.plain(` run_started, run_completed`);
113
+ await pretty.plain(`\nTotal: ${hookEvents.length} hook events`);
114
+ }
115
+ }
116
+ async function listEvents(outputFormat) {
117
+ await listHooks(outputFormat);
118
+ }
119
+ async function listDisplayTypes(outputFormat, getRegisteredDisplayTypes, DisplayTypes) {
120
+ const registered = getRegisteredDisplayTypes();
121
+ const builtIn = Object.values(DisplayTypes);
122
+ if (outputFormat === 'json') {
123
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({
124
+ builtIn,
125
+ registered,
126
+ builtInCount: builtIn.length,
127
+ registeredCount: registered.length
128
+ }));
129
+ }
130
+ else {
131
+ await pretty.heading('Display Types');
132
+ await pretty.plain(`\nBuilt-in types (${builtIn.length}):`);
133
+ for (const type of builtIn) {
134
+ await pretty.plain(` ${type}`);
135
+ }
136
+ await pretty.plain(`\nRegistered callbacks: ${registered.length}`);
137
+ }
138
+ }
139
+ async function clearHooks(outputFormat, clearAllCallbacks) {
140
+ clearAllCallbacks();
141
+ if (outputFormat === 'json') {
142
+ (0, json_1.outputJson)((0, json_1.formatSuccess)({ cleared: true }));
143
+ }
144
+ else {
145
+ await pretty.success('All callbacks cleared');
146
+ }
147
+ }
148
+ async function showStats(outputFormat) {
149
+ const { getRegisteredDisplayTypes, hasApprovalCallback } = await Promise.resolve().then(() => __importStar(require('../../hooks')));
150
+ const stats = {
151
+ displayTypes: getRegisteredDisplayTypes().length,
152
+ hasApprovalCallback: hasApprovalCallback(),
153
+ hookEvents: 20 // Total available hook events
154
+ };
155
+ if (outputFormat === 'json') {
156
+ (0, json_1.outputJson)((0, json_1.formatSuccess)(stats));
157
+ }
158
+ else {
159
+ await pretty.heading('Hooks Stats');
160
+ await pretty.plain(` Display callbacks: ${stats.displayTypes}`);
161
+ await pretty.plain(` Approval callback: ${stats.hasApprovalCallback ? 'Yes' : 'No'}`);
162
+ await pretty.plain(` Available events: ${stats.hookEvents}`);
163
+ }
164
+ }
165
+ async function showHelp(outputFormat) {
166
+ const help = {
167
+ command: 'hooks',
168
+ description: 'Manage hooks and callbacks',
169
+ subcommands: [
170
+ { name: 'list', description: 'List all available hook events' },
171
+ { name: 'events', description: 'List hook events (alias for list)' },
172
+ { name: 'display-types', description: 'List display callback types' },
173
+ { name: 'stats', description: 'Show hooks statistics' },
174
+ { name: 'clear', description: 'Clear all registered callbacks' },
175
+ { name: 'help', description: 'Show this help' }
176
+ ]
177
+ };
178
+ if (outputFormat === 'json') {
179
+ (0, json_1.outputJson)((0, json_1.formatSuccess)(help));
180
+ }
181
+ else {
182
+ await pretty.heading('Hooks Command');
183
+ await pretty.plain('Manage hooks and callbacks for agent operations\n');
184
+ await pretty.plain('Subcommands:');
185
+ for (const cmd of help.subcommands) {
186
+ await pretty.plain(` ${cmd.name.padEnd(20)} ${cmd.description}`);
187
+ }
188
+ await pretty.plain('\nExamples:');
189
+ await pretty.plain(' praisonai-ts hooks list');
190
+ await pretty.plain(' praisonai-ts hooks display-types --json');
191
+ await pretty.plain(' praisonai-ts hooks stats');
192
+ }
193
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Enhanced Flow Display - Visualization options for workflows
3
+ *
4
+ * Provides multiple output formats and interactive modes.
5
+ */
6
+ /**
7
+ * Display format
8
+ */
9
+ export type DisplayFormat = 'text' | 'markdown' | 'json' | 'tree' | 'mermaid';
10
+ /**
11
+ * Flow step representation
12
+ */
13
+ export interface FlowStep {
14
+ id: string;
15
+ name: string;
16
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
17
+ duration?: number;
18
+ input?: any;
19
+ output?: any;
20
+ error?: string;
21
+ children?: FlowStep[];
22
+ }
23
+ /**
24
+ * Display options
25
+ */
26
+ export interface FlowDisplayOptions {
27
+ format?: DisplayFormat;
28
+ showInput?: boolean;
29
+ showOutput?: boolean;
30
+ showDuration?: boolean;
31
+ maxDepth?: number;
32
+ colorize?: boolean;
33
+ }
34
+ /**
35
+ * FlowDisplay - Workflow visualization
36
+ */
37
+ export declare class FlowDisplay {
38
+ private options;
39
+ constructor(options?: FlowDisplayOptions);
40
+ /**
41
+ * Render flow
42
+ */
43
+ render(steps: FlowStep[]): string;
44
+ /**
45
+ * Render as plain text
46
+ */
47
+ private renderText;
48
+ /**
49
+ * Render as markdown
50
+ */
51
+ private renderMarkdown;
52
+ /**
53
+ * Render as JSON
54
+ */
55
+ private renderJson;
56
+ /**
57
+ * Render as tree
58
+ */
59
+ private renderTree;
60
+ /**
61
+ * Render as Mermaid diagram
62
+ */
63
+ private renderMermaid;
64
+ /**
65
+ * Get status icon
66
+ */
67
+ private getStatusIcon;
68
+ /**
69
+ * Print to console
70
+ */
71
+ print(steps: FlowStep[]): void;
72
+ }
73
+ /**
74
+ * Create flow display
75
+ */
76
+ export declare function createFlowDisplay(options?: FlowDisplayOptions): FlowDisplay;
77
+ /**
78
+ * Quick render
79
+ */
80
+ export declare function renderFlow(steps: FlowStep[], format?: DisplayFormat): string;
81
+ export default FlowDisplay;