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",
doneAt: 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 activities in the same thread as the specified activity.
A thread consists of related activities linked through parent-child relationships or other associative connections. This is useful for finding conversation histories or related task sequences.
The activity whose thread to retrieve
Promise resolving to array of activities in the thread
AbstractgetFinds an activity by its metadata.
This method enables lookup of activities that were created from external systems, using the metadata to locate the corresponding Plot activity. Useful for preventing duplicate imports and maintaining sync state.
The activity metadata to search for
Promise resolving to the matching activity 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
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 ReadonlyOptionsOptionalactivity?: {Activity event callbacks.
Optionalaccess?: ActivityAccessOptionalupdated?: (Called when an activity is updated.
Optionalintents?: ActivityIntentHandler[]Intent handlers for activity mentions. When an activity mentions this twist, the system will match the activity content against these intent descriptions and call the matching handler.
intents: [{
description: "Schedule or reschedule calendar events",
examples: ["Schedule a meeting tomorrow at 2pm", "Move my 3pm meeting to 4pm"],
handler: this.onSchedulingRequest
}, {
description: "Find available meeting times",
examples: ["When am I free this week?", "Find time for a 1 hour meeting"],
handler: this.onAvailabilityRequest
}]
Optionalpriority?: { access?: PriorityAccess }Optionalcontact?: { access?: ContactAccess }
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