0agent 1.0.88 → 1.0.90
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/dist/daemon.mjs +40 -25
- package/package.json +1 -1
package/dist/daemon.mjs
CHANGED
|
@@ -6344,24 +6344,35 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
|
|
|
6344
6344
|
const isCodingTask = !hasGUI && !!(task && /\b(implement|build|write|fix|refactor|debug|test|add.*feature|create.*function|edit.*file|modify|update.*code|class|function|interface|component|module|api|endpoint|schema|migration|type|hook|util|script|cli|service|handler|middleware)\b/i.test(task));
|
|
6345
6345
|
const isJustdoTask = !!(task && /book|file.*itr|tax.*file|irctc|train.*ticket|flight|passport|appointment|login.*portal|pan.*card|aadhaar|monitor.*watch|price.*drop|slot.*available|justdo/i.test(task));
|
|
6346
6346
|
const dateStr = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
6347
|
+
const agentRoot = this.agentRoot || resolve7(homedir2(), ".0agent");
|
|
6348
|
+
const configPath = resolve7(homedir2(), ".0agent", "config.yaml");
|
|
6347
6349
|
const lines = [
|
|
6348
|
-
`You are 0agent, a persistent AI agent
|
|
6349
|
-
`
|
|
6350
|
+
`You are 0agent, a persistent AI agent installed at: ${agentRoot}`,
|
|
6351
|
+
`Config: ${configPath}`,
|
|
6350
6352
|
`Working directory: ${this.cwd}`,
|
|
6351
6353
|
`Date: ${dateStr}`,
|
|
6352
6354
|
``,
|
|
6353
|
-
`
|
|
6354
|
-
`
|
|
6355
|
-
`
|
|
6355
|
+
`YOUR ARCHITECTURE (know thyself):`,
|
|
6356
|
+
` Source code: ${agentRoot}/packages/daemon/src/`,
|
|
6357
|
+
` Config file: ${configPath}`,
|
|
6358
|
+
` Tools/capabilities: ${agentRoot}/packages/daemon/src/tools/`,
|
|
6359
|
+
` Skills: ${agentRoot}/skills/`,
|
|
6360
|
+
` Surfaces (Telegram/Slack/WhatsApp): ${agentRoot}/packages/daemon/src/surfaces/`,
|
|
6361
|
+
` Memory DB: ~/.0agent/graph.db`,
|
|
6362
|
+
` Memory file: ~/.0agent/MEMORY.md`,
|
|
6363
|
+
` Bundle: ${agentRoot}/dist/daemon.mjs`,
|
|
6364
|
+
` Rebuild: cd ${agentRoot} && node scripts/bundle.mjs && pkill -f "daemon.mjs"`,
|
|
6356
6365
|
``,
|
|
6357
|
-
`
|
|
6358
|
-
`
|
|
6359
|
-
`
|
|
6360
|
-
|
|
6361
|
-
`
|
|
6366
|
+
`When the user mentions "the bot", "telegram", "my agent", "yourself", "this agent",`,
|
|
6367
|
+
`"the integration", etc. \u2014 they mean YOU. Look at YOUR config and YOUR source code first.`,
|
|
6368
|
+
`Do NOT search the filesystem for other projects. Start with: file_op(op:"read", path:"${configPath}")`,
|
|
6369
|
+
``,
|
|
6370
|
+
`SELF-IMPROVEMENT: When asked to add a capability, fix something about yourself, or adapt \u2014`,
|
|
6371
|
+
`modify YOUR OWN source at ${agentRoot}/packages/daemon/src/. Read, edit, rebuild.`,
|
|
6372
|
+
``,
|
|
6373
|
+
`PERSONALITY: Be warm, helpful, genuinely curious. Save user info to memory_write.`,
|
|
6362
6374
|
``,
|
|
6363
6375
|
`Use tools to accomplish tasks \u2014 don't describe what to do, do it.`,
|
|
6364
|
-
`For background processes, always redirect output: cmd > /tmp/log 2>&1 &`,
|
|
6365
6376
|
`Prefer file_op edit (find-and-replace) over rewriting entire files.`,
|
|
6366
6377
|
`Be concise. State what was done and where to find it.`,
|
|
6367
6378
|
``,
|
|
@@ -8302,20 +8313,24 @@ var SessionManager = class {
|
|
|
8302
8313
|
const provider = activeLLM["config"]?.provider ?? "anthropic";
|
|
8303
8314
|
const fastModel = getFastModelId(provider);
|
|
8304
8315
|
const llmToUse = fastModel ? activeLLM.withModel(fastModel) : activeLLM;
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8316
|
+
try {
|
|
8317
|
+
const resp = await llmToUse.complete(
|
|
8318
|
+
[{ role: "user", content: enrichedReq.task }],
|
|
8319
|
+
this.identity ? `You are 0agent, a helpful AI assistant. You are talking to ${this.identity.name}. Be concise and friendly.` : "You are 0agent, a helpful AI assistant. Be concise and friendly."
|
|
8320
|
+
);
|
|
8321
|
+
const output = resp.content || "Hey! How can I help?";
|
|
8322
|
+
this.emit({ type: "session.token", session_id: sessionId, token: output });
|
|
8323
|
+
this.addStep(sessionId, `Done (${resp.tokens_used} tokens, fast model)`);
|
|
8324
|
+
this.completeSession(sessionId, {
|
|
8325
|
+
output,
|
|
8326
|
+
files_written: [],
|
|
8327
|
+
commands_run: [],
|
|
8328
|
+
tokens_used: resp.tokens_used,
|
|
8329
|
+
model: resp.model
|
|
8330
|
+
});
|
|
8331
|
+
return this.sessions.get(sessionId);
|
|
8332
|
+
} catch {
|
|
8333
|
+
}
|
|
8319
8334
|
}
|
|
8320
8335
|
const executor = new AgentExecutor(
|
|
8321
8336
|
activeLLM,
|