Skip to content

Commit fd98c60

Browse files
author
mike dupont
committed
running in ts
1 parent 17a23fc commit fd98c60

File tree

6 files changed

+28
-75
lines changed

6 files changed

+28
-75
lines changed

agent/src/index.ts

+2-60
Original file line numberDiff line numberDiff line change
@@ -106,65 +106,7 @@ function mergeCharacters(base: Character, child: Character): Character {
106106
};
107107
return mergeObjects(base, child);
108108
}
109-
/* function isAllStrings(arr: unknown[]): boolean {
110-
return Array.isArray(arr) && arr.every((item) => typeof item === "string");
111-
}
112-
export async function loadCharacterFromOnchain(): Promise<Character[]> {
113-
const jsonText = onchainJson;
114-
115-
console.log("JSON:", jsonText);
116-
if (!jsonText) return [];
117-
const loadedCharacters = [];
118-
try {
119-
const character = JSON5.parse(jsonText);
120-
validateCharacterConfig(character);
121-
122-
// .id isn't really valid
123-
const characterId = character.id || character.name;
124-
const characterPrefix = `CHARACTER.${characterId
125-
.toUpperCase()
126-
.replace(/ /g, "_")}.`;
127-
128-
const characterSettings = Object.entries(process.env)
129-
.filter(([key]) => key.startsWith(characterPrefix))
130-
.reduce((settings, [key, value]) => {
131-
const settingKey = key.slice(characterPrefix.length);
132-
settings[settingKey] = value;
133-
return settings;
134-
}, {});
135-
136-
if (Object.keys(characterSettings).length > 0) {
137-
character.settings = character.settings || {};
138-
character.settings.secrets = {
139-
...characterSettings,
140-
...character.settings.secrets,
141-
};
142-
}
143-
144-
// Handle plugins
145-
if (isAllStrings(character.plugins)) {
146-
elizaLogger.info("Plugins are: ", character.plugins);
147-
const importedPlugins = await Promise.all(
148-
character.plugins.map(async (plugin) => {
149-
const importedPlugin = await import(plugin);
150-
return importedPlugin.default;
151-
})
152-
);
153-
character.plugins = importedPlugins;
154-
}
155109

156-
loadedCharacters.push(character);
157-
elizaLogger.info(
158-
`Successfully loaded character from: ${process.env.IQ_WALLET_ADDRESS}`
159-
);
160-
return loadedCharacters;
161-
} catch (e) {
162-
elizaLogger.error(
163-
`Error parsing character from ${process.env.IQ_WALLET_ADDRESS}: ${e}`
164-
);
165-
process.exit(1);
166-
}
167-
} */
168110

169111
async function loadCharactersFromUrl(url: string): Promise<Character[]> {
170112
try {
@@ -947,8 +889,8 @@ const setProxy = () => {
947889

948890
setProxy();
949891

950-
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
951-
const __dirname = path.dirname(__filename); // get the name of the directory
892+
//const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
893+
//const __dirname = path.dirname(__filename); // get the name of the directory
952894

953895
startAgents().catch((error) => {
954896
elizaLogger.error("Unhandled error in startAgents:", error);

packages/client-direct/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ export class DirectClient {
10271027
elizaLogger.error(
10281028
"Could not close connections in time, forcefully shutting down"
10291029
);
1030-
process.exit(1);
1030+
process.exit(11);
10311031
}, 5000);
10321032
};
10331033

packages/core/src/config.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import dotenv from "dotenv";
22
import path from "path";
33
import { fileURLToPath } from "url";
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = path.dirname(__filename);
5+
// const __filename = fileURLToPath(import.meta.url);
6+
// const __dirname = path.dirname(__filename);
77

8-
// Load environment variables from root .env file
9-
dotenv.config({ path: path.resolve(__dirname, "../../../.env") });
8+
// // Load environment variables from root .env file
9+
// dotenv.config({ path: path.resolve(__dirname, "../../../.env") });

packages/core/src/localembeddingManager.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class LocalEmbeddingModelManager {
2323
const __filename = fileURLToPath(import.meta.url);
2424
const __dirname = path.dirname(__filename);
2525
const rootPath = path.resolve(__dirname, "..");
26+
console.log("ROOT",rootPath);
2627
return rootPath.includes("/eliza/")
2728
? rootPath.split("/eliza/")[0] + "/eliza/"
2829
: path.resolve(__dirname, "..");

scripts/jsdoc-automation/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"scripts": {
1010
"build": "tsup",
1111
"dev": "tsup --watch",
12-
"start": "node dist/index.js",
12+
"start": "NODE_ENV=development VERBOSE=true DEFAULT_LOG_LEVEL=debug DEBUG=eliza:* node --trace-uncaught dist/index.js",
1313
"dbg": "node --inspect-brk --loader ts-node/esm src/index.ts",
1414
"dbg2": "node --inspect --loader ts-node/esm src/index.ts",
1515
"dbg3": "npx --node-options=--inspect-brk tsx ./src/index",

scripts/jsdoc-automation/src/index.ts

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//const __filename = "error";
2+
import { fileURLToPath } from 'url'
3+
import { dirname } from 'path'
4+
const __filename = fileURLToPath(import.meta.url)
5+
const __dirname = dirname(__filename)
6+
7+
console.log(__filename);
8+
console.log(__dirname);
19
import { DirectoryTraversal } from "./DirectoryTraversal.js";
210
import { TypeScriptParser } from "./TypeScriptParser.js";
311
import { JsDocAnalyzer } from "./JsDocAnalyzer.js";
@@ -128,7 +136,7 @@ async function main() {
128136
stack: error instanceof Error ? error.stack : undefined,
129137
timestamp: new Date().toISOString(),
130138
});
131-
process.exit(1);
139+
process.exit(2);
132140
}
133141
} catch (error) {
134142
console.error("Critical error during documentation generation:", {
@@ -144,15 +152,17 @@ async function main() {
144152
nodeVersion: process.version,
145153
platform: process.platform,
146154
});
147-
process.exit(1);
155+
process.exit(12);
148156
}
149157
}
150158

151159
// Simple error handling for the main function
152-
main().catch((error) => {
153-
console.error(
154-
"Fatal error:",
155-
error instanceof Error ? error.message : String(error)
156-
);
157-
process.exit(1);
158-
});
160+
main()
161+
// .catch((error) => {
162+
// console.log("ERROR");
163+
// console.error(
164+
// "Fatal error:",
165+
// error instanceof Error ? error.message : String(error)
166+
// );
167+
// process.exit(10);
168+
// });

0 commit comments

Comments
 (0)