@rubytech/taskmaster 1.17.8 → 1.17.9
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/build-info.json
CHANGED
|
@@ -120,11 +120,29 @@ export async function executeJob(state, job, nowMs, opts) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
const statusPrefix = status === "ok" ? prefix : `${prefix} (${status})`;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
state.deps.
|
|
123
|
+
// When delivery was skipped (no external channel), inject the report directly
|
|
124
|
+
// into the admin's main session transcript and broadcast a live "chat" event
|
|
125
|
+
// so it appears immediately in web chat without requiring a heartbeat cycle.
|
|
126
|
+
if (status === "skipped" && state.deps.injectToMainSession) {
|
|
127
|
+
const injected = await state.deps.injectToMainSession({
|
|
128
|
+
agentId: job.agentId ?? "",
|
|
129
|
+
message: body,
|
|
130
|
+
label: statusPrefix,
|
|
131
|
+
});
|
|
132
|
+
if (!injected) {
|
|
133
|
+
// Session doesn't exist yet — fall back to system event.
|
|
134
|
+
state.deps.enqueueSystemEvent(`${statusPrefix}: ${body}`, {
|
|
135
|
+
agentId: job.agentId,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
state.deps.enqueueSystemEvent(`${statusPrefix}: ${body}`, {
|
|
141
|
+
agentId: job.agentId,
|
|
142
|
+
});
|
|
143
|
+
if (job.wakeMode === "now") {
|
|
144
|
+
state.deps.requestHeartbeatNow({ reason: `cron:${job.id}:post` });
|
|
145
|
+
}
|
|
128
146
|
}
|
|
129
147
|
}
|
|
130
148
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { appendFileSync, existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
1
4
|
import { resolveDefaultAgentId } from "../agents/agent-scope.js";
|
|
2
5
|
import { loadConfig } from "../config/config.js";
|
|
3
6
|
import { resolveAgentMainSessionKey } from "../config/sessions.js";
|
|
@@ -11,6 +14,7 @@ import { enqueueSystemEvent } from "../infra/system-events.js";
|
|
|
11
14
|
import { getChildLogger } from "../logging.js";
|
|
12
15
|
import { normalizeAgentId } from "../routing/session-key.js";
|
|
13
16
|
import { defaultRuntime } from "../runtime.js";
|
|
17
|
+
import { loadSessionEntry } from "./session-utils.js";
|
|
14
18
|
export function buildGatewayCronService(params) {
|
|
15
19
|
const cronLogger = getChildLogger({ module: "cron" });
|
|
16
20
|
const storePath = resolveCronStorePath(params.cfg.cron?.store);
|
|
@@ -44,6 +48,49 @@ export function buildGatewayCronService(params) {
|
|
|
44
48
|
deps: { ...params.deps, runtime: defaultRuntime },
|
|
45
49
|
});
|
|
46
50
|
},
|
|
51
|
+
injectToMainSession: async ({ agentId: reqAgentId, message, label }) => {
|
|
52
|
+
try {
|
|
53
|
+
const { agentId, cfg: runtimeConfig } = resolveCronAgent(reqAgentId);
|
|
54
|
+
const sessionKey = resolveAgentMainSessionKey({ cfg: runtimeConfig, agentId });
|
|
55
|
+
const { storePath: sPath, entry } = loadSessionEntry(sessionKey);
|
|
56
|
+
const sessionId = entry?.sessionId;
|
|
57
|
+
if (!sessionId || !sPath)
|
|
58
|
+
return false;
|
|
59
|
+
const transcriptPath = entry?.sessionFile
|
|
60
|
+
? entry.sessionFile
|
|
61
|
+
: path.join(path.dirname(sPath), `${sessionId}.jsonl`);
|
|
62
|
+
if (!existsSync(transcriptPath))
|
|
63
|
+
return false;
|
|
64
|
+
const now = Date.now();
|
|
65
|
+
const messageId = randomUUID().slice(0, 8);
|
|
66
|
+
const labelPrefix = label ? `[${label}]\n\n` : "";
|
|
67
|
+
const messageBody = {
|
|
68
|
+
role: "assistant",
|
|
69
|
+
content: [{ type: "text", text: `${labelPrefix}${message}` }],
|
|
70
|
+
timestamp: now,
|
|
71
|
+
stopReason: "injected",
|
|
72
|
+
usage: { input: 0, output: 0, totalTokens: 0 },
|
|
73
|
+
};
|
|
74
|
+
const transcriptEntry = {
|
|
75
|
+
type: "message",
|
|
76
|
+
id: messageId,
|
|
77
|
+
timestamp: new Date(now).toISOString(),
|
|
78
|
+
message: messageBody,
|
|
79
|
+
};
|
|
80
|
+
appendFileSync(transcriptPath, `${JSON.stringify(transcriptEntry)}\n`, "utf-8");
|
|
81
|
+
params.broadcast("chat", {
|
|
82
|
+
runId: `inject-${messageId}`,
|
|
83
|
+
sessionKey,
|
|
84
|
+
seq: 0,
|
|
85
|
+
state: "final",
|
|
86
|
+
message: messageBody,
|
|
87
|
+
});
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
47
94
|
runIsolatedAgentJob: async ({ job, message }) => {
|
|
48
95
|
const { agentId, cfg: runtimeConfig } = resolveCronAgent(job.agentId);
|
|
49
96
|
return await runCronIsolatedAgentTurn({
|