@openape/ape-agent 2.8.0 → 2.8.2
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/bridge.mjs +9 -4
- package/package.json +2 -2
package/dist/bridge.mjs
CHANGED
|
@@ -4117,7 +4117,7 @@ var CronRunner = class {
|
|
|
4117
4117
|
const contacts = await this.deps.chat.listContacts().catch(() => []);
|
|
4118
4118
|
const ownerLower = this.deps.ownerEmail.toLowerCase();
|
|
4119
4119
|
const room = contacts.find((c3) => c3.peerEmail.toLowerCase() === ownerLower && c3.connected && c3.roomId);
|
|
4120
|
-
if (!room?.roomId) {
|
|
4120
|
+
if (!spec.command && !room?.roomId) {
|
|
4121
4121
|
this.deps.log(`task ${spec.taskId} fired but no active owner room \u2014 skipping DM (accept the contact in chat)`);
|
|
4122
4122
|
return;
|
|
4123
4123
|
}
|
|
@@ -4141,7 +4141,7 @@ var CronRunner = class {
|
|
|
4141
4141
|
} catch (err) {
|
|
4142
4142
|
this.deps.log(`troop startRun ${spec.taskId} error: ${err instanceof Error ? err.message : String(err)}`);
|
|
4143
4143
|
}
|
|
4144
|
-
this.pending.set(sessionId, { taskId: spec.taskId, taskName: spec.name, accumulated: "", roomId: room
|
|
4144
|
+
this.pending.set(sessionId, { taskId: spec.taskId, taskName: spec.name, accumulated: "", roomId: room?.roomId ?? void 0, status: "pending", runId });
|
|
4145
4145
|
this.deps.log(`task ${spec.taskId} fired (session=${sessionId}, run=${runId ?? "no-troop"})`);
|
|
4146
4146
|
void this.runTask(sessionId, systemPrompt, spec);
|
|
4147
4147
|
}
|
|
@@ -4220,6 +4220,11 @@ ${(res.stdout || res.stderr).slice(0, 4e3)}`;
|
|
|
4220
4220
|
}
|
|
4221
4221
|
}
|
|
4222
4222
|
async postResult(sid, turn) {
|
|
4223
|
+
if (!turn.roomId) {
|
|
4224
|
+
this.deps.log(`task ${turn.taskId} ran headless (no owner room) \u2014 DM skipped`);
|
|
4225
|
+
return;
|
|
4226
|
+
}
|
|
4227
|
+
const roomId = turn.roomId;
|
|
4223
4228
|
const prefix = turn.status === "error" ? "\u274C" : "\u2705";
|
|
4224
4229
|
const text = turn.accumulated.trim() || (turn.status === "error" ? "(crashed)" : "(no output)");
|
|
4225
4230
|
const body = `${prefix} *${turn.taskName}*
|
|
@@ -4228,7 +4233,7 @@ ${text}`.slice(0, 9e3);
|
|
|
4228
4233
|
let threadId = this.taskThreads.get(turn.taskId);
|
|
4229
4234
|
if (!threadId) {
|
|
4230
4235
|
try {
|
|
4231
|
-
const created = await this.deps.chat.createThread(
|
|
4236
|
+
const created = await this.deps.chat.createThread(roomId, turn.taskName || turn.taskId);
|
|
4232
4237
|
threadId = created.id;
|
|
4233
4238
|
this.taskThreads.set(turn.taskId, threadId);
|
|
4234
4239
|
this.persistTaskThreads();
|
|
@@ -4238,7 +4243,7 @@ ${text}`.slice(0, 9e3);
|
|
|
4238
4243
|
}
|
|
4239
4244
|
}
|
|
4240
4245
|
try {
|
|
4241
|
-
const posted = await this.deps.chat.postMessage(
|
|
4246
|
+
const posted = await this.deps.chat.postMessage(roomId, body, threadId ? { threadId } : {});
|
|
4242
4247
|
this.deps.log(`task DM posted (session=${sid}, ${turn.accumulated.length} chars, thread=${posted.threadId})`);
|
|
4243
4248
|
} catch (err) {
|
|
4244
4249
|
this.deps.log(`task DM post failed (session=${sid}): ${err instanceof Error ? err.message : String(err)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openape/ape-agent",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "OpenApe agent runtime: per-agent process that connects to chat.openape.ai, runs the LLM loop with tools + cron tasks, and streams replies back to owners.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"ofetch": "^1.4.1",
|
|
24
24
|
"ws": "^8.18.0",
|
|
25
25
|
"yaml": "^2.8.0",
|
|
26
|
-
"@openape/apes": "1.28.
|
|
26
|
+
"@openape/apes": "1.28.2",
|
|
27
27
|
"@openape/cli-auth": "0.4.1",
|
|
28
28
|
"@openape/prompt-injection-detector": "0.1.0"
|
|
29
29
|
},
|