hilos-agent 0.1.11 → 0.1.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/handler.mjs +33 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hilos-agent",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Run your own coding agent (Claude Code / Codex / Cursor) as an autonomous teammate in a hilos channel. Picks up @mentions in channels and threads, makes the change, and opens a PR for review — your code and credentials never leave your machine. (Approve-before-push is available via gate:true.)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/handler.mjs CHANGED
@@ -280,20 +280,38 @@ async function fetchContext({ channelId, tool, parentId }) {
280
280
  return { rows, transcript: rows.map((m) => `${m.author}: ${m.body}`).join("\n").slice(-6000) };
281
281
  }
282
282
 
283
+ /**
284
+ * Prompt for the fast "here's my plan" ack. Carries the distilled task AND the
285
+ * conversation as background, so the ack is specific ("On it — I'll add X…")
286
+ * instead of asking for context it was already handed. (The old bug: fed only the
287
+ * bare mention, it replied "can't see the channel message yet.")
288
+ * @param {{ task?: string, transcript?: string, repoFullName?: string }} [o]
289
+ */
290
+ export function planAckPrompt(o) {
291
+ const { task, transcript, repoFullName } = o || {};
292
+ const where = repoFullName ? ` in the repo ${repoFullName}` : "";
293
+ let p =
294
+ `A teammate asked you to do this${where}:\n"${(task || "").trim()}"\n\n` +
295
+ `Reply with ONE or TWO short sentences, first person: acknowledge, state your ` +
296
+ `plan, and say you'll open a PR and report back. No preamble, no lists, no code. ` +
297
+ `Tone: "On it — I'll add X by doing Y. I'll open a PR and report back."`;
298
+ const t = (transcript || "").trim();
299
+ if (t) {
300
+ p += `\n\nConversation so far (background — resolve references like "this" against it):\n${t}`;
301
+ }
302
+ return p;
303
+ }
304
+
283
305
  /**
284
306
  * A 1–2 sentence "here's my plan" line for the instant ack, via the FAST chat
285
307
  * CLI. Bounded (≤45s) + best-effort: returns trimmed text, or null on
286
308
  * empty/timeout/error so the run keeps the instant template and never stalls.
287
309
  */
288
- async function proposePlanAck({ task, repoFullName, cfg, signal }) {
310
+ async function proposePlanAck({ task, transcript, repoFullName, cfg, signal }) {
289
311
  const cmd = cfg.chatCmd;
290
312
  if (!cmd) return null;
291
313
  const parts = cmd.split(" ").filter(Boolean);
292
- const prompt =
293
- `A teammate asked you to do this in the repo ${repoFullName}:\n"${task}"\n\n` +
294
- `Reply with ONE or TWO short sentences, first person: acknowledge, state your ` +
295
- `plan, and say you'll open a PR and report back. No preamble, no lists, no code. ` +
296
- `Tone: "On it — I'll add X by doing Y. I'll open a PR and report back."`;
314
+ const prompt = planAckPrompt({ task, transcript, repoFullName });
297
315
  const run = await runCli({
298
316
  cmd: parts[0],
299
317
  args: [...parts.slice(1), prompt],
@@ -518,7 +536,15 @@ export async function handleTask({ message, channelId, tool, me, caps = {} }, cf
518
536
  const ack = await tool("post_message", { channelId, parentId, body: ackText(repoFullName) });
519
537
  const ackId = ack?.messageId ?? null;
520
538
  if (ackId && caps.editMessage && cfg.chatCmd) {
521
- const plan = await proposePlanAck({ task: message.body, repoFullName, cfg, signal }).catch(() => null);
539
+ // Feed the ack the router's distilled brief AND the conversation not the raw
540
+ // mention — so it states a real plan instead of "what's the task?".
541
+ const plan = await proposePlanAck({
542
+ task: routed.task || message.body,
543
+ transcript: context.transcript,
544
+ repoFullName,
545
+ cfg,
546
+ signal,
547
+ }).catch(() => null);
522
548
  if (plan && !signal?.aborted) await tool("edit_message", { messageId: ackId, body: plan }).catch(() => {});
523
549
  }
524
550