palmier 0.9.30 → 0.9.32

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Daemon-owned supervisors for command-triggered tasks. A command task's shell
2
+ * Daemon-owned supervisors for command-output tasks. A command task's shell
3
3
  * command is a long-running trigger source — the daemon spawns it while the task
4
4
  * is enabled, reads its stdout, and feeds each line into the shared per-task
5
5
  * event queue (the same one the NATS notification/SMS subscriptions populate).
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Daemon-owned supervisors for command-triggered tasks. A command task's shell
2
+ * Daemon-owned supervisors for command-output tasks. A command task's shell
3
3
  * command is a long-running trigger source — the daemon spawns it while the task
4
4
  * is enabled, reads its stdout, and feeds each line into the shared per-task
5
5
  * event queue (the same one the NATS notification/SMS subscriptions populate).
@@ -212,7 +212,7 @@ export async function runCommand(taskId) {
212
212
  agent, task, taskDir, runId, guiEnv, nc, config, taskId,
213
213
  transientPermissions: [],
214
214
  };
215
- // Command-triggered and on_new_* tasks share the same trigger machinery: the
215
+ // Command-output and on_new_* tasks share the same trigger machinery: the
216
216
  // daemon owns the trigger source (the shell command's stdout / a NATS
217
217
  // subscription) and feeds the shared per-task queue, while this run drains
218
218
  // that queue one invocation at a time.
@@ -270,8 +270,6 @@ async function runEventTriggeredMode(ctx) {
270
270
  const port = ctx.config.httpPort ?? 7256;
271
271
  const popUrl = `http://localhost:${port}/task-event/pop?taskId=${encodeURIComponent(ctx.taskId)}`;
272
272
  console.log(`[triggered] Draining ${label} queue`);
273
- appendRunMessage(ctx.taskDir, ctx.runId, { role: "status", time: Date.now(), content: "", type: "monitoring" });
274
- await publishHostEvent(ctx.nc, ctx.config.hostId, ctx.taskId, { event_type: "result-updated", run_id: ctx.runId });
275
273
  let eventsProcessed = 0;
276
274
  let lastOutcome = "finished";
277
275
  try {
@@ -285,6 +283,9 @@ async function runEventTriggeredMode(ctx) {
285
283
  break;
286
284
  eventsProcessed++;
287
285
  console.log(`[triggered] Processing ${label} #${eventsProcessed}`);
286
+ // Show the triggering input on the user's side before the agent responds,
287
+ // mirroring the regular task view (prompt, then agent output).
288
+ await appendAndNotify(ctx, { role: "user", time: Date.now(), content: body.event });
288
289
  const perEventPrompt = isCommand
289
290
  ? `${ctx.task.frontmatter.user_prompt}\n\nProcess this input:\n${body.event}`
290
291
  : `${ctx.task.frontmatter.user_prompt}\n\nProcess this new ${label}:\n${body.event}`;
@@ -293,8 +294,6 @@ async function runEventTriggeredMode(ctx) {
293
294
  };
294
295
  const result = await invokeAgentWithRetries(ctx, perEventTask);
295
296
  lastOutcome = result.outcome;
296
- appendRunMessage(ctx.taskDir, ctx.runId, { role: "status", time: Date.now(), content: "", type: "monitoring" });
297
- await publishHostEvent(ctx.nc, ctx.config.hostId, ctx.taskId, { event_type: "result-updated", run_id: ctx.runId });
298
297
  }
299
298
  }
300
299
  catch (err) {
@@ -16,6 +16,7 @@ import { addNotification } from "../notification-store.js";
16
16
  import { addSmsMessage } from "../sms-store.js";
17
17
  import { dispatchTrigger } from "../trigger-dispatch.js";
18
18
  import { startEnabledCommandRunners } from "../command-runners.js";
19
+ import { currentVersion } from "../update-checker.js";
19
20
  const POLL_INTERVAL_MS = 30_000;
20
21
  const DAEMON_PID_FILE = path.join(CONFIG_DIR, "daemon.pid");
21
22
  /**
@@ -98,7 +99,7 @@ export async function serveCommand() {
98
99
  const config = loadConfig();
99
100
  // PID file lets `palmier restart` find us regardless of how we were started
100
101
  fs.writeFileSync(DAEMON_PID_FILE, String(process.pid), "utf-8");
101
- console.log("Starting...");
102
+ console.log(`Starting Palmier daemon v${currentVersion}...`);
102
103
  const agents = await detectAgents(config.agents);
103
104
  config.agents = agents;
104
105
  saveConfig(config);
@@ -20,7 +20,6 @@ export declare function popEvent(taskId: string): {
20
20
  empty: true;
21
21
  };
22
22
  export declare function hasPendingEvents(taskId: string): boolean;
23
- export declare function pendingCount(taskId: string): number;
24
23
  /** Drop a stranded active flag so a fresh run can be launched (watchdog only). */
25
24
  export declare function resetActiveRun(taskId: string): void;
26
25
  /** Re-acquire the active flag without enqueuing (watchdog relaunch only). */
@@ -37,9 +37,6 @@ export function hasPendingEvents(taskId) {
37
37
  const queue = queues.get(taskId);
38
38
  return !!queue && queue.length > 0;
39
39
  }
40
- export function pendingCount(taskId) {
41
- return queues.get(taskId)?.length ?? 0;
42
- }
43
40
  /** Drop a stranded active flag so a fresh run can be launched (watchdog only). */
44
41
  export function resetActiveRun(taskId) {
45
42
  activeRuns.delete(taskId);