@rubytech/taskmaster 1.17.7 → 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.
@@ -155,6 +155,30 @@ export function createChannelSettingsTool() {
155
155
  });
156
156
  return jsonResult({ ok: true, accountId, groupPolicy, result });
157
157
  }
158
+ if (action === "set_mention_required") {
159
+ if (typeof params.mentionRequired !== "boolean") {
160
+ throw new Error("mentionRequired (boolean) is required for set_mention_required");
161
+ }
162
+ const mentionRequired = params.mentionRequired;
163
+ const snapshot = await callGatewayTool("config.get", gatewayOpts, {});
164
+ const baseHash = typeof snapshot?.hash === "string" ? snapshot.hash : undefined;
165
+ const result = await callGatewayTool("config.patch", gatewayOpts, {
166
+ raw: JSON.stringify({
167
+ channels: {
168
+ whatsapp: {
169
+ accounts: { [accountId]: { groups: { mentionRequired } } },
170
+ },
171
+ },
172
+ }),
173
+ baseHash,
174
+ note: `agent: set mentionRequired to ${mentionRequired} for account ${accountId}`,
175
+ });
176
+ return jsonResult({ ok: true, accountId, mentionRequired, result });
177
+ }
178
+ if (action === "logout") {
179
+ const result = await callGatewayTool("channels.logout", gatewayOpts, { accountId });
180
+ return jsonResult({ ok: true, accountId, result });
181
+ }
158
182
  throw new Error(`Unknown action: ${action}`);
159
183
  },
160
184
  };
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.17.7",
3
- "commit": "5816363bb6d544f98555ba995bf5bda72f5c7a17",
4
- "builtAt": "2026-03-05T15:37:55.754Z"
2
+ "version": "1.17.9",
3
+ "commit": "2aec1cdf9bf18ed0f6adc56347ba5e2a746b5f8f",
4
+ "builtAt": "2026-03-05T16:01:48.216Z"
5
5
  }
@@ -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
- state.deps.enqueueSystemEvent(`${statusPrefix}: ${body}`, {
124
- agentId: job.agentId,
125
- });
126
- if (job.wakeMode === "now") {
127
- state.deps.requestHeartbeatNow({ reason: `cron:${job.id}:post` });
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({
@@ -85,5 +85,11 @@ export function globalInstallArgs(manager, spec, needsSudo = false) {
85
85
  return [...prefix, "pnpm", "add", "-g", spec];
86
86
  if (manager === "bun")
87
87
  return [...prefix, "bun", "add", "-g", spec];
88
- return [...prefix, "npm", "i", "-g", spec];
88
+ // When running as sudo, npm reads /root/.npmrc as the user config. If that file
89
+ // contains an expired auth token, npm sends it with the request and the registry
90
+ // returns 404 even for public packages. Passing --userconfig /dev/null skips the
91
+ // user-level config so the install runs unauthenticated, which always works for
92
+ // public packages on the npm registry.
93
+ const npmUserconfig = needsSudo ? ["--userconfig", "/dev/null"] : [];
94
+ return [...prefix, "npm", "i", "-g", spec, ...npmUserconfig];
89
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/taskmaster",
3
- "version": "1.17.7",
3
+ "version": "1.17.9",
4
4
  "description": "AI-powered business assistant for small businesses",
5
5
  "publishConfig": {
6
6
  "access": "public"