@mclean-capital/neura 3.5.1 → 3.5.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.
@@ -76114,7 +76114,7 @@ var taskToolDefs = [
76114
76114
  {
76115
76115
  type: "function",
76116
76116
  name: "create_task",
76117
- description: "Create a new task. Use when the user asks you to do something actionable (file operations, research, code changes, reminders). Orchestrator uses create_task to brief a worker BEFORE dispatching \u2014 pair with dispatch_worker when the user confirms. Include `goal` whenever possible (what success looks like).",
76117
+ description: "Create a new task. Use when the user asks you to do something actionable (file operations, research, code changes, reminders). Orchestrator uses create_task to brief a worker BEFORE dispatching \u2014 pair with dispatch_worker when the user confirms. Include `goal` whenever possible (what success looks like). The returned `id` is an internal handle for subsequent tool calls \u2014 NEVER speak it aloud; refer to the task by its title when talking to the user.",
76118
76118
  parameters: {
76119
76119
  type: "object",
76120
76120
  properties: {
@@ -76264,7 +76264,7 @@ var taskToolDefs = [
76264
76264
  {
76265
76265
  type: "function",
76266
76266
  name: "dispatch_worker",
76267
- description: "Dispatch a worker to execute an existing task. The task must already have a clear goal + context \u2014 call create_task first, confirm with the user for non-trivial / destructive work, then dispatch. Returns a worker_id immediately; progress flows via comments on the task.",
76267
+ description: "Dispatch a worker to execute an existing task. The task must already have a clear goal + context \u2014 call create_task first, confirm with the user for non-trivial / destructive work, then dispatch. Progress flows via comments on the task (see get_task). When confirming to the user, speak naturally about the task ('Dispatching the worker now') \u2014 do NOT quote task IDs or worker IDs aloud, the TTS reads UUIDs letter by letter and it's jarring.",
76268
76268
  parameters: {
76269
76269
  type: "object",
76270
76270
  properties: {
@@ -76335,7 +76335,16 @@ async function handleTaskTool(name, args, ctx) {
76335
76335
  const query = args.query;
76336
76336
  const task = await ctx.taskTools.getTask(query);
76337
76337
  if (!task) return { result: { found: false } };
76338
- return { result: { found: true, task } };
76338
+ let comments = [];
76339
+ try {
76340
+ comments = await ctx.taskTools.listTaskComments(task.id, { limit: 50 });
76341
+ } catch (err) {
76342
+ log15.warn("failed to load task comments for get_task", {
76343
+ taskId: task.id,
76344
+ err: String(err)
76345
+ });
76346
+ }
76347
+ return { result: { found: true, task, comments } };
76339
76348
  }
76340
76349
  case "update_task": {
76341
76350
  if (!ctx.taskTools) return { error: "Task system not available" };
@@ -76396,7 +76405,6 @@ async function handleTaskTool(name, args, ctx) {
76396
76405
  return {
76397
76406
  result: {
76398
76407
  dispatched: true,
76399
- workerId: outcome.workerId,
76400
76408
  message: `Worker dispatched. You'll hear progress updates as it works.`
76401
76409
  }
76402
76410
  };
@@ -77385,6 +77393,30 @@ async function insertComment(db, opts) {
77385
77393
  );
77386
77394
  return mapTaskComment(result.rows[0]);
77387
77395
  }
77396
+ async function listComments(db, opts) {
77397
+ const limit2 = opts.limit ?? 500;
77398
+ const filters = ["task_id = $1"];
77399
+ const values = [opts.taskId];
77400
+ let idx = 2;
77401
+ if (opts.type !== void 0) {
77402
+ const types3 = Array.isArray(opts.type) ? opts.type : [opts.type];
77403
+ const placeholders = types3.map(() => `$${idx++}`).join(", ");
77404
+ filters.push(`type IN (${placeholders})`);
77405
+ values.push(...types3);
77406
+ }
77407
+ if (opts.since) {
77408
+ filters.push(`created_at > $${idx++}`);
77409
+ values.push(opts.since);
77410
+ }
77411
+ const result = await db.query(
77412
+ `SELECT * FROM task_comments
77413
+ WHERE ${filters.join(" AND ")}
77414
+ ORDER BY created_at ASC
77415
+ LIMIT $${idx}`,
77416
+ [...values, limit2]
77417
+ );
77418
+ return result.rows.map((r2) => mapTaskComment(r2));
77419
+ }
77388
77420
  async function countOpenRequests(db, taskId) {
77389
77421
  const result = await db.query(
77390
77422
  `SELECT COUNT(*)::TEXT as count FROM task_comments
@@ -79314,6 +79346,9 @@ async function initServices() {
79314
79346
  return candidates.slice(0, limit2);
79315
79347
  },
79316
79348
  getTask: (idOrTitle) => store.getWorkItem(idOrTitle),
79349
+ listTaskComments: async (taskId, options) => {
79350
+ return listComments(rawDb, { taskId, limit: options?.limit });
79351
+ },
79317
79352
  updateTask: async (idOrTitle, payload) => {
79318
79353
  const current = await store.getWorkItem(idOrTitle);
79319
79354
  if (!current) return null;
@@ -99023,6 +99058,11 @@ function attachWebSocket(httpServer2, services2) {
99023
99058
  return candidates.slice(0, limit2);
99024
99059
  },
99025
99060
  getTask: (idOrTitle) => resolveTask(store, idOrTitle),
99061
+ listTaskComments: async (taskId, options) => {
99062
+ const db = store.getRawDb?.();
99063
+ if (!db) throw new Error("store does not expose a raw PGlite handle");
99064
+ return listComments(db, { taskId, limit: options?.limit });
99065
+ },
99026
99066
  updateTask: async (idOrTitle, payload) => {
99027
99067
  const current = await resolveTask(store, idOrTitle);
99028
99068
  if (!current) return null;