open-coleslaw 0.6.7 → 0.6.8

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/index.js CHANGED
@@ -503,6 +503,25 @@ function getMinutesByMeeting(meetingId) {
503
503
  const row = db.prepare("SELECT * FROM minutes WHERE meeting_id = ?").get(meetingId);
504
504
  return row ? rowToMinutes(row) : null;
505
505
  }
506
+ function updateMinutes(meetingId, updates) {
507
+ const db = getDb();
508
+ const existing = getMinutesByMeeting(meetingId);
509
+ if (!existing) return null;
510
+ const fields = [];
511
+ const values = [];
512
+ if (updates.content !== void 0) {
513
+ fields.push("content = ?");
514
+ values.push(updates.content);
515
+ }
516
+ if (updates.actionItems !== void 0) {
517
+ fields.push("action_items = ?");
518
+ values.push(JSON.stringify(updates.actionItems));
519
+ }
520
+ if (fields.length === 0) return existing;
521
+ values.push(meetingId);
522
+ db.prepare(`UPDATE minutes SET ${fields.join(", ")} WHERE meeting_id = ?`).run(...values);
523
+ return getMinutesByMeeting(meetingId);
524
+ }
506
525
 
507
526
  // src/storage/task-store.ts
508
527
  function getTasksFromMinutes(meetingId) {
@@ -2749,6 +2768,44 @@ var MeetingRunner = class {
2749
2768
  if (!meeting) {
2750
2769
  throw new Error(`Meeting not found: ${this.meetingId}`);
2751
2770
  }
2771
+ const existing = getMinutesByMeeting(this.meetingId);
2772
+ if (existing) {
2773
+ const newEntries = getTranscript(this.meetingId).filter(
2774
+ (e) => e.createdAt > existing.createdAt
2775
+ );
2776
+ if (newEntries.length === 0) {
2777
+ logger.info("generateMinutes: no new transcripts since last minutes; returning existing", {
2778
+ meetingId: this.meetingId
2779
+ });
2780
+ return existing.id;
2781
+ }
2782
+ const appended = [];
2783
+ appended.push(existing.content.replace(/\s+$/, ""));
2784
+ appended.push("");
2785
+ appended.push(
2786
+ `## Follow-up Discussion \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}`
2787
+ );
2788
+ appended.push("");
2789
+ for (const e of newEntries) {
2790
+ const stanceNote = e.agendaItemIndex === -3 ? "_(user comment)_" : e.agendaItemIndex === -2 ? "_(synthesis)_" : "";
2791
+ appended.push(
2792
+ `**${e.speakerRole}** (round ${e.roundNumber}) ${stanceNote}:`
2793
+ );
2794
+ appended.push(e.content);
2795
+ appended.push("");
2796
+ }
2797
+ const newContent = appended.join("\n");
2798
+ updateMinutes(this.meetingId, { content: newContent });
2799
+ updateMeeting(this.meetingId, {
2800
+ status: "completed",
2801
+ completedAt: Date.now()
2802
+ });
2803
+ logger.info("Minutes appended with follow-up discussion", {
2804
+ meetingId: this.meetingId,
2805
+ newEntries: newEntries.length
2806
+ });
2807
+ return existing.id;
2808
+ }
2752
2809
  updateMeeting(this.meetingId, {
2753
2810
  phase: "minutes-generation",
2754
2811
  status: "minutes-generation"