AbstractAbstractcreateCreates a new activity in the Plot system.
The activity will be automatically assigned an ID and author information based on the current execution context. All other fields from NewActivity will be preserved in the created activity.
The activity data to create
Promise resolving to the complete created activity
AbstractcreateCreates multiple activities in a single batch operation.
This method efficiently creates multiple activities at once, which is more performant than calling createActivity() multiple times individually. All activities are created with the same author and access control rules.
Array of activity data to create
Promise resolving to array of created activities
AbstractupdateUpdates an existing activity in the Plot system.
Only the fields provided in the update object will be modified - all other fields remain unchanged. This enables partial updates without needing to fetch and resend the entire activity object.
For tags, provide a Record<number, boolean> where true adds a tag and false removes it. Tags not included in the update remain unchanged.
When updating the parent, the activity's path will be automatically recalculated to maintain the correct hierarchical structure.
When updating scheduling fields (start, end, recurrence*), the database will automatically recalculate duration and range values to maintain consistency.
The activity update containing the ID and fields to change
Promise that resolves when the update is complete
// Mark a task as complete
await this.plot.updateActivity({
id: "task-123",
done: new Date()
});
// Reschedule an event
await this.plot.updateActivity({
id: "event-456",
start: new Date("2024-03-15T10:00:00Z"),
end: new Date("2024-03-15T11:00:00Z")
});
// Add and remove tags
await this.plot.updateActivity({
id: "activity-789",
tags: {
1: true, // Add tag with ID 1
2: false // Remove tag with ID 2
}
});
// Update a recurring event exception
await this.plot.updateActivity({
id: "exception-123",
occurrence: new Date("2024-03-20T09:00:00Z"),
title: "Rescheduled meeting"
});
AbstractgetRetrieves all notes within an activity.
Notes are detailed entries within an activity, ordered by creation time. Each note can contain markdown content, links, and other detailed information related to the parent activity.
The activity whose notes to retrieve
Promise resolving to array of notes in the activity
AbstractcreateCreates a new note in an activity.
Notes provide detailed content within an activity, supporting markdown, links, and other rich content. The note will be automatically assigned an ID and author information based on the current execution context.
The note data to create
Promise resolving to the complete created note
// Create a note with content
await this.plot.createNote({
activity: { id: "activity-123" },
note: "Discussion notes from the meeting...",
contentType: "markdown"
});
// Create a note with links
await this.plot.createNote({
activity: { id: "activity-456" },
note: "Meeting recording available",
links: [{
type: ActivityLinkType.external,
title: "View Recording",
url: "https://example.com/recording"
}]
});
AbstractcreateCreates multiple notes in a single batch operation.
This method efficiently creates multiple notes at once, which is more performant than calling createNote() multiple times individually. All notes are created with the same author and access control rules.
Array of note data to create
Promise resolving to array of created notes
AbstractupdateUpdates an existing note in the Plot system.
Only the fields provided in the update object will be modified - all other fields remain unchanged. This enables partial updates without needing to fetch and resend the entire note object.
The note update containing the ID and fields to change
Promise that resolves when the update is complete
AbstractgetRetrieves an activity by ID or source.
This method enables lookup of activities either by their unique ID or by their source identifier (canonical URL from an external system). Archived activities are included in the results.
Activity lookup by ID or source
Promise resolving to the matching activity or null if not found
AbstractgetRetrieves a note by ID or key.
This method enables lookup of notes either by their unique ID or by their key (unique identifier within the activity). Archived notes are included in the results.
Note lookup by ID or key
Promise resolving to the matching note or null if not found
AbstractcreateCreates a new priority in the Plot system.
Priorities serve as organizational containers for activities and twists. The created priority will be automatically assigned a unique ID.
The priority data to create
Promise resolving to the complete created priority
AbstractgetAbstractupdateUpdates an existing priority in the Plot system.
The priority is identified by either its ID or key. Only the fields specified in the update will be changed.
Priority update containing ID/key and fields to change
Promise that resolves when the update is complete
AbstractaddAdds contacts to the Plot system.
Contacts are used for associating people with activities, such as event attendees or task assignees. Duplicate contacts (by email) will be merged or updated as appropriate. This method requires ContactAccess.Write permission.
Array of contact information to add
Promise resolving to array of created/updated actors
AbstractgetStatic ReadonlyOptionsConfiguration options for the Plot tool.
Important: All permissions must be explicitly requested. There are no default permissions.
// Minimal configuration with required permissions
build(build: ToolBuilder) {
return {
plot: build(Plot, {
activity: {
access: ActivityAccess.Create
}
})
};
}
// Full configuration with callbacks
build(build: ToolBuilder) {
return {
plot: build(Plot, {
activity: {
access: ActivityAccess.Create,
updated: this.onActivityUpdated
},
note: {
intents: [{
description: "Schedule meetings",
examples: ["Schedule a meeting tomorrow"],
handler: this.onSchedulingIntent
}],
created: this.onNoteCreated
},
priority: {
access: PriorityAccess.Full
},
contact: {
access: ContactAccess.Write
}
})
};
}
Built-in tool for interacting with the core Plot data layer.
The Plot tool provides twists with the ability to create and manage activities, priorities, and contacts within the Plot system. This is the primary interface for twists to persist data and interact with the Plot database.
Example