@hashgraphonline/conversational-agent 0.1.217 → 0.1.219
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/cli/readme.md +181 -0
- package/dist/cjs/constants/entity-references.d.ts +18 -0
- package/dist/cjs/constants/form-priorities.d.ts +24 -0
- package/dist/cjs/constants/index.d.ts +4 -0
- package/dist/cjs/constants/messages.d.ts +19 -0
- package/dist/cjs/constants/test-constants.d.ts +42 -0
- package/dist/cjs/conversational-agent.d.ts +3 -8
- package/dist/{types/core/ToolRegistry.d.ts → cjs/core/tool-registry.d.ts} +11 -1
- package/dist/{types/execution/ExecutionPipeline.d.ts → cjs/execution/execution-pipeline.d.ts} +3 -3
- package/dist/cjs/forms/field-guidance-registry.d.ts +108 -0
- package/dist/cjs/forms/form-generator.d.ts +2 -7
- package/dist/cjs/forms/index.d.ts +3 -0
- package/dist/cjs/forms/types.d.ts +9 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +7 -12
- package/dist/cjs/langchain/external-tool-wrapper.d.ts +101 -0
- package/dist/{types/langchain/FormAwareAgentExecutor.d.ts → cjs/langchain/form-aware-agent-executor.d.ts} +19 -4
- package/dist/cjs/langchain/index.d.ts +3 -0
- package/dist/{types → cjs/langchain}/langchain-agent.d.ts +15 -7
- package/dist/cjs/mcp/adapters/index.d.ts +1 -0
- package/dist/cjs/mcp/adapters/langchain.d.ts +1 -1
- package/dist/{types/mcp/ContentProcessor.d.ts → cjs/mcp/content-processor.d.ts} +1 -1
- package/dist/cjs/mcp/index.d.ts +5 -0
- package/dist/{types/mcp/MCPClientManager.d.ts → cjs/mcp/mcp-client-manager.d.ts} +1 -1
- package/dist/cjs/memory/{ContentStorage.d.ts → content-storage.d.ts} +4 -4
- package/dist/cjs/memory/index.d.ts +5 -7
- package/dist/{types/memory/MemoryWindow.d.ts → cjs/memory/memory-window.d.ts} +1 -1
- package/dist/{types/memory/SmartMemoryManager.d.ts → cjs/memory/smart-memory-manager.d.ts} +1 -1
- package/dist/cjs/services/{ContentStoreManager.d.ts → content-store-manager.d.ts} +6 -6
- package/dist/cjs/services/context/resolution-context.d.ts +49 -0
- package/dist/cjs/services/entity-resolver.d.ts +58 -0
- package/dist/cjs/services/formatters/converters/index.d.ts +2 -0
- package/dist/cjs/services/formatters/converters/string-normalization-converter.d.ts +13 -0
- package/dist/cjs/services/formatters/converters/topic-id-to-hrl-converter.d.ts +17 -0
- package/dist/cjs/services/formatters/format-converter-registry.d.ts +66 -0
- package/dist/cjs/services/formatters/index.d.ts +3 -0
- package/dist/cjs/services/formatters/types.d.ts +29 -0
- package/dist/cjs/services/index.d.ts +3 -0
- package/dist/cjs/services/resolution/resolution-pipeline.d.ts +44 -0
- package/dist/cjs/tools/index.d.ts +1 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/esm/index.js +40 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index10.js +669 -13
- package/dist/esm/index10.js.map +1 -1
- package/dist/esm/index11.js +310 -95
- package/dist/esm/index11.js.map +1 -1
- package/dist/esm/index12.js +130 -95
- package/dist/esm/index12.js.map +1 -1
- package/dist/esm/index13.js +262 -153
- package/dist/esm/index13.js.map +1 -1
- package/dist/esm/index14.js +100 -664
- package/dist/esm/index14.js.map +1 -1
- package/dist/esm/index15.js +135 -408
- package/dist/esm/index15.js.map +1 -1
- package/dist/esm/index16.js +240 -122
- package/dist/esm/index16.js.map +1 -1
- package/dist/esm/index17.js +147 -135
- package/dist/esm/index17.js.map +1 -1
- package/dist/esm/index18.js +376 -533
- package/dist/esm/index18.js.map +1 -1
- package/dist/esm/index19.js +87 -214
- package/dist/esm/index19.js.map +1 -1
- package/dist/esm/index2.js +21 -4
- package/dist/esm/index2.js.map +1 -1
- package/dist/esm/index20.js +158 -92
- package/dist/esm/index20.js.map +1 -1
- package/dist/esm/index21.js +717 -44
- package/dist/esm/index21.js.map +1 -1
- package/dist/esm/index22.js +58 -96
- package/dist/esm/index22.js.map +1 -1
- package/dist/esm/index23.js +324 -34
- package/dist/esm/index23.js.map +1 -1
- package/dist/esm/index24.js +125 -712
- package/dist/esm/index24.js.map +1 -1
- package/dist/esm/index25.js +113 -133
- package/dist/esm/index25.js.map +1 -1
- package/dist/esm/index26.js +18 -152
- package/dist/esm/index26.js.map +1 -1
- package/dist/esm/index27.js +14 -210
- package/dist/esm/index27.js.map +1 -1
- package/dist/esm/index28.js +70 -173
- package/dist/esm/index28.js.map +1 -1
- package/dist/esm/index29.js +882 -220
- package/dist/esm/index29.js.map +1 -1
- package/dist/esm/index30.js +218 -126
- package/dist/esm/index30.js.map +1 -1
- package/dist/esm/index31.js +1258 -44
- package/dist/esm/index31.js.map +1 -1
- package/dist/esm/index32.js +132 -24
- package/dist/esm/index32.js.map +1 -1
- package/dist/esm/index33.js +104 -82
- package/dist/esm/index33.js.map +1 -1
- package/dist/esm/index34.js +43 -239
- package/dist/esm/index34.js.map +1 -1
- package/dist/esm/index35.js +106 -0
- package/dist/esm/index35.js.map +1 -0
- package/dist/esm/index36.js +24 -0
- package/dist/esm/index36.js.map +1 -0
- package/dist/esm/index37.js +8 -0
- package/dist/esm/index37.js.map +1 -0
- package/dist/esm/index38.js +15 -0
- package/dist/esm/index38.js.map +1 -0
- package/dist/esm/index39.js +258 -0
- package/dist/esm/index39.js.map +1 -0
- package/dist/esm/index40.js +187 -0
- package/dist/esm/index40.js.map +1 -0
- package/dist/esm/index41.js +30 -0
- package/dist/esm/index41.js.map +1 -0
- package/dist/esm/index42.js +10 -0
- package/dist/esm/index42.js.map +1 -0
- package/dist/esm/index43.js +95 -0
- package/dist/esm/index43.js.map +1 -0
- package/dist/esm/index5.js +2 -2
- package/dist/esm/index5.js.map +1 -1
- package/dist/esm/index6.js +44 -67
- package/dist/esm/index6.js.map +1 -1
- package/dist/esm/index7.js +9 -0
- package/dist/esm/index7.js.map +1 -1
- package/dist/esm/index8.js +13 -1095
- package/dist/esm/index8.js.map +1 -1
- package/dist/esm/index9.js +17 -13
- package/dist/esm/index9.js.map +1 -1
- package/dist/types/constants/entity-references.d.ts +18 -0
- package/dist/types/constants/form-priorities.d.ts +24 -0
- package/dist/types/constants/index.d.ts +4 -0
- package/dist/types/constants/messages.d.ts +19 -0
- package/dist/types/constants/test-constants.d.ts +42 -0
- package/dist/types/conversational-agent.d.ts +3 -8
- package/dist/{cjs/core/ToolRegistry.d.ts → types/core/tool-registry.d.ts} +11 -1
- package/dist/{cjs/execution/ExecutionPipeline.d.ts → types/execution/execution-pipeline.d.ts} +3 -3
- package/dist/types/forms/field-guidance-registry.d.ts +108 -0
- package/dist/types/forms/form-generator.d.ts +2 -7
- package/dist/types/forms/index.d.ts +3 -0
- package/dist/types/forms/types.d.ts +9 -1
- package/dist/types/index.d.ts +7 -12
- package/dist/types/langchain/external-tool-wrapper.d.ts +101 -0
- package/dist/{cjs/langchain/FormAwareAgentExecutor.d.ts → types/langchain/form-aware-agent-executor.d.ts} +19 -4
- package/dist/types/langchain/index.d.ts +3 -0
- package/dist/{cjs → types/langchain}/langchain-agent.d.ts +15 -7
- package/dist/types/mcp/adapters/index.d.ts +1 -0
- package/dist/types/mcp/adapters/langchain.d.ts +1 -1
- package/dist/{cjs/mcp/ContentProcessor.d.ts → types/mcp/content-processor.d.ts} +1 -1
- package/dist/types/mcp/index.d.ts +5 -0
- package/dist/{cjs/mcp/MCPClientManager.d.ts → types/mcp/mcp-client-manager.d.ts} +1 -1
- package/dist/types/memory/{ContentStorage.d.ts → content-storage.d.ts} +4 -4
- package/dist/types/memory/index.d.ts +5 -7
- package/dist/{cjs/memory/MemoryWindow.d.ts → types/memory/memory-window.d.ts} +1 -1
- package/dist/{cjs/memory/SmartMemoryManager.d.ts → types/memory/smart-memory-manager.d.ts} +1 -1
- package/dist/types/services/{ContentStoreManager.d.ts → content-store-manager.d.ts} +6 -6
- package/dist/types/services/context/resolution-context.d.ts +49 -0
- package/dist/types/services/entity-resolver.d.ts +58 -0
- package/dist/types/services/formatters/converters/index.d.ts +2 -0
- package/dist/types/services/formatters/converters/string-normalization-converter.d.ts +13 -0
- package/dist/types/services/formatters/converters/topic-id-to-hrl-converter.d.ts +17 -0
- package/dist/types/services/formatters/format-converter-registry.d.ts +66 -0
- package/dist/types/services/formatters/index.d.ts +3 -0
- package/dist/types/services/formatters/types.d.ts +29 -0
- package/dist/types/services/index.d.ts +3 -0
- package/dist/types/services/resolution/resolution-pipeline.d.ts +44 -0
- package/dist/types/tools/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +30 -27
- package/src/agent-factory.ts +1 -1
- package/src/base-agent.ts +9 -0
- package/src/config/system-message.ts +2 -15
- package/src/constants/entity-references.ts +23 -0
- package/src/constants/form-priorities.ts +25 -0
- package/src/constants/index.ts +4 -0
- package/src/constants/messages.ts +20 -0
- package/src/constants/test-constants.ts +49 -0
- package/src/conversational-agent.ts +42 -69
- package/src/core/{ToolRegistry.ts → tool-registry.ts} +71 -1
- package/src/examples/external-tool-wrapper-example.ts +56 -0
- package/src/execution/{ExecutionPipeline.ts → execution-pipeline.ts} +3 -3
- package/src/forms/field-guidance-registry.ts +415 -0
- package/src/forms/field-type-registry.ts +49 -48
- package/src/forms/{FormEngine.ts → form-engine.ts} +66 -43
- package/src/forms/form-generator.ts +91 -17
- package/src/forms/index.ts +4 -1
- package/src/forms/types.ts +9 -1
- package/src/index.ts +7 -37
- package/src/langchain/external-tool-wrapper.ts +90 -0
- package/src/langchain/{FormAwareAgentExecutor.ts → form-aware-agent-executor.ts} +615 -231
- package/src/langchain/{FormValidatingToolWrapper.ts → form-validating-tool-wrapper.ts} +2 -1
- package/src/langchain/index.ts +3 -0
- package/src/{langchain-agent.ts → langchain/langchain-agent.ts} +389 -113
- package/src/mcp/adapters/index.ts +1 -0
- package/src/mcp/adapters/langchain.ts +27 -18
- package/src/mcp/{ContentProcessor.ts → content-processor.ts} +71 -47
- package/src/mcp/index.ts +5 -0
- package/src/mcp/{MCPClientManager.ts → mcp-client-manager.ts} +2 -2
- package/src/memory/{ContentStorage.ts → content-storage.ts} +263 -167
- package/src/memory/index.ts +5 -8
- package/src/memory/{MemoryWindow.ts → memory-window.ts} +47 -24
- package/src/memory/{SmartMemoryManager.ts → smart-memory-manager.ts} +49 -22
- package/src/plugins/hbar/HbarPlugin.ts +1 -1
- package/src/plugins/hcs-10/HCS10Plugin.ts +46 -28
- package/src/scripts/test-external-tool-wrapper.ts +6 -6
- package/src/scripts/test-inscribe-form-generation.ts +22 -21
- package/src/scripts/test-inscribe-wrapper-verification.ts +5 -4
- package/src/services/{ContentStoreManager.ts → content-store-manager.ts} +75 -33
- package/src/services/context/resolution-context.ts +80 -0
- package/src/services/entity-resolver.ts +425 -0
- package/src/services/formatters/converters/index.ts +2 -0
- package/src/services/formatters/converters/string-normalization-converter.ts +106 -0
- package/src/services/formatters/converters/topic-id-to-hrl-converter.ts +25 -0
- package/src/services/formatters/format-converter-registry.ts +229 -0
- package/src/services/formatters/index.ts +3 -0
- package/src/services/formatters/types.ts +31 -0
- package/src/services/index.ts +3 -0
- package/src/services/resolution/resolution-pipeline.ts +106 -0
- package/src/tools/index.ts +1 -0
- package/src/types/content-reference.ts +87 -60
- package/src/utils/index.ts +1 -0
- package/cli/dist/CLIApp.d.ts +0 -9
- package/cli/dist/CLIApp.js +0 -127
- package/cli/dist/LocalConversationalAgent.d.ts +0 -37
- package/cli/dist/LocalConversationalAgent.js +0 -58
- package/cli/dist/app.d.ts +0 -16
- package/cli/dist/app.js +0 -13
- package/cli/dist/cli.d.ts +0 -2
- package/cli/dist/cli.js +0 -51
- package/cli/dist/components/AppContainer.d.ts +0 -16
- package/cli/dist/components/AppContainer.js +0 -24
- package/cli/dist/components/AppScreens.d.ts +0 -2
- package/cli/dist/components/AppScreens.js +0 -259
- package/cli/dist/components/ChatScreen.d.ts +0 -15
- package/cli/dist/components/ChatScreen.js +0 -39
- package/cli/dist/components/DebugLoadingScreen.d.ts +0 -5
- package/cli/dist/components/DebugLoadingScreen.js +0 -31
- package/cli/dist/components/LoadingScreen.d.ts +0 -2
- package/cli/dist/components/LoadingScreen.js +0 -16
- package/cli/dist/components/LoadingScreenDebug.d.ts +0 -5
- package/cli/dist/components/LoadingScreenDebug.js +0 -27
- package/cli/dist/components/MCPConfigScreen.d.ts +0 -28
- package/cli/dist/components/MCPConfigScreen.js +0 -168
- package/cli/dist/components/ScreenRouter.d.ts +0 -12
- package/cli/dist/components/ScreenRouter.js +0 -22
- package/cli/dist/components/SetupScreen.d.ts +0 -15
- package/cli/dist/components/SetupScreen.js +0 -65
- package/cli/dist/components/SingleLoadingScreen.d.ts +0 -5
- package/cli/dist/components/SingleLoadingScreen.js +0 -27
- package/cli/dist/components/StatusBadge.d.ts +0 -7
- package/cli/dist/components/StatusBadge.js +0 -28
- package/cli/dist/components/TerminalWindow.d.ts +0 -8
- package/cli/dist/components/TerminalWindow.js +0 -24
- package/cli/dist/components/WelcomeScreen.d.ts +0 -11
- package/cli/dist/components/WelcomeScreen.js +0 -47
- package/cli/dist/context/AppContext.d.ts +0 -68
- package/cli/dist/context/AppContext.js +0 -363
- package/cli/dist/hooks/useInitializeAgent.d.ts +0 -19
- package/cli/dist/hooks/useInitializeAgent.js +0 -28
- package/cli/dist/hooks/useStableState.d.ts +0 -38
- package/cli/dist/hooks/useStableState.js +0 -68
- package/cli/dist/managers/AgentManager.d.ts +0 -57
- package/cli/dist/managers/AgentManager.js +0 -119
- package/cli/dist/managers/ConfigManager.d.ts +0 -53
- package/cli/dist/managers/ConfigManager.js +0 -173
- package/cli/dist/types.d.ts +0 -31
- package/cli/dist/types.js +0 -19
- package/dist/cjs/context/ReferenceContextManager.d.ts +0 -84
- package/dist/cjs/context/ReferenceResponseProcessor.d.ts +0 -76
- package/dist/cjs/services/EntityResolver.d.ts +0 -26
- package/dist/types/context/ReferenceContextManager.d.ts +0 -84
- package/dist/types/context/ReferenceResponseProcessor.d.ts +0 -76
- package/dist/types/services/EntityResolver.d.ts +0 -26
- package/src/context/ReferenceContextManager.ts +0 -350
- package/src/context/ReferenceResponseProcessor.ts +0 -295
- package/src/scripts/test-hedera-kit-wrapper.ts +0 -265
- package/src/services/EntityResolver.ts +0 -128
- /package/dist/cjs/forms/{FormEngine.d.ts → form-engine.d.ts} +0 -0
- /package/dist/cjs/langchain/{FormValidatingToolWrapper.d.ts → form-validating-tool-wrapper.d.ts} +0 -0
- /package/dist/cjs/memory/{ReferenceIdGenerator.d.ts → reference-id-generator.d.ts} +0 -0
- /package/dist/cjs/memory/{TokenCounter.d.ts → token-counter.d.ts} +0 -0
- /package/dist/cjs/tools/{EntityResolverTool.d.ts → entity-resolver-tool.d.ts} +0 -0
- /package/dist/cjs/utils/{ResponseFormatter.d.ts → response-formatter.d.ts} +0 -0
- /package/dist/types/forms/{FormEngine.d.ts → form-engine.d.ts} +0 -0
- /package/dist/types/langchain/{FormValidatingToolWrapper.d.ts → form-validating-tool-wrapper.d.ts} +0 -0
- /package/dist/types/memory/{ReferenceIdGenerator.d.ts → reference-id-generator.d.ts} +0 -0
- /package/dist/types/memory/{TokenCounter.d.ts → token-counter.d.ts} +0 -0
- /package/dist/types/tools/{EntityResolverTool.d.ts → entity-resolver-tool.d.ts} +0 -0
- /package/dist/types/utils/{ResponseFormatter.d.ts → response-formatter.d.ts} +0 -0
- /package/src/memory/{ReferenceIdGenerator.ts → reference-id-generator.ts} +0 -0
- /package/src/memory/{TokenCounter.ts → token-counter.ts} +0 -0
- /package/src/tools/{EntityResolverTool.ts → entity-resolver-tool.ts} +0 -0
- /package/src/utils/{ResponseFormatter.ts → response-formatter.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Content Reference System Types
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Shared interfaces for the Reference-Based Content System that handles
|
|
5
5
|
* large content storage with unique reference IDs to optimize context window usage.
|
|
6
6
|
*/
|
|
@@ -14,17 +14,31 @@ export type ReferenceId = string;
|
|
|
14
14
|
/**
|
|
15
15
|
* Lifecycle state of a content reference
|
|
16
16
|
*/
|
|
17
|
-
export type ReferenceLifecycleState =
|
|
17
|
+
export type ReferenceLifecycleState =
|
|
18
|
+
| 'active'
|
|
19
|
+
| 'expired'
|
|
20
|
+
| 'cleanup_pending'
|
|
21
|
+
| 'invalid';
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* Content types supported by the reference system
|
|
21
25
|
*/
|
|
22
|
-
export type ContentType =
|
|
26
|
+
export type ContentType =
|
|
27
|
+
| 'text'
|
|
28
|
+
| 'json'
|
|
29
|
+
| 'html'
|
|
30
|
+
| 'markdown'
|
|
31
|
+
| 'binary'
|
|
32
|
+
| 'unknown';
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
35
|
* Sources that created the content reference
|
|
26
36
|
*/
|
|
27
|
-
export type ContentSource =
|
|
37
|
+
export type ContentSource =
|
|
38
|
+
| 'mcp_tool'
|
|
39
|
+
| 'user_upload'
|
|
40
|
+
| 'agent_generated'
|
|
41
|
+
| 'system';
|
|
28
42
|
|
|
29
43
|
/**
|
|
30
44
|
* Metadata associated with stored content
|
|
@@ -32,59 +46,62 @@ export type ContentSource = 'mcp_tool' | 'user_upload' | 'agent_generated' | 'sy
|
|
|
32
46
|
export interface ContentMetadata {
|
|
33
47
|
/** Content type classification */
|
|
34
48
|
contentType: ContentType;
|
|
35
|
-
|
|
49
|
+
|
|
36
50
|
/** MIME type of the original content */
|
|
37
51
|
mimeType?: string;
|
|
38
|
-
|
|
52
|
+
|
|
39
53
|
/** Size in bytes of the stored content */
|
|
40
54
|
sizeBytes: number;
|
|
41
|
-
|
|
55
|
+
|
|
42
56
|
/** When the content was originally stored */
|
|
43
57
|
createdAt: Date;
|
|
44
|
-
|
|
58
|
+
|
|
45
59
|
/** Last time the content was accessed via reference resolution */
|
|
46
60
|
lastAccessedAt: Date;
|
|
47
|
-
|
|
61
|
+
|
|
48
62
|
/** Source that created this content reference */
|
|
49
63
|
source: ContentSource;
|
|
50
|
-
|
|
64
|
+
|
|
51
65
|
/** Name of the MCP tool that generated the content (if applicable) */
|
|
52
66
|
mcpToolName?: string;
|
|
53
|
-
|
|
67
|
+
|
|
54
68
|
/** Original filename or suggested name for the content */
|
|
55
69
|
fileName?: string;
|
|
56
|
-
|
|
70
|
+
|
|
57
71
|
/** Number of times this reference has been resolved */
|
|
58
72
|
accessCount: number;
|
|
59
|
-
|
|
73
|
+
|
|
60
74
|
/** Tags for categorization and cleanup policies */
|
|
61
75
|
tags?: string[];
|
|
62
|
-
|
|
76
|
+
|
|
63
77
|
/** Custom metadata from the source */
|
|
64
78
|
customMetadata?: Record<string, unknown>;
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
/**
|
|
68
82
|
* Core content reference object passed through agent context
|
|
69
|
-
* Designed to be lightweight (<100 tokens) while providing enough
|
|
83
|
+
* Designed to be lightweight (<100 tokens) while providing enough
|
|
70
84
|
* information for agent decision-making
|
|
71
85
|
*/
|
|
72
86
|
export interface ContentReference {
|
|
73
87
|
/** Unique identifier for resolving the content */
|
|
74
88
|
referenceId: ReferenceId;
|
|
75
|
-
|
|
89
|
+
|
|
76
90
|
/** Current lifecycle state */
|
|
77
91
|
state: ReferenceLifecycleState;
|
|
78
|
-
|
|
92
|
+
|
|
79
93
|
/** Brief description or preview of the content (max 200 chars) */
|
|
80
94
|
preview: string;
|
|
81
|
-
|
|
95
|
+
|
|
82
96
|
/** Essential metadata for agent decision-making */
|
|
83
|
-
metadata: Pick<
|
|
84
|
-
|
|
97
|
+
metadata: Pick<
|
|
98
|
+
ContentMetadata,
|
|
99
|
+
'contentType' | 'sizeBytes' | 'source' | 'fileName' | 'mimeType'
|
|
100
|
+
>;
|
|
101
|
+
|
|
85
102
|
/** When this reference was created */
|
|
86
103
|
createdAt: Date;
|
|
87
|
-
|
|
104
|
+
|
|
88
105
|
/** Special format indicator for reference IDs in content */
|
|
89
106
|
readonly format: 'ref://{id}';
|
|
90
107
|
}
|
|
@@ -95,19 +112,24 @@ export interface ContentReference {
|
|
|
95
112
|
export interface ReferenceResolutionResult {
|
|
96
113
|
/** Whether the resolution was successful */
|
|
97
114
|
success: boolean;
|
|
98
|
-
|
|
115
|
+
|
|
99
116
|
/** The resolved content if successful */
|
|
100
117
|
content?: Buffer;
|
|
101
|
-
|
|
118
|
+
|
|
102
119
|
/** Complete metadata if successful */
|
|
103
120
|
metadata?: ContentMetadata;
|
|
104
|
-
|
|
121
|
+
|
|
105
122
|
/** Error message if resolution failed */
|
|
106
123
|
error?: string;
|
|
107
|
-
|
|
124
|
+
|
|
108
125
|
/** Specific error type for targeted error handling */
|
|
109
|
-
errorType?:
|
|
110
|
-
|
|
126
|
+
errorType?:
|
|
127
|
+
| 'not_found'
|
|
128
|
+
| 'expired'
|
|
129
|
+
| 'corrupted'
|
|
130
|
+
| 'access_denied'
|
|
131
|
+
| 'system_error';
|
|
132
|
+
|
|
111
133
|
/** Suggested actions for recovery */
|
|
112
134
|
suggestedActions?: string[];
|
|
113
135
|
}
|
|
@@ -118,39 +140,39 @@ export interface ReferenceResolutionResult {
|
|
|
118
140
|
export interface ContentReferenceConfig {
|
|
119
141
|
/** Size threshold above which content should be stored as references (default: 10KB) */
|
|
120
142
|
sizeThresholdBytes: number;
|
|
121
|
-
|
|
143
|
+
|
|
122
144
|
/** Maximum age for unused references before cleanup (default: 1 hour) */
|
|
123
145
|
maxAgeMs: number;
|
|
124
|
-
|
|
146
|
+
|
|
125
147
|
/** Maximum number of references to store simultaneously */
|
|
126
148
|
maxReferences: number;
|
|
127
|
-
|
|
149
|
+
|
|
128
150
|
/** Maximum total storage size for all references */
|
|
129
151
|
maxTotalStorageBytes: number;
|
|
130
|
-
|
|
152
|
+
|
|
131
153
|
/** Whether to enable automatic cleanup */
|
|
132
154
|
enableAutoCleanup: boolean;
|
|
133
|
-
|
|
155
|
+
|
|
134
156
|
/** Interval for cleanup checks in milliseconds */
|
|
135
157
|
cleanupIntervalMs: number;
|
|
136
|
-
|
|
158
|
+
|
|
137
159
|
/** Whether to persist references across restarts */
|
|
138
160
|
enablePersistence: boolean;
|
|
139
|
-
|
|
161
|
+
|
|
140
162
|
/** Storage backend configuration */
|
|
141
163
|
storageBackend: 'memory' | 'filesystem' | 'hybrid';
|
|
142
|
-
|
|
164
|
+
|
|
143
165
|
/** Cleanup policies for different content types */
|
|
144
166
|
cleanupPolicies: {
|
|
145
167
|
/** Policy for content marked as "recent" from MCP tools */
|
|
146
168
|
recent: { maxAgeMs: number; priority: number };
|
|
147
|
-
|
|
169
|
+
|
|
148
170
|
/** Policy for user-uploaded content */
|
|
149
171
|
userContent: { maxAgeMs: number; priority: number };
|
|
150
|
-
|
|
172
|
+
|
|
151
173
|
/** Policy for agent-generated content */
|
|
152
174
|
agentGenerated: { maxAgeMs: number; priority: number };
|
|
153
|
-
|
|
175
|
+
|
|
154
176
|
/** Default policy for other content */
|
|
155
177
|
default: { maxAgeMs: number; priority: number };
|
|
156
178
|
};
|
|
@@ -172,8 +194,8 @@ export const DEFAULT_CONTENT_REFERENCE_CONFIG: ContentReferenceConfig = {
|
|
|
172
194
|
recent: { maxAgeMs: 30 * 60 * 1000, priority: 1 },
|
|
173
195
|
userContent: { maxAgeMs: 2 * 60 * 60 * 1000, priority: 2 },
|
|
174
196
|
agentGenerated: { maxAgeMs: 60 * 60 * 1000, priority: 3 },
|
|
175
|
-
default: { maxAgeMs: 60 * 60 * 1000, priority: 4 }
|
|
176
|
-
}
|
|
197
|
+
default: { maxAgeMs: 60 * 60 * 1000, priority: 4 },
|
|
198
|
+
},
|
|
177
199
|
};
|
|
178
200
|
|
|
179
201
|
/**
|
|
@@ -182,36 +204,36 @@ export const DEFAULT_CONTENT_REFERENCE_CONFIG: ContentReferenceConfig = {
|
|
|
182
204
|
export interface ContentReferenceStats {
|
|
183
205
|
/** Total number of active references */
|
|
184
206
|
activeReferences: number;
|
|
185
|
-
|
|
207
|
+
|
|
186
208
|
/** Total storage used by all references in bytes */
|
|
187
209
|
totalStorageBytes: number;
|
|
188
|
-
|
|
210
|
+
|
|
189
211
|
/** Number of references cleaned up in last cleanup cycle */
|
|
190
212
|
recentlyCleanedUp: number;
|
|
191
|
-
|
|
213
|
+
|
|
192
214
|
/** Number of successful reference resolutions since startup */
|
|
193
215
|
totalResolutions: number;
|
|
194
|
-
|
|
216
|
+
|
|
195
217
|
/** Number of failed resolution attempts */
|
|
196
218
|
failedResolutions: number;
|
|
197
|
-
|
|
219
|
+
|
|
198
220
|
/** Average content size in bytes */
|
|
199
221
|
averageContentSize: number;
|
|
200
|
-
|
|
222
|
+
|
|
201
223
|
/** Most frequently accessed reference ID */
|
|
202
224
|
mostAccessedReferenceId?: ReferenceId;
|
|
203
|
-
|
|
225
|
+
|
|
204
226
|
/** Storage utilization percentage */
|
|
205
227
|
storageUtilization: number;
|
|
206
|
-
|
|
228
|
+
|
|
207
229
|
/** Performance metrics */
|
|
208
230
|
performanceMetrics: {
|
|
209
231
|
/** Average time to create a reference in milliseconds */
|
|
210
232
|
averageCreationTimeMs: number;
|
|
211
|
-
|
|
233
|
+
|
|
212
234
|
/** Average time to resolve a reference in milliseconds */
|
|
213
235
|
averageResolutionTimeMs: number;
|
|
214
|
-
|
|
236
|
+
|
|
215
237
|
/** Average cleanup time in milliseconds */
|
|
216
238
|
averageCleanupTimeMs: number;
|
|
217
239
|
};
|
|
@@ -241,41 +263,46 @@ export interface ContentReferenceStore {
|
|
|
241
263
|
*/
|
|
242
264
|
storeContent(
|
|
243
265
|
content: Buffer,
|
|
244
|
-
metadata: Omit<
|
|
266
|
+
metadata: Omit<
|
|
267
|
+
ContentMetadata,
|
|
268
|
+
'createdAt' | 'lastAccessedAt' | 'accessCount'
|
|
269
|
+
>
|
|
245
270
|
): Promise<ContentReference>;
|
|
246
|
-
|
|
271
|
+
|
|
247
272
|
/**
|
|
248
273
|
* Resolve a reference to its content
|
|
249
274
|
*/
|
|
250
|
-
resolveReference(
|
|
251
|
-
|
|
275
|
+
resolveReference(
|
|
276
|
+
referenceId: ReferenceId
|
|
277
|
+
): Promise<ReferenceResolutionResult>;
|
|
278
|
+
|
|
252
279
|
/**
|
|
253
280
|
* Check if a reference exists and is valid
|
|
254
281
|
*/
|
|
255
282
|
hasReference(referenceId: ReferenceId): Promise<boolean>;
|
|
256
|
-
|
|
283
|
+
|
|
257
284
|
/**
|
|
258
285
|
* Mark a reference for cleanup
|
|
259
286
|
*/
|
|
260
287
|
cleanupReference(referenceId: ReferenceId): Promise<boolean>;
|
|
261
|
-
|
|
288
|
+
|
|
262
289
|
/**
|
|
263
290
|
* Get current storage statistics
|
|
264
291
|
*/
|
|
265
292
|
getStats(): Promise<ContentReferenceStats>;
|
|
266
|
-
|
|
293
|
+
|
|
267
294
|
/**
|
|
268
295
|
* Update configuration
|
|
269
296
|
*/
|
|
270
297
|
updateConfig(config: Partial<ContentReferenceConfig>): Promise<void>;
|
|
271
|
-
|
|
298
|
+
|
|
272
299
|
/**
|
|
273
300
|
* Perform cleanup based on current policies
|
|
274
301
|
*/
|
|
275
302
|
performCleanup(): Promise<{ cleanedUp: number; errors: string[] }>;
|
|
276
|
-
|
|
303
|
+
|
|
277
304
|
/**
|
|
278
305
|
* Dispose of resources
|
|
279
306
|
*/
|
|
280
307
|
dispose(): Promise<void>;
|
|
281
|
-
}
|
|
308
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './response-formatter';
|
package/cli/dist/CLIApp.d.ts
DELETED
package/cli/dist/CLIApp.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import { useApp } from 'ink';
|
|
3
|
-
import { ScreenRouter } from './components/ScreenRouter.js';
|
|
4
|
-
import { ConfigManager } from './managers/ConfigManager.js';
|
|
5
|
-
import { AgentManager } from './managers/AgentManager.js';
|
|
6
|
-
import { useStableState } from './hooks/useStableState.js';
|
|
7
|
-
import { useInitializeAgent } from './hooks/useInitializeAgent.js';
|
|
8
|
-
export const CLIApp = props => {
|
|
9
|
-
const { exit } = useApp();
|
|
10
|
-
const configManager = useMemo(() => ConfigManager.getInstance(), []);
|
|
11
|
-
const agentManager = useMemo(() => AgentManager.getInstance(), []);
|
|
12
|
-
const initialConfig = useMemo(() => configManager.getConfig(props), [
|
|
13
|
-
configManager,
|
|
14
|
-
props.accountId,
|
|
15
|
-
props.privateKey,
|
|
16
|
-
props.network,
|
|
17
|
-
props.openAIApiKey,
|
|
18
|
-
]);
|
|
19
|
-
const initialMcpServers = useMemo(() => configManager.getMCPServers(), [configManager]);
|
|
20
|
-
const { state, actions } = useStableState(initialMcpServers);
|
|
21
|
-
const [currentConfig, setCurrentConfig] = useState(initialConfig);
|
|
22
|
-
const initializeAgent = useInitializeAgent({
|
|
23
|
-
configManager,
|
|
24
|
-
agentManager,
|
|
25
|
-
actions,
|
|
26
|
-
});
|
|
27
|
-
const handleInitializeAgent = useCallback(() => {
|
|
28
|
-
initializeAgent(currentConfig, state.mcpConfig);
|
|
29
|
-
}, [initializeAgent, currentConfig, state.mcpConfig]);
|
|
30
|
-
const sendMessage = useCallback(async (message) => {
|
|
31
|
-
if (!message.trim())
|
|
32
|
-
return;
|
|
33
|
-
const userMessage = {
|
|
34
|
-
role: 'user',
|
|
35
|
-
content: message,
|
|
36
|
-
timestamp: new Date(),
|
|
37
|
-
};
|
|
38
|
-
actions.addMessages([userMessage]);
|
|
39
|
-
actions.setInput('');
|
|
40
|
-
actions.setLoading(true);
|
|
41
|
-
try {
|
|
42
|
-
const chatHistory = state.messages
|
|
43
|
-
.filter((m) => m.role !== 'system')
|
|
44
|
-
.map((m) => ({
|
|
45
|
-
type: m.role === 'user' ? 'human' : 'ai',
|
|
46
|
-
content: m.content,
|
|
47
|
-
}));
|
|
48
|
-
const response = await agentManager.sendMessage(message, chatHistory);
|
|
49
|
-
const assistantMessage = {
|
|
50
|
-
role: 'assistant',
|
|
51
|
-
content: response.message ||
|
|
52
|
-
response.output ||
|
|
53
|
-
response.error ||
|
|
54
|
-
'No response received',
|
|
55
|
-
timestamp: new Date(),
|
|
56
|
-
};
|
|
57
|
-
const newMessages = [assistantMessage];
|
|
58
|
-
if (response.transactionId) {
|
|
59
|
-
newMessages.push({
|
|
60
|
-
role: 'system',
|
|
61
|
-
content: `Transaction ID: ${response.transactionId}`,
|
|
62
|
-
timestamp: new Date(),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (response.scheduleId) {
|
|
66
|
-
newMessages.push({
|
|
67
|
-
role: 'system',
|
|
68
|
-
content: `Schedule ID: ${response.scheduleId}`,
|
|
69
|
-
timestamp: new Date(),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
if (response.notes && response.notes.length > 0) {
|
|
73
|
-
response.notes.forEach((note) => {
|
|
74
|
-
newMessages.push({
|
|
75
|
-
role: 'system',
|
|
76
|
-
content: note,
|
|
77
|
-
timestamp: new Date(),
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
actions.addMessages(newMessages);
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
actions.addMessages([
|
|
85
|
-
{
|
|
86
|
-
role: 'system',
|
|
87
|
-
content: `Error: ${err instanceof Error ? err.message : 'Unknown error'}`,
|
|
88
|
-
timestamp: new Date(),
|
|
89
|
-
},
|
|
90
|
-
]);
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
actions.setLoading(false);
|
|
94
|
-
}
|
|
95
|
-
}, [agentManager, state.messages, actions]);
|
|
96
|
-
const updateConfig = (field, value) => {
|
|
97
|
-
const updated = { ...currentConfig, [field]: value };
|
|
98
|
-
setCurrentConfig(updated);
|
|
99
|
-
};
|
|
100
|
-
const saveMCPConfig = () => {
|
|
101
|
-
const servers = [];
|
|
102
|
-
if (state.mcpConfig.enableFilesystem) {
|
|
103
|
-
const filesystemServer = {
|
|
104
|
-
name: 'filesystem',
|
|
105
|
-
command: 'npx',
|
|
106
|
-
args: [
|
|
107
|
-
'-y',
|
|
108
|
-
'@modelcontextprotocol/server-filesystem',
|
|
109
|
-
state.mcpConfig.filesystemPath,
|
|
110
|
-
],
|
|
111
|
-
transport: 'stdio',
|
|
112
|
-
autoConnect: true,
|
|
113
|
-
};
|
|
114
|
-
servers.push(filesystemServer);
|
|
115
|
-
}
|
|
116
|
-
servers.push(...state.mcpConfig.customServers);
|
|
117
|
-
configManager.saveMCPConfig(servers);
|
|
118
|
-
};
|
|
119
|
-
const stableHandlers = useMemo(() => ({
|
|
120
|
-
initializeAgent: handleInitializeAgent,
|
|
121
|
-
sendMessage,
|
|
122
|
-
updateConfig,
|
|
123
|
-
saveMCPConfig,
|
|
124
|
-
getMCPConfigPath: () => configManager.getMCPConfigPathForDisplay(),
|
|
125
|
-
}), [handleInitializeAgent, sendMessage]);
|
|
126
|
-
return (React.createElement(ScreenRouter, { state: state, currentConfig: currentConfig, actions: actions, stableHandlers: stableHandlers, exit: exit }));
|
|
127
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal ConversationalAgent implementation for CLI use
|
|
3
|
-
* This avoids complex dependencies while providing the core functionality
|
|
4
|
-
*
|
|
5
|
-
* For local development, this allows the CLI to work without needing to publish
|
|
6
|
-
* the main package, while still providing a functional demo of the interface.
|
|
7
|
-
*/
|
|
8
|
-
export interface ConversationalAgentOptions {
|
|
9
|
-
accountId: string;
|
|
10
|
-
privateKey: string;
|
|
11
|
-
network: 'testnet' | 'mainnet';
|
|
12
|
-
openAIApiKey: string;
|
|
13
|
-
openAIModelName?: string;
|
|
14
|
-
plugins?: any[];
|
|
15
|
-
verbose?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface AgentResponse {
|
|
18
|
-
message?: string;
|
|
19
|
-
output?: string;
|
|
20
|
-
error?: string;
|
|
21
|
-
transactionId?: string;
|
|
22
|
-
scheduleId?: string;
|
|
23
|
-
notes?: string[];
|
|
24
|
-
}
|
|
25
|
-
export declare class ConversationalAgent {
|
|
26
|
-
private config;
|
|
27
|
-
private initialized;
|
|
28
|
-
constructor(config: ConversationalAgentOptions);
|
|
29
|
-
initialize(): Promise<void>;
|
|
30
|
-
processMessage(message: string, _chatHistory?: Array<{
|
|
31
|
-
type: 'human' | 'ai';
|
|
32
|
-
content: string;
|
|
33
|
-
}>): Promise<AgentResponse>;
|
|
34
|
-
}
|
|
35
|
-
export declare class OpenConvAIPlugin {
|
|
36
|
-
constructor();
|
|
37
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal ConversationalAgent implementation for CLI use
|
|
3
|
-
* This avoids complex dependencies while providing the core functionality
|
|
4
|
-
*
|
|
5
|
-
* For local development, this allows the CLI to work without needing to publish
|
|
6
|
-
* the main package, while still providing a functional demo of the interface.
|
|
7
|
-
*/
|
|
8
|
-
export class ConversationalAgent {
|
|
9
|
-
constructor(config) {
|
|
10
|
-
Object.defineProperty(this, "config", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: void 0
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "initialized", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: false
|
|
21
|
-
});
|
|
22
|
-
this.config = config;
|
|
23
|
-
}
|
|
24
|
-
async initialize() {
|
|
25
|
-
if (!this.config.accountId || !this.config.privateKey || !this.config.openAIApiKey) {
|
|
26
|
-
throw new Error('Missing required configuration: accountId, privateKey, or openAIApiKey');
|
|
27
|
-
}
|
|
28
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
29
|
-
this.initialized = true;
|
|
30
|
-
}
|
|
31
|
-
async processMessage(message, _chatHistory) {
|
|
32
|
-
if (!this.initialized) {
|
|
33
|
-
throw new Error('Agent not initialized. Call initialize() first.');
|
|
34
|
-
}
|
|
35
|
-
const responses = [
|
|
36
|
-
"I'm a demo version of the Conversational Agent. In the full version, I would help you interact with the Hedera network.",
|
|
37
|
-
"This CLI demonstrates the interface for the Hashgraph Online Conversational Agent. Full functionality requires the complete implementation.",
|
|
38
|
-
"I understand you want to use Hedera network features. The production version would process this request using real network calls.",
|
|
39
|
-
"Demo mode: Your message has been received. The full agent would analyze this and execute appropriate Hedera operations.",
|
|
40
|
-
"This is a placeholder response. The actual Conversational Agent would provide real Hedera network functionality."
|
|
41
|
-
];
|
|
42
|
-
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
|
|
43
|
-
return {
|
|
44
|
-
message: randomResponse,
|
|
45
|
-
output: `Demo response for: ${message}`,
|
|
46
|
-
notes: [
|
|
47
|
-
`Connected to ${this.config.network}`,
|
|
48
|
-
`Using account ${this.config.accountId}`,
|
|
49
|
-
`Model: ${this.config.openAIModelName || 'gpt-4o-mini'}`,
|
|
50
|
-
'Running in CLI demo mode'
|
|
51
|
-
]
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export class OpenConvAIPlugin {
|
|
56
|
-
constructor() {
|
|
57
|
-
}
|
|
58
|
-
}
|
package/cli/dist/app.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type Props = {
|
|
3
|
-
accountId?: string;
|
|
4
|
-
privateKey?: string;
|
|
5
|
-
network?: 'testnet' | 'mainnet';
|
|
6
|
-
openAIApiKey?: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Main App component for the Hashgraph Online Conversational Agent CLI
|
|
10
|
-
* @param accountId - Hedera account ID
|
|
11
|
-
* @param privateKey - Hedera private key
|
|
12
|
-
* @param network - Network to connect to (testnet or mainnet)
|
|
13
|
-
* @param openAIApiKey - OpenAI API key for the conversational agent
|
|
14
|
-
*/
|
|
15
|
-
export default function App({ accountId, privateKey, network, openAIApiKey, }: Props): React.JSX.Element;
|
|
16
|
-
export {};
|
package/cli/dist/app.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CLIApp } from './CLIApp.js';
|
|
3
|
-
process.setMaxListeners(20);
|
|
4
|
-
/**
|
|
5
|
-
* Main App component for the Hashgraph Online Conversational Agent CLI
|
|
6
|
-
* @param accountId - Hedera account ID
|
|
7
|
-
* @param privateKey - Hedera private key
|
|
8
|
-
* @param network - Network to connect to (testnet or mainnet)
|
|
9
|
-
* @param openAIApiKey - OpenAI API key for the conversational agent
|
|
10
|
-
*/
|
|
11
|
-
export default function App({ accountId, privateKey, network = 'testnet', openAIApiKey, }) {
|
|
12
|
-
return (React.createElement(CLIApp, { accountId: accountId, privateKey: privateKey, network: network, openAIApiKey: openAIApiKey }));
|
|
13
|
-
}
|
package/cli/dist/cli.d.ts
DELETED
package/cli/dist/cli.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from 'ink';
|
|
4
|
-
import meow from 'meow';
|
|
5
|
-
import App from './app.js';
|
|
6
|
-
const cli = meow(`
|
|
7
|
-
Usage
|
|
8
|
-
$ conversational-agent
|
|
9
|
-
|
|
10
|
-
Options
|
|
11
|
-
--account-id Hedera account ID (e.g., 0.0.12345)
|
|
12
|
-
--private-key Private key for the account
|
|
13
|
-
--network Network to connect to (mainnet or testnet) [default: testnet]
|
|
14
|
-
--openai-api-key OpenAI API key for the LLM
|
|
15
|
-
|
|
16
|
-
Examples
|
|
17
|
-
$ conversational-agent
|
|
18
|
-
Interactive mode - will prompt for configuration
|
|
19
|
-
|
|
20
|
-
$ conversational-agent --account-id=0.0.12345 --private-key=... --openai-api-key=sk-...
|
|
21
|
-
Start with provided configuration
|
|
22
|
-
|
|
23
|
-
$ export HEDERA_ACCOUNT_ID=0.0.12345
|
|
24
|
-
$ export HEDERA_PRIVATE_KEY=...
|
|
25
|
-
$ export OPENAI_API_KEY=sk-...
|
|
26
|
-
$ conversational-agent
|
|
27
|
-
Uses environment variables for Hedera credentials
|
|
28
|
-
`, {
|
|
29
|
-
importMeta: import.meta,
|
|
30
|
-
flags: {
|
|
31
|
-
accountId: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
default: process.env['HEDERA_ACCOUNT_ID'] || '',
|
|
34
|
-
},
|
|
35
|
-
privateKey: {
|
|
36
|
-
type: 'string',
|
|
37
|
-
default: process.env['HEDERA_PRIVATE_KEY'] || '',
|
|
38
|
-
},
|
|
39
|
-
network: {
|
|
40
|
-
type: 'string',
|
|
41
|
-
default: process.env['HEDERA_NETWORK'] || 'testnet',
|
|
42
|
-
choices: ['testnet', 'mainnet'],
|
|
43
|
-
},
|
|
44
|
-
openaiApiKey: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
default: process.env['OPENAI_API_KEY'] || '',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
const { waitUntilExit } = render(React.createElement(App, { accountId: cli.flags.accountId, privateKey: cli.flags.privateKey, network: cli.flags.network, openAIApiKey: cli.flags.openaiApiKey }));
|
|
51
|
-
waitUntilExit().then(() => process.exit(0));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type Config } from '../types.js';
|
|
3
|
-
import { type AppState } from '../hooks/useStableState.js';
|
|
4
|
-
interface Props {
|
|
5
|
-
state: AppState;
|
|
6
|
-
currentConfig: Config;
|
|
7
|
-
actions: any;
|
|
8
|
-
stableHandlers: any;
|
|
9
|
-
exit: () => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* App container that keeps all screens mounted but only displays one
|
|
13
|
-
* This prevents unmounting/remounting which causes double renders
|
|
14
|
-
*/
|
|
15
|
-
export declare const AppContainer: React.FC<Props>;
|
|
16
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box } from 'ink';
|
|
3
|
-
import { WelcomeScreen } from './WelcomeScreen.js';
|
|
4
|
-
import { ChatScreen } from './ChatScreen.js';
|
|
5
|
-
import { LoadingScreen } from './LoadingScreen.js';
|
|
6
|
-
import { SetupScreen } from './SetupScreen.js';
|
|
7
|
-
import { MCPConfigScreen } from './MCPConfigScreen.js';
|
|
8
|
-
/**
|
|
9
|
-
* App container that keeps all screens mounted but only displays one
|
|
10
|
-
* This prevents unmounting/remounting which causes double renders
|
|
11
|
-
*/
|
|
12
|
-
export const AppContainer = ({ state, currentConfig, actions, stableHandlers, exit, }) => {
|
|
13
|
-
return (React.createElement(React.Fragment, null,
|
|
14
|
-
React.createElement(Box, { display: state.screen === 'welcome' ? 'flex' : 'none' },
|
|
15
|
-
React.createElement(WelcomeScreen, { config: currentConfig, onExit: exit, onInitializeAgent: stableHandlers.initializeAgent, onSetScreen: actions.setScreen })),
|
|
16
|
-
React.createElement(Box, { display: state.screen === 'loading' ? 'flex' : 'none' },
|
|
17
|
-
React.createElement(LoadingScreen, null)),
|
|
18
|
-
React.createElement(Box, { display: state.screen === 'setup' ? 'flex' : 'none' },
|
|
19
|
-
React.createElement(SetupScreen, { config: currentConfig, currentField: state.currentField, error: state.error, onUpdateConfig: stableHandlers.updateConfig, onSetCurrentField: actions.setCurrentField, onInitializeAgent: stableHandlers.initializeAgent })),
|
|
20
|
-
React.createElement(Box, { display: state.screen === 'mcp-config' ? 'flex' : 'none' },
|
|
21
|
-
React.createElement(MCPConfigScreen, { mcpConfig: state.mcpConfig, editingFilesystemPath: state.editingFilesystemPath, onSetMcpConfig: actions.setMcpConfig, onSetEditingFilesystemPath: actions.setEditingFilesystemPath, onSetScreen: actions.setScreen, onSaveMCPConfig: stableHandlers.saveMCPConfig, getMCPConfigPath: stableHandlers.getMCPConfigPath })),
|
|
22
|
-
React.createElement(Box, { display: state.screen === 'chat' ? 'flex' : 'none' },
|
|
23
|
-
React.createElement(ChatScreen, { config: currentConfig, messages: state.messages, input: state.input, isLoading: state.isLoading, setInput: actions.setInput, sendMessage: stableHandlers.sendMessage, showLogs: false, logs: state.logs }))));
|
|
24
|
-
};
|