Skip to content

Commit e66e968

Browse files
committed
Rename note content field
1 parent f0cda95 commit e66e968

8 files changed

Lines changed: 46 additions & 39 deletions

File tree

.changeset/three-tables-vanish.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@plotday/tool-gmail": minor
3+
"@plotday/tool-google-calendar": minor
4+
"@plotday/tool-google-contacts": minor
5+
"@plotday/tool-outlook-calendar": minor
6+
"@plotday/tool-slack": minor
7+
"@plotday/twister": minor
8+
---
9+
10+
Changed: BREAKING: Note content field renamed for clarity

tools/gmail/src/gmail-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ export function transformGmailThread(thread: GmailThread): ActivityWithNotes {
453453
id: `gmail:${thread.id}:${message.id}` as any,
454454
activity: activity,
455455
author: emailAddressToActor(sender),
456-
note: body || message.snippet,
456+
content: body || message.snippet,
457457
links: null,
458458
mentions: mentions.length > 0 ? mentions : null,
459459
tags: null,

tools/google-calendar/src/google-calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ export class GoogleCalendar
524524
if (hasDescription || hasLinks) {
525525
notes.push({
526526
activity: { id: "" }, // Will be filled in by the API
527-
note: hasDescription ? description : null,
527+
content: hasDescription ? description : null,
528528
links: hasLinks ? links : null,
529529
noteType: "text",
530530
});
@@ -620,7 +620,7 @@ export class GoogleCalendar
620620
if (hasDescription || hasLinks) {
621621
notes.push({
622622
activity: { id: "" }, // Will be filled in by the API
623-
note: hasDescription ? description : null,
623+
content: hasDescription ? description : null,
624624
links: hasLinks ? links : null,
625625
noteType: "text",
626626
});

tools/slack/src/slack-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export function transformSlackThread(
319319
id: `slack:${channelId}:${message.ts}` as any,
320320
activity: activity,
321321
author: slackUserToActor(userId),
322-
note: text,
322+
content: text,
323323
links: null,
324324
mentions: mentions.length > 0 ? mentions : null,
325325
tags: null,

twister/src/plot.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export type ActivityMeta = {
203203
* const task: Activity = {
204204
* type: ActivityType.Note,
205205
* title: "New campaign brainstorming ideas",
206-
* note: "We could rent a bouncy castle...",
206+
* content: "We could rent a bouncy castle...",
207207
* author: { id: "user-1", name: "John Doe", type: ActorType.User },
208208
* priority: { id: "work", title: "Work" },
209209
* // ... other fields
@@ -406,7 +406,7 @@ export type PickPriorityConfig = {
406406
* const newNote: NewActivity = {
407407
* type: ActivityType.Note,
408408
* title: "Meeting notes",
409-
* note: "Discussed Q4 roadmap..."
409+
* content: "Discussed Q4 roadmap..."
410410
* // Defaults to pickPriority: { content: true }
411411
* };
412412
*
@@ -478,7 +478,7 @@ export type Note = Omit<ActivityCommon, "type"> & {
478478
/** The parent activity this note belongs to */
479479
activity: Activity;
480480
/** Primary content for the note (markdown) */
481-
note: string | null;
481+
content: string | null;
482482
/** Array of interactive links attached to the note */
483483
links: Array<ActivityLink> | null;
484484
};
@@ -505,7 +505,7 @@ export type NewNote = Partial<Omit<Note, "id" | "author" | "activity">> & {
505505
* Type for updating existing notes.
506506
*/
507507
export type NoteUpdate = Pick<Note, "id"> &
508-
Partial<Pick<Note, "draft" | "private" | "note" | "links" | "mentions">> & {
508+
Partial<Pick<Note, "draft" | "private" | "content" | "links" | "mentions">> & {
509509
/**
510510
* Format of the note content. Determines how the note is processed:
511511
* - 'text': Plain text that will be converted to markdown (auto-links URLs, preserves line breaks)

twists/calendar-sync/src/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
106106
end: null,
107107
notes: [
108108
{
109-
note: "Connect a calendar account to get started. You can connect as many as you like.",
109+
content: "Connect a calendar account to get started. You can connect as many as you like.",
110110
links: [googleAuthLink, outlookAuthLink],
111111
},
112112
],
@@ -197,7 +197,7 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
197197
activity.meta = {
198198
...activity.meta,
199199
// Add a hash so we can add a new note if it changes
200-
descriptionHash: quickHash(activity.notes[0]?.note ?? ""),
200+
descriptionHash: quickHash(activity.notes[0]?.content ?? ""),
201201
};
202202
}
203203

@@ -314,12 +314,12 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
314314
// Check for description changes
315315
if (
316316
existing.meta &&
317-
existing.meta.descriptionHash !== quickHash(incoming.notes[0]?.note ?? "")
317+
existing.meta.descriptionHash !== quickHash(incoming.notes[0]?.content ?? "")
318318
) {
319-
updatedDescription = incoming.notes[0]?.note ?? undefined;
319+
updatedDescription = incoming.notes[0]?.content ?? undefined;
320320
updates.meta = {
321321
...(incoming.meta ?? existing.meta),
322-
descriptionHash: quickHash(incoming.notes[0]?.note ?? ""),
322+
descriptionHash: quickHash(incoming.notes[0]?.content ?? ""),
323323
};
324324
hasChanges = true;
325325
}
@@ -339,7 +339,7 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
339339
// Add a new note with the updated description
340340
await this.tools.plot.createNote({
341341
activity: { id: existing.id },
342-
note: `*Calendar description updated*: ${updatedDescription}`,
342+
content: `*Calendar description updated*: ${updatedDescription}`,
343343
});
344344
}
345345
}
@@ -378,7 +378,7 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
378378
if (activity) {
379379
await this.tools.plot.createNote({
380380
activity,
381-
note: `I couldn't find any calendars for that account.`,
381+
content: `I couldn't find any calendars for that account.`,
382382
});
383383
} else {
384384
console.warn("No parent activity found for no calendars note");
@@ -437,7 +437,7 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
437437
start: new Date(),
438438
notes: [
439439
{
440-
note: `Which ${providerName} calendars you'd like to sync?`,
440+
content: `Which ${providerName} calendars you'd like to sync?`,
441441
links,
442442
},
443443
],
@@ -478,7 +478,7 @@ export default class CalendarSyncTwist extends Twist<CalendarSyncTwist> {
478478
}
479479
await this.tools.plot.createNote({
480480
activity,
481-
note: `Reading your ${calendarName} calendar.`,
481+
content: `Reading your ${calendarName} calendar.`,
482482
});
483483
} catch (error) {
484484
console.error(

twists/chat/src/index.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Type } from "typebox";
22

33
import {
4-
type Activity,
54
ActivityType,
6-
Twist,
75
ActorType,
6+
type Note,
87
Tag,
98
type ToolBuilder,
10-
type Note,
9+
Twist,
1110
} from "@plotday/twister";
1211
import { AI, type AIMessage } from "@plotday/twister/tools/ai";
1312
import { ActivityAccess, Plot } from "@plotday/twister/tools/plot";
@@ -29,15 +28,15 @@ export default class ChatTwist extends Twist<ChatTwist> {
2928
"Can you help me plan my day?",
3029
"Write me a summary of this article",
3130
],
32-
handler: this.responsd,
31+
handler: this.respond,
3332
},
3433
],
3534
},
3635
}),
3736
};
3837
}
3938

40-
async responsd(note: Note) {
39+
async respond(note: Note) {
4140
const activity = note.activity;
4241

4342
// Get all notes in this activity (conversation history)
@@ -69,15 +68,13 @@ You can also create tasks, but should only do so when the user explicitly asks y
6968
: []),
7069
// Include all previous notes in the conversation
7170
...previousNotes
72-
.filter((n: Note) => n.note)
71+
.filter((n: Note) => n.content)
7372
.map(
7473
(prevNote: Note) =>
7574
({
7675
role:
77-
prevNote.author.type === ActorType.Twist
78-
? "assistant"
79-
: "user",
80-
content: prevNote.note!,
76+
prevNote.author.type === ActorType.Twist ? "assistant" : "user",
77+
content: prevNote.content!,
8178
} satisfies AIMessage)
8279
),
8380
];
@@ -128,7 +125,7 @@ You can also create tasks, but should only do so when the user explicitly asks y
128125
title: response.output!.message.title,
129126
notes: [
130127
{
131-
note: response.output!.message.note,
128+
content: response.output!.message.note,
132129
},
133130
],
134131
priority: activity.priority,
@@ -140,7 +137,7 @@ You can also create tasks, but should only do so when the user explicitly asks y
140137
notes: item.note
141138
? [
142139
{
143-
note: item.note,
140+
content: item.note,
144141
},
145142
]
146143
: undefined,

twists/message-tasks/src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export default class MessageTasksTwist extends Twist<MessageTasksTwist> {
171171
start: new Date(),
172172
notes: [
173173
{
174-
note: "I'll analyze your message threads and create tasks when action is needed.",
174+
content: "I'll analyze your message threads and create tasks when action is needed.",
175175
links: [slackAuthLink],
176176
},
177177
],
@@ -207,7 +207,7 @@ export default class MessageTasksTwist extends Twist<MessageTasksTwist> {
207207
if (activity) {
208208
await this.tools.plot.createNote({
209209
activity,
210-
note: `No channels found for ${provider}.`,
210+
content: `No channels found for ${provider}.`,
211211
});
212212
}
213213
return;
@@ -225,7 +225,7 @@ export default class MessageTasksTwist extends Twist<MessageTasksTwist> {
225225
if (activity) {
226226
await this.tools.plot.createNote({
227227
activity,
228-
note: `Failed to connect to ${provider}. Please try again.`,
228+
content: `Failed to connect to ${provider}. Please try again.`,
229229
});
230230
}
231231
}
@@ -268,7 +268,7 @@ export default class MessageTasksTwist extends Twist<MessageTasksTwist> {
268268
if (activity) {
269269
await this.tools.plot.createNote({
270270
activity,
271-
note: `Which ${provider} channels should I monitor?`,
271+
content: `Which ${provider} channels should I monitor?`,
272272
links,
273273
});
274274
}
@@ -313,7 +313,7 @@ export default class MessageTasksTwist extends Twist<MessageTasksTwist> {
313313
if (activity) {
314314
await this.tools.plot.createNote({
315315
activity,
316-
note: `Now monitoring #${channelName} for actionable threads`,
316+
content: `Now monitoring #${channelName} for actionable threads`,
317317
});
318318
}
319319
} catch (error) {
@@ -325,7 +325,7 @@ export default class MessageTasksTwist extends Twist<MessageTasksTwist> {
325325
if (activity) {
326326
await this.tools.plot.createNote({
327327
activity,
328-
note: `Failed to monitor #${channelName}. Please try again.`,
328+
content: `Failed to monitor #${channelName}. Please try again.`,
329329
});
330330
}
331331
}
@@ -412,7 +412,7 @@ If a task is needed, create a clear, actionable title that describes what the us
412412
},
413413
...thread.notes.map((note, idx) => ({
414414
role: "user" as const,
415-
content: `[Message ${idx + 1}] User: ${note.note || "(empty message)"}`,
415+
content: `[Message ${idx + 1}] User: ${note.content || "(empty message)"}`,
416416
})),
417417
];
418418

@@ -517,12 +517,12 @@ If a task is needed, create a clear, actionable title that describes what the us
517517
notes: analysis.taskNote
518518
? [
519519
{
520-
note: `${analysis.taskNote}\n\n---\nFrom #${channelName}`,
520+
content: `${analysis.taskNote}\n\n---\nFrom #${channelName}`,
521521
},
522522
]
523523
: [
524524
{
525-
note: `From #${channelName}`,
525+
content: `From #${channelName}`,
526526
},
527527
],
528528
meta: {
@@ -566,7 +566,7 @@ Return true only if there's clear evidence the task is done.`,
566566
},
567567
...recentMessages.map((note) => ({
568568
role: "user" as const,
569-
content: `User: ${note.note || ""}`,
569+
content: `User: ${note.content || ""}`,
570570
})),
571571
];
572572

0 commit comments

Comments
 (0)