@plotday/twister 0.27.0 → 0.29.0
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/README.md +10 -4
- package/bin/templates/AGENTS.template.md +91 -29
- package/cli/templates/AGENTS.template.md +91 -29
- package/dist/common/calendar.d.ts +35 -28
- package/dist/common/calendar.d.ts.map +1 -1
- package/dist/common/messaging.d.ts +24 -10
- package/dist/common/messaging.d.ts.map +1 -1
- package/dist/common/projects.d.ts +30 -15
- package/dist/common/projects.d.ts.map +1 -1
- package/dist/common/serializable.d.ts +40 -0
- package/dist/common/serializable.d.ts.map +1 -0
- package/dist/common/serializable.js +2 -0
- package/dist/common/serializable.js.map +1 -0
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/tool.ITool.html +1 -1
- package/dist/docs/classes/tool.Tool.html +32 -28
- package/dist/docs/classes/tools_ai.AI.html +2 -2
- package/dist/docs/classes/tools_callbacks.Callbacks.html +6 -6
- package/dist/docs/classes/tools_integrations.Integrations.html +3 -3
- package/dist/docs/classes/tools_network.Network.html +12 -12
- package/dist/docs/classes/tools_plot.Plot.html +41 -31
- package/dist/docs/classes/tools_store.Store.html +31 -11
- package/dist/docs/classes/tools_tasks.Tasks.html +8 -8
- package/dist/docs/classes/tools_twists.Twists.html +5 -5
- package/dist/docs/classes/twist.Twist.html +28 -24
- package/dist/docs/documents/Building_Custom_Tools.html +8 -2
- package/dist/docs/documents/Built-in_Tools.html +19 -8
- package/dist/docs/documents/Core_Concepts.html +14 -6
- package/dist/docs/documents/Getting_Started.html +11 -4
- package/dist/docs/enums/plot.ActivityLinkType.html +5 -5
- package/dist/docs/enums/plot.ActivityType.html +4 -4
- package/dist/docs/enums/plot.ActorType.html +4 -4
- package/dist/docs/enums/plot.ConferencingProvider.html +6 -6
- package/dist/docs/enums/tag.Tag.html +2 -2
- package/dist/docs/enums/tools_ai.AIModel.html +2 -2
- package/dist/docs/enums/tools_integrations.AuthLevel.html +3 -3
- package/dist/docs/enums/tools_integrations.AuthProvider.html +11 -11
- package/dist/docs/enums/tools_plot.ActivityAccess.html +3 -3
- package/dist/docs/enums/tools_plot.ContactAccess.html +4 -4
- package/dist/docs/enums/tools_plot.PriorityAccess.html +3 -3
- package/dist/docs/functions/index.Uuid.Generate.html +1 -1
- package/dist/docs/functions/utils_hash.quickHash.html +1 -1
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/index.html +10 -0
- package/dist/docs/interfaces/common_calendar.Calendar.html +5 -5
- package/dist/docs/interfaces/common_calendar.CalendarTool.html +29 -15
- package/dist/docs/interfaces/common_calendar.SyncOptions.html +3 -3
- package/dist/docs/interfaces/index.SerializableArray.html +2 -0
- package/dist/docs/interfaces/index.SerializableMap.html +2 -0
- package/dist/docs/interfaces/index.SerializableObject.html +2 -0
- package/dist/docs/interfaces/index.SerializableSet.html +2 -0
- package/dist/docs/interfaces/tools_ai.AIRequest.html +11 -11
- package/dist/docs/interfaces/tools_ai.AIResponse.html +9 -9
- package/dist/docs/interfaces/tools_ai.FilePart.html +5 -5
- package/dist/docs/interfaces/tools_ai.ImagePart.html +4 -4
- package/dist/docs/interfaces/tools_ai.ReasoningPart.html +4 -4
- package/dist/docs/interfaces/tools_ai.RedactedReasoningPart.html +3 -3
- package/dist/docs/interfaces/tools_ai.TextPart.html +3 -3
- package/dist/docs/interfaces/tools_ai.ToolCallPart.html +5 -5
- package/dist/docs/interfaces/tools_ai.ToolExecutionOptions.html +4 -4
- package/dist/docs/interfaces/tools_ai.ToolResultPart.html +5 -5
- package/dist/docs/interfaces/tools_twists.TwistSource.html +3 -3
- package/dist/docs/interfaces/utils_types.ToolShed.html +5 -5
- package/dist/docs/media/SYNC_STRATEGIES.md +651 -0
- package/dist/docs/modules/index.html +1 -1
- package/dist/docs/modules/plot.html +1 -1
- package/dist/docs/modules/utils_types.html +1 -1
- package/dist/docs/types/common_calendar.CalendarAuth.html +2 -2
- package/dist/docs/types/index.Serializable.html +17 -0
- package/dist/docs/types/index.Uuid.html +1 -1
- package/dist/docs/types/plot.Activity.html +17 -8
- package/dist/docs/types/plot.ActivityCommon.html +10 -10
- package/dist/docs/types/plot.ActivityLink.html +1 -1
- package/dist/docs/types/plot.ActivityMeta.html +5 -3
- package/dist/docs/types/plot.ActivityUpdate.html +4 -2
- package/dist/docs/types/plot.ActivityWithNotes.html +1 -1
- package/dist/docs/types/plot.Actor.html +15 -5
- package/dist/docs/types/plot.ActorId.html +1 -1
- package/dist/docs/types/plot.ContentType.html +1 -1
- package/dist/docs/types/plot.NewActivity.html +26 -12
- package/dist/docs/types/plot.NewActivityWithNotes.html +1 -1
- package/dist/docs/types/plot.NewActor.html +1 -1
- package/dist/docs/types/plot.NewContact.html +4 -4
- package/dist/docs/types/plot.NewNote.html +9 -4
- package/dist/docs/types/plot.NewPriority.html +15 -5
- package/dist/docs/types/plot.NewTags.html +1 -1
- package/dist/docs/types/plot.Note.html +6 -3
- package/dist/docs/types/plot.NoteUpdate.html +4 -3
- package/dist/docs/types/plot.PickPriorityConfig.html +3 -3
- package/dist/docs/types/plot.Priority.html +9 -4
- package/dist/docs/types/plot.PriorityUpdate.html +3 -0
- package/dist/docs/types/plot.SyncUpdate.html +1 -1
- package/dist/docs/types/plot.Tags.html +1 -1
- package/dist/docs/types/tools_ai.AIAssistantMessage.html +2 -2
- package/dist/docs/types/tools_ai.AIMessage.html +1 -1
- package/dist/docs/types/tools_ai.AISource.html +1 -1
- package/dist/docs/types/tools_ai.AISystemMessage.html +2 -2
- package/dist/docs/types/tools_ai.AITool.html +1 -1
- package/dist/docs/types/tools_ai.AIToolMessage.html +2 -2
- package/dist/docs/types/tools_ai.AIToolSet.html +1 -1
- package/dist/docs/types/tools_ai.AIUsage.html +5 -5
- package/dist/docs/types/tools_ai.AIUserMessage.html +2 -2
- package/dist/docs/types/tools_ai.DataContent.html +1 -1
- package/dist/docs/types/tools_ai.ModelPreferences.html +4 -4
- package/dist/docs/types/tools_callbacks.Callback.html +1 -1
- package/dist/docs/types/tools_integrations.AuthToken.html +4 -4
- package/dist/docs/types/tools_integrations.Authorization.html +4 -4
- package/dist/docs/types/tools_network.WebhookRequest.html +6 -6
- package/dist/docs/types/tools_plot.NoteIntentHandler.html +4 -4
- package/dist/docs/types/tools_twists.Log.html +2 -2
- package/dist/docs/types/tools_twists.TwistPermissions.html +1 -1
- package/dist/docs/types/utils_types.BuiltInTools.html +2 -2
- package/dist/docs/types/utils_types.CallbackMethods.html +1 -1
- package/dist/docs/types/utils_types.ExtractBuildReturn.html +1 -1
- package/dist/docs/types/utils_types.InferOptions.html +1 -1
- package/dist/docs/types/utils_types.InferTools.html +1 -1
- package/dist/docs/types/utils_types.JSONValue.html +7 -0
- package/dist/docs/types/utils_types.NoFunctions.html +1 -1
- package/dist/docs/types/utils_types.NonFunction.html +1 -1
- package/dist/docs/types/utils_types.PromiseValues.html +1 -1
- package/dist/docs/types/utils_types.ToolBuilder.html +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/llm-docs/common/calendar.d.ts +1 -1
- package/dist/llm-docs/common/calendar.d.ts.map +1 -1
- package/dist/llm-docs/common/calendar.js +1 -1
- package/dist/llm-docs/common/calendar.js.map +1 -1
- package/dist/llm-docs/common/messaging.d.ts +1 -1
- package/dist/llm-docs/common/messaging.d.ts.map +1 -1
- package/dist/llm-docs/common/messaging.js +1 -1
- package/dist/llm-docs/common/messaging.js.map +1 -1
- package/dist/llm-docs/common/projects.d.ts +1 -1
- package/dist/llm-docs/common/projects.d.ts.map +1 -1
- package/dist/llm-docs/common/projects.js +1 -1
- package/dist/llm-docs/common/projects.js.map +1 -1
- package/dist/llm-docs/plot.d.ts +1 -1
- package/dist/llm-docs/plot.d.ts.map +1 -1
- package/dist/llm-docs/plot.js +1 -1
- package/dist/llm-docs/plot.js.map +1 -1
- package/dist/llm-docs/tool.d.ts +1 -1
- package/dist/llm-docs/tool.d.ts.map +1 -1
- package/dist/llm-docs/tool.js +1 -1
- package/dist/llm-docs/tool.js.map +1 -1
- package/dist/llm-docs/tools/network.d.ts +1 -1
- package/dist/llm-docs/tools/network.d.ts.map +1 -1
- package/dist/llm-docs/tools/network.js +1 -1
- package/dist/llm-docs/tools/network.js.map +1 -1
- package/dist/llm-docs/tools/plot.d.ts +1 -1
- package/dist/llm-docs/tools/plot.d.ts.map +1 -1
- package/dist/llm-docs/tools/plot.js +1 -1
- package/dist/llm-docs/tools/plot.js.map +1 -1
- package/dist/llm-docs/tools/store.d.ts +1 -1
- package/dist/llm-docs/tools/store.d.ts.map +1 -1
- package/dist/llm-docs/tools/store.js +1 -1
- package/dist/llm-docs/tools/store.js.map +1 -1
- package/dist/llm-docs/tools/tasks.d.ts +1 -1
- package/dist/llm-docs/tools/tasks.d.ts.map +1 -1
- package/dist/llm-docs/tools/tasks.js +1 -1
- package/dist/llm-docs/tools/tasks.js.map +1 -1
- package/dist/llm-docs/twist-guide-template.d.ts +1 -1
- package/dist/llm-docs/twist-guide-template.d.ts.map +1 -1
- package/dist/llm-docs/twist-guide-template.js +1 -1
- package/dist/llm-docs/twist-guide-template.js.map +1 -1
- package/dist/llm-docs/twist.d.ts +1 -1
- package/dist/llm-docs/twist.d.ts.map +1 -1
- package/dist/llm-docs/twist.js +1 -1
- package/dist/llm-docs/twist.js.map +1 -1
- package/dist/plot.d.ts +232 -56
- package/dist/plot.d.ts.map +1 -1
- package/dist/plot.js.map +1 -1
- package/dist/tool.d.ts +30 -8
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +29 -7
- package/dist/tool.js.map +1 -1
- package/dist/tools/network.d.ts +19 -16
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js +6 -4
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/plot.d.ts +93 -24
- package/dist/tools/plot.d.ts.map +1 -1
- package/dist/tools/plot.js +46 -1
- package/dist/tools/plot.js.map +1 -1
- package/dist/tools/store.d.ts +49 -8
- package/dist/tools/store.d.ts.map +1 -1
- package/dist/tools/store.js +12 -1
- package/dist/tools/store.js.map +1 -1
- package/dist/tools/tasks.d.ts +4 -4
- package/dist/tools/tasks.js +4 -4
- package/dist/twist-guide.d.ts +1 -1
- package/dist/twist-guide.d.ts.map +1 -1
- package/dist/twist.d.ts +24 -10
- package/dist/twist.d.ts.map +1 -1
- package/dist/twist.js +19 -5
- package/dist/twist.js.map +1 -1
- package/dist/utils/types.d.ts +19 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/plot.d.ts
CHANGED
|
@@ -1,8 +1,69 @@
|
|
|
1
1
|
import { type Tag } from "./tag";
|
|
2
2
|
import { type Callback } from "./tools/callbacks";
|
|
3
|
+
import { type JSONValue } from "./utils/types";
|
|
3
4
|
import { Uuid } from "./utils/uuid";
|
|
4
5
|
export { Tag } from "./tag";
|
|
5
6
|
export { Uuid } from "./utils/uuid";
|
|
7
|
+
export { type JSONValue } from "./utils/types";
|
|
8
|
+
/**
|
|
9
|
+
* @fileoverview
|
|
10
|
+
* Core Plot entity types for working with activities, notes, priorities, and contacts.
|
|
11
|
+
*
|
|
12
|
+
* ## Type Pattern: Null vs Undefined Semantics
|
|
13
|
+
*
|
|
14
|
+
* Plot entity types use a consistent pattern to distinguish between missing, unset, and explicitly cleared values:
|
|
15
|
+
*
|
|
16
|
+
* ### Entity Types (Activity, Priority, Note, Actor)
|
|
17
|
+
* - **Required fields**: No `?`, cannot be `undefined`
|
|
18
|
+
* - Example: `id: Uuid`, `type: ActivityType`
|
|
19
|
+
* - **Nullable fields**: Use `| null` to allow explicit clearing
|
|
20
|
+
* - Example: `assignee: ActorId | null`, `done: Date | null`
|
|
21
|
+
* - `null` = field is explicitly unset/cleared
|
|
22
|
+
* - Non-null value = field has a value
|
|
23
|
+
* - **Optional nullable fields**: Use `?` with `| null` for permission-based access
|
|
24
|
+
* - Example: `email?: string | null`, `name?: string | null`
|
|
25
|
+
* - `undefined` = field not included (e.g., no permission to access)
|
|
26
|
+
* - `null` = field included but not set
|
|
27
|
+
* - Value = field has a value
|
|
28
|
+
*
|
|
29
|
+
* ### New* Types (NewActivity, NewNote, NewPriority)
|
|
30
|
+
* Used for creating or updating entities. Support partial updates by distinguishing omitted vs cleared fields:
|
|
31
|
+
* - **Required fields**: Must be provided (no `?`)
|
|
32
|
+
* - Example: `type: ActivityType` in NewActivity
|
|
33
|
+
* - **Optional fields**: Use `?` to make them optional
|
|
34
|
+
* - Example: `title?: string`, `author?: NewActor`
|
|
35
|
+
* - `undefined` (omitted) = don't set/update this field
|
|
36
|
+
* - Provided value = set/update this field
|
|
37
|
+
* - **Optional nullable fields**: Use `?` with `| null` to support clearing
|
|
38
|
+
* - Example: `assignee?: NewActor | null`
|
|
39
|
+
* - `undefined` (omitted) = don't change assignee
|
|
40
|
+
* - `null` = clear the assignee
|
|
41
|
+
* - NewActor = set/update the assignee
|
|
42
|
+
*
|
|
43
|
+
* This pattern allows API consumers to:
|
|
44
|
+
* 1. Omit fields they don't want to change (undefined)
|
|
45
|
+
* 2. Explicitly clear fields by setting to null
|
|
46
|
+
* 3. Set or update fields by providing values
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Creating a new activity
|
|
51
|
+
* const newActivity: NewActivity = {
|
|
52
|
+
* type: ActivityType.Action, // Required
|
|
53
|
+
* title: "Review PR", // Optional, provided
|
|
54
|
+
* assignee: null, // Optional nullable, explicitly clearing
|
|
55
|
+
* // priority is omitted (undefined), will auto-select or use default
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* // Updating an activity - only change what's specified
|
|
59
|
+
* const update: ActivityUpdate = {
|
|
60
|
+
* id: activityId,
|
|
61
|
+
* done: new Date(), // Mark as done
|
|
62
|
+
* assignee: null, // Clear assignee
|
|
63
|
+
* // title is omitted, won't be changed
|
|
64
|
+
* };
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
6
67
|
/**
|
|
7
68
|
* Represents a unique user, contact, or twist in Plot.
|
|
8
69
|
*
|
|
@@ -23,20 +84,57 @@ export type ActorId = string & {
|
|
|
23
84
|
*/
|
|
24
85
|
export type Priority = {
|
|
25
86
|
/** Unique identifier for the priority */
|
|
26
|
-
id:
|
|
87
|
+
id: Uuid;
|
|
27
88
|
/** Human-readable title for the priority */
|
|
28
89
|
title: string;
|
|
90
|
+
/** Whether this priority has been archived */
|
|
91
|
+
archived: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Optional key for referencing this priority.
|
|
94
|
+
* Keys are unique per priority tree (a user's personal priorities or the root of a shared priority).
|
|
95
|
+
*/
|
|
96
|
+
key: string | null;
|
|
29
97
|
};
|
|
30
98
|
/**
|
|
31
99
|
* Type for creating new priorities.
|
|
32
100
|
*
|
|
33
|
-
*
|
|
34
|
-
* for
|
|
101
|
+
* Supports multiple creation patterns:
|
|
102
|
+
* - Provide a specific UUID for the priority
|
|
103
|
+
* - Provide a key for upsert within the user's priorities
|
|
104
|
+
* - Omit both to auto-generate a new UUID
|
|
105
|
+
*
|
|
106
|
+
* Optionally specify a parent priority by ID or key for hierarchical structures.
|
|
35
107
|
*/
|
|
36
|
-
export type NewPriority = Omit<Priority, "id"
|
|
37
|
-
/**
|
|
38
|
-
|
|
108
|
+
export type NewPriority = Pick<Priority, "title"> & Partial<Omit<Priority, "id" | "title">> & ({
|
|
109
|
+
/**
|
|
110
|
+
* Unique identifier for the priority, generated by Uuid.Generate().
|
|
111
|
+
* Specifying an ID allows tools to track and upsert priorities.
|
|
112
|
+
*/
|
|
113
|
+
id: Uuid;
|
|
114
|
+
} | {
|
|
115
|
+
/**
|
|
116
|
+
* Unique key for the priority within the user's priorities.
|
|
117
|
+
* Can be used to upsert without knowing the UUID.
|
|
118
|
+
* For example, "@plot" identifies the Plot priority.
|
|
119
|
+
*/
|
|
120
|
+
key: string;
|
|
121
|
+
} | {}) & {
|
|
122
|
+
/** Add the new priority as the child of another priority */
|
|
123
|
+
parent?: {
|
|
124
|
+
id: Uuid;
|
|
125
|
+
} | {
|
|
126
|
+
key: string;
|
|
127
|
+
};
|
|
39
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* Type for updating existing priorities.
|
|
131
|
+
* Must provide either id or key to identify the priority to update.
|
|
132
|
+
*/
|
|
133
|
+
export type PriorityUpdate = ({
|
|
134
|
+
id: Uuid;
|
|
135
|
+
} | {
|
|
136
|
+
key: string;
|
|
137
|
+
}) & Partial<Pick<Priority, "title" | "archived">>;
|
|
40
138
|
/**
|
|
41
139
|
* Enumeration of supported activity types in Plot.
|
|
42
140
|
*
|
|
@@ -167,6 +265,9 @@ export type ActivityLink = {
|
|
|
167
265
|
* which is useful for synchronization, linking back to external systems,
|
|
168
266
|
* and storing tool-specific data.
|
|
169
267
|
*
|
|
268
|
+
* Must be valid JSON data (strings, numbers, booleans, null, objects, arrays).
|
|
269
|
+
* Functions and other non-JSON values are not supported.
|
|
270
|
+
*
|
|
170
271
|
* @example
|
|
171
272
|
* ```typescript
|
|
172
273
|
* // Calendar event metadata
|
|
@@ -195,7 +296,7 @@ export type ActivityLink = {
|
|
|
195
296
|
*/
|
|
196
297
|
export type ActivityMeta = {
|
|
197
298
|
/** Source-specific properties and metadata */
|
|
198
|
-
[key: string]:
|
|
299
|
+
[key: string]: JSONValue;
|
|
199
300
|
};
|
|
200
301
|
/**
|
|
201
302
|
* Tags on an item, along with the actors who added each tag.
|
|
@@ -224,7 +325,7 @@ export type ActivityCommon = {
|
|
|
224
325
|
*
|
|
225
326
|
* Defaults to the current time when creating new activities.
|
|
226
327
|
*/
|
|
227
|
-
|
|
328
|
+
created: Date;
|
|
228
329
|
/** Information about who created the activity */
|
|
229
330
|
author: Actor;
|
|
230
331
|
/** Whether this activity is in draft state (not shown in do now view) */
|
|
@@ -239,6 +340,12 @@ export type ActivityCommon = {
|
|
|
239
340
|
mentions: ActorId[];
|
|
240
341
|
};
|
|
241
342
|
export type Activity = ActivityCommon & {
|
|
343
|
+
/**
|
|
344
|
+
* Canonical URL for the item in an external system.
|
|
345
|
+
* For example, https://acme.atlassian.net/browse/PROJ-42 could represent a Jira issue.
|
|
346
|
+
* When set, it uniquely identifies the activity within a priority tree.
|
|
347
|
+
*/
|
|
348
|
+
source: string | null;
|
|
242
349
|
/** The display title/summary of the activity */
|
|
243
350
|
title: string;
|
|
244
351
|
/** The type of activity (Note, Task, or Event) */
|
|
@@ -246,59 +353,66 @@ export type Activity = ActivityCommon & {
|
|
|
246
353
|
/**
|
|
247
354
|
* The actor assigned to this activity.
|
|
248
355
|
*
|
|
249
|
-
* **For actions (tasks):**
|
|
250
|
-
*
|
|
356
|
+
* **For actions (tasks):**
|
|
357
|
+
* - If not provided (undefined), defaults to the user who installed the twist (twist owner)
|
|
358
|
+
* - To create an **unassigned action**, explicitly set `assignee: null`
|
|
359
|
+
* - For synced tasks from external systems, typically set `assignee: null` for unassigned items
|
|
251
360
|
*
|
|
252
361
|
* **For notes and events:** Assignee is optional and typically null.
|
|
253
362
|
*
|
|
254
363
|
* @example
|
|
255
364
|
* ```typescript
|
|
256
|
-
* // Create action
|
|
365
|
+
* // Create action assigned to twist owner (default behavior)
|
|
257
366
|
* const task: NewActivity = {
|
|
258
367
|
* type: ActivityType.Action,
|
|
259
|
-
* title: "
|
|
260
|
-
* assignee
|
|
261
|
-
* id: userId as ActorId,
|
|
262
|
-
* type: ActorType.User,
|
|
263
|
-
* name: "Alice"
|
|
264
|
-
* }
|
|
368
|
+
* title: "Follow up on email"
|
|
369
|
+
* // assignee omitted → defaults to twist owner
|
|
265
370
|
* };
|
|
266
371
|
*
|
|
267
|
-
* // Create action
|
|
268
|
-
* const
|
|
372
|
+
* // Create UNASSIGNED action (for backlog items)
|
|
373
|
+
* const backlogTask: NewActivity = {
|
|
269
374
|
* type: ActivityType.Action,
|
|
270
|
-
* title: "
|
|
271
|
-
*
|
|
375
|
+
* title: "Review PR #123",
|
|
376
|
+
* assignee: null // Explicitly set to null
|
|
272
377
|
* };
|
|
273
378
|
*
|
|
274
|
-
* //
|
|
275
|
-
*
|
|
276
|
-
*
|
|
379
|
+
* // Create action with explicit assignee
|
|
380
|
+
* const assignedTask: NewActivity = {
|
|
381
|
+
* type: ActivityType.Action,
|
|
382
|
+
* title: "Deploy to production",
|
|
277
383
|
* assignee: {
|
|
278
|
-
* id:
|
|
384
|
+
* id: userId as ActorId,
|
|
279
385
|
* type: ActorType.User,
|
|
280
|
-
* name: "
|
|
386
|
+
* name: "Alice"
|
|
281
387
|
* }
|
|
282
|
-
* }
|
|
388
|
+
* };
|
|
283
389
|
* ```
|
|
284
390
|
*/
|
|
285
391
|
assignee: Actor | null;
|
|
286
392
|
/** Timestamp when the activity was marked as complete. Null if not completed. */
|
|
287
|
-
|
|
393
|
+
done: Date | null;
|
|
288
394
|
/**
|
|
289
395
|
* Start time of a scheduled activity. Notes are not typically scheduled unless they're about specific times.
|
|
290
396
|
* For recurring events, this represents the start of the first occurrence.
|
|
291
397
|
* Can be a Date object for timed events or a date string in "YYYY-MM-DD" format for all-day events.
|
|
292
398
|
*
|
|
293
399
|
* **Activity Scheduling States** (for Actions):
|
|
294
|
-
* - **Do Now** (current/actionable): When creating
|
|
400
|
+
* - **Do Now** (current/actionable): When creating an Action, omitting `start` defaults to current time
|
|
295
401
|
* - **Do Later** (future scheduled): Set `start` to a future Date or date string
|
|
296
402
|
* - **Do Someday** (unscheduled backlog): Explicitly set `start: null`
|
|
297
403
|
*
|
|
404
|
+
* **Important for synced tasks**: When syncing unassigned backlog items from external systems,
|
|
405
|
+
* set BOTH `start: null` AND `assignee: null` to create unscheduled, unassigned actions.
|
|
406
|
+
*
|
|
298
407
|
* @example
|
|
299
408
|
* ```typescript
|
|
300
|
-
* // "Do Now" -
|
|
301
|
-
* await this.tools.plot.createActivity({
|
|
409
|
+
* // "Do Now" - assigned to twist owner, actionable immediately
|
|
410
|
+
* await this.tools.plot.createActivity({
|
|
411
|
+
* type: ActivityType.Action,
|
|
412
|
+
* title: "Urgent task"
|
|
413
|
+
* // start omitted → defaults to now
|
|
414
|
+
* // assignee omitted → defaults to twist owner
|
|
415
|
+
* });
|
|
302
416
|
*
|
|
303
417
|
* // "Do Later" - scheduled for a specific time
|
|
304
418
|
* await this.tools.plot.createActivity({
|
|
@@ -307,11 +421,12 @@ export type Activity = ActivityCommon & {
|
|
|
307
421
|
* start: new Date("2025-02-01")
|
|
308
422
|
* });
|
|
309
423
|
*
|
|
310
|
-
* // "Do Someday" -
|
|
424
|
+
* // "Do Someday" - unassigned backlog item (common for synced tasks)
|
|
311
425
|
* await this.tools.plot.createActivity({
|
|
312
426
|
* type: ActivityType.Action,
|
|
313
427
|
* title: "Backlog task",
|
|
314
|
-
* start: null
|
|
428
|
+
* start: null, // Explicitly unscheduled
|
|
429
|
+
* assignee: null // Explicitly unassigned
|
|
315
430
|
* });
|
|
316
431
|
* ```
|
|
317
432
|
*/
|
|
@@ -386,8 +501,8 @@ export type NewActivityWithNotes = NewActivity & {
|
|
|
386
501
|
* // Score based on content (max 100 points) and require exact type match
|
|
387
502
|
* pickPriority: { content: 100, type: true }
|
|
388
503
|
*
|
|
389
|
-
* // Match on meta
|
|
390
|
-
* pickPriority: { "meta.
|
|
504
|
+
* // Match on meta and score content
|
|
505
|
+
* pickPriority: { "meta.projectId": true, content: 50 }
|
|
391
506
|
* ```
|
|
392
507
|
*/
|
|
393
508
|
export type PickPriorityConfig = {
|
|
@@ -404,15 +519,20 @@ export type PickPriorityConfig = {
|
|
|
404
519
|
* the current execution context. The ID can be optionally provided by
|
|
405
520
|
* tools for tracking and update detection purposes.
|
|
406
521
|
*
|
|
407
|
-
* **Important:
|
|
522
|
+
* **Important: Defaults for Actions**
|
|
523
|
+
*
|
|
524
|
+
* When creating an Activity of type `Action`:
|
|
525
|
+
* - **`start` omitted** → Defaults to current time (now) → "Do Now"
|
|
526
|
+
* - **`assignee` omitted** → Defaults to twist owner → Assigned action
|
|
408
527
|
*
|
|
409
|
-
*
|
|
410
|
-
* -
|
|
411
|
-
* -
|
|
412
|
-
* - **Set `start` to future Date** → Scheduled → "Do Later" (appears on that date)
|
|
528
|
+
* To create unassigned backlog items (common for synced tasks), you MUST explicitly set BOTH:
|
|
529
|
+
* - `start: null` → "Do Someday" (unscheduled)
|
|
530
|
+
* - `assignee: null` → Unassigned
|
|
413
531
|
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
532
|
+
* **Scheduling States**:
|
|
533
|
+
* - **"Do Now"** (actionable today): Omit `start` or set to current time
|
|
534
|
+
* - **"Do Later"** (scheduled): Set `start` to a future Date
|
|
535
|
+
* - **"Do Someday"** (backlog): Set `start: null`
|
|
416
536
|
*
|
|
417
537
|
* Priority can be specified in three ways:
|
|
418
538
|
* 1. Explicit priority: `priority: { id: "..." }` - Use specific priority (disables pickPriority)
|
|
@@ -421,18 +541,20 @@ export type PickPriorityConfig = {
|
|
|
421
541
|
*
|
|
422
542
|
* @example
|
|
423
543
|
* ```typescript
|
|
424
|
-
* // "Do Now" -
|
|
544
|
+
* // "Do Now" - Assigned to twist owner, actionable immediately
|
|
425
545
|
* const urgentTask: NewActivity = {
|
|
426
546
|
* type: ActivityType.Action,
|
|
427
547
|
* title: "Review pull request"
|
|
428
|
-
* //
|
|
548
|
+
* // start omitted → defaults to now
|
|
549
|
+
* // assignee omitted → defaults to twist owner
|
|
429
550
|
* };
|
|
430
551
|
*
|
|
431
|
-
* // "Do Someday" -
|
|
552
|
+
* // "Do Someday" - UNASSIGNED backlog item (for synced tasks)
|
|
432
553
|
* const backlogTask: NewActivity = {
|
|
433
554
|
* type: ActivityType.Action,
|
|
434
555
|
* title: "Refactor user service",
|
|
435
|
-
* start: null
|
|
556
|
+
* start: null, // Must explicitly set to null
|
|
557
|
+
* assignee: null // Must explicitly set to null
|
|
436
558
|
* };
|
|
437
559
|
*
|
|
438
560
|
* // "Do Later" - Scheduled for specific date
|
|
@@ -459,13 +581,27 @@ export type PickPriorityConfig = {
|
|
|
459
581
|
* };
|
|
460
582
|
* ```
|
|
461
583
|
*/
|
|
462
|
-
export type NewActivity = Pick<Activity, "type"> & Partial<Omit<Activity, "author" | "assignee" | "type" | "priority" | "tags" | "mentions">> & ({
|
|
584
|
+
export type NewActivity = Pick<Activity, "type"> & Partial<Omit<Activity, "author" | "assignee" | "type" | "priority" | "tags" | "mentions" | "id" | "source">> & ({
|
|
585
|
+
/**
|
|
586
|
+
* Unique identifier for the activity, generated by Uuid.Generate().
|
|
587
|
+
* Specifying an ID allows tools to track and upsert activities.
|
|
588
|
+
*/
|
|
589
|
+
id: Uuid;
|
|
590
|
+
} | {
|
|
591
|
+
/**
|
|
592
|
+
* Canonical URL for the item in an external system.
|
|
593
|
+
* For example, https://acme.atlassian.net/browse/PROJ-42 could represent a Jira issue.
|
|
594
|
+
* When set, it uniquely identifies the activity within a priority tree. This performs
|
|
595
|
+
* an upsert.
|
|
596
|
+
*/
|
|
597
|
+
source: string;
|
|
598
|
+
} | {}) & ({
|
|
463
599
|
/** Explicit priority (required when specified) - disables automatic priority matching */
|
|
464
600
|
priority: Pick<Priority, "id">;
|
|
465
601
|
} | {
|
|
466
602
|
/** Configuration for automatic priority selection based on similarity */
|
|
467
603
|
pickPriority?: PickPriorityConfig;
|
|
468
|
-
}
|
|
604
|
+
}) & {
|
|
469
605
|
/**
|
|
470
606
|
* The person that created the item. By default, it will be the twist itself.
|
|
471
607
|
*/
|
|
@@ -487,7 +623,17 @@ export type NewActivity = Pick<Activity, "type"> & Partial<Omit<Activity, "autho
|
|
|
487
623
|
*/
|
|
488
624
|
unread?: boolean;
|
|
489
625
|
};
|
|
490
|
-
export type ActivityUpdate =
|
|
626
|
+
export type ActivityUpdate = ({
|
|
627
|
+
/**
|
|
628
|
+
* Unique identifier for the activity.
|
|
629
|
+
*/
|
|
630
|
+
id: Uuid;
|
|
631
|
+
} | {
|
|
632
|
+
/**
|
|
633
|
+
* Canonical URL for the item in an external system.
|
|
634
|
+
*/
|
|
635
|
+
source: string;
|
|
636
|
+
}) & Partial<Pick<Activity, "type" | "start" | "end" | "done" | "title" | "assignee" | "draft" | "private" | "archived" | "meta" | "recurrenceRule" | "recurrenceDates" | "recurrenceExdates" | "recurrenceUntil" | "recurrenceCount" | "occurrence">> & {
|
|
491
637
|
/**
|
|
492
638
|
* Tags to change on the activity. Use an empty array of NewActor to remove a tag.
|
|
493
639
|
* Use twistTags to add/remove the twist from tags to avoid clearing other actors' tags.
|
|
@@ -543,6 +689,12 @@ export type SyncUpdate = NewActivityWithNotes | {
|
|
|
543
689
|
* They are always ordered by creation time within their parent activity.
|
|
544
690
|
*/
|
|
545
691
|
export type Note = ActivityCommon & {
|
|
692
|
+
/**
|
|
693
|
+
* Unique identifier for the note within its activity.
|
|
694
|
+
* Can be used to upsert without knowing the id.
|
|
695
|
+
* For example, "description" could identify the description note for a Jira issue.
|
|
696
|
+
*/
|
|
697
|
+
key: string | null;
|
|
546
698
|
/** The parent activity this note belongs to */
|
|
547
699
|
activity: Activity;
|
|
548
700
|
/** Primary content for the note (markdown) */
|
|
@@ -554,11 +706,20 @@ export type Note = ActivityCommon & {
|
|
|
554
706
|
* Type for creating new notes.
|
|
555
707
|
*
|
|
556
708
|
* Requires the activity reference, with all other fields optional.
|
|
557
|
-
*
|
|
709
|
+
* Can provide id, key, or neither for note identification:
|
|
710
|
+
* - id: Provide a specific UUID for the note
|
|
711
|
+
* - key: Provide an external identifier for upsert within the activity
|
|
712
|
+
* - neither: A new note with auto-generated UUID will be created
|
|
558
713
|
*/
|
|
559
|
-
export type NewNote = Partial<Omit<Note, "author" | "activity" | "tags" | "mentions">> & {
|
|
714
|
+
export type NewNote = Partial<Omit<Note, "author" | "activity" | "tags" | "mentions" | "id" | "key">> & ({
|
|
715
|
+
id: Uuid;
|
|
716
|
+
} | {
|
|
717
|
+
key: string;
|
|
718
|
+
} | {}) & {
|
|
560
719
|
/** Reference to the parent activity (required) */
|
|
561
|
-
activity: Pick<Activity, "id"
|
|
720
|
+
activity: Pick<Activity, "id"> | {
|
|
721
|
+
source: string;
|
|
722
|
+
};
|
|
562
723
|
/**
|
|
563
724
|
* The person that created the item, or leave undefined to use the twist as author.
|
|
564
725
|
*/
|
|
@@ -590,8 +751,13 @@ export type NewNote = Partial<Omit<Note, "author" | "activity" | "tags" | "menti
|
|
|
590
751
|
};
|
|
591
752
|
/**
|
|
592
753
|
* Type for updating existing notes.
|
|
754
|
+
* Must provide either id or key to identify the note to update.
|
|
593
755
|
*/
|
|
594
|
-
export type NoteUpdate =
|
|
756
|
+
export type NoteUpdate = ({
|
|
757
|
+
id: Uuid;
|
|
758
|
+
} | {
|
|
759
|
+
key: string;
|
|
760
|
+
}) & Partial<Pick<Note, "draft" | "private" | "archived" | "content" | "links">> & {
|
|
595
761
|
/**
|
|
596
762
|
* Format of the note content. Determines how the note is processed:
|
|
597
763
|
* - 'text': Plain text that will be converted to markdown (auto-links URLs, preserves line breaks)
|
|
@@ -636,9 +802,19 @@ export type Actor = {
|
|
|
636
802
|
id: ActorId;
|
|
637
803
|
/** Type of actor (User, Contact, or Twist) */
|
|
638
804
|
type: ActorType;
|
|
639
|
-
/**
|
|
640
|
-
|
|
641
|
-
|
|
805
|
+
/**
|
|
806
|
+
* Email address (only included with ContactAccess.Read permission).
|
|
807
|
+
* - `undefined`: No permission to read email
|
|
808
|
+
* - `null`: Permission granted but email not set
|
|
809
|
+
* - `string`: Email address
|
|
810
|
+
*/
|
|
811
|
+
email?: string | null;
|
|
812
|
+
/**
|
|
813
|
+
* Display name.
|
|
814
|
+
* - `undefined`: Not included due to permissions
|
|
815
|
+
* - `null`: Not set
|
|
816
|
+
* - `string`: Display name
|
|
817
|
+
*/
|
|
642
818
|
name?: string | null;
|
|
643
819
|
};
|
|
644
820
|
/**
|
package/dist/plot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../src/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EA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EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEJ;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,sCAAsC;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,8CAA8C;IAC9C,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB;IACE,sCAAsC;IACtC,EAAE,EAAE,OAAO,CAAC;CACb,GACD,UAAU,CAAC;AAEf;;;;;GAKG;AACH,oBAAY,SAAS;IACnB,wCAAwC;IACxC,IAAI,IAAA;IACJ,8CAA8C;IAC9C,OAAO,IAAA;IACP,6CAA6C;IAC7C,KAAK,IAAA;CACN;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC"}
|
package/dist/plot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../src/plot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../src/plot.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAyIpC;;;;;GAKG;AACH,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,qEAAqE;IACrE,+CAAI,CAAA;IACJ,+CAA+C;IAC/C,mDAAM,CAAA;IACN,8DAA8D;IAC9D,iDAAK,CAAA;AACP,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,8CAA8C;IAC9C,yCAAqB,CAAA;IACrB,mDAAmD;IACnD,iCAAa,CAAA;IACb,6DAA6D;IAC7D,yCAAqB,CAAA;IACrB,+DAA+D;IAC/D,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,oBAWX;AAXD,WAAY,oBAAoB;IAC9B,kBAAkB;IAClB,iDAAyB,CAAA;IACzB,WAAW;IACX,qCAAa,CAAA;IACb,sBAAsB;IACtB,yDAAiC,CAAA;IACjC,kBAAkB;IAClB,uCAAe,CAAA;IACf,6CAA6C;IAC7C,uCAAe,CAAA;AACjB,CAAC,EAXW,oBAAoB,KAApB,oBAAoB,QAW/B;AAotBD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,wCAAwC;IACxC,yCAAI,CAAA;IACJ,8CAA8C;IAC9C,+CAAO,CAAA;IACP,6CAA6C;IAC7C,2CAAK,CAAA;AACP,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB"}
|
package/dist/tool.d.ts
CHANGED
|
@@ -99,25 +99,47 @@ export declare abstract class Tool<TSelf> implements ITool {
|
|
|
99
99
|
* @param args - Optional arguments to pass to the callback
|
|
100
100
|
* @returns Promise resolving to the callback result
|
|
101
101
|
*/
|
|
102
|
-
protected run(token: Callback, args
|
|
102
|
+
protected run(token: Callback, ...args: any[]): Promise<any>;
|
|
103
103
|
/**
|
|
104
104
|
* Retrieves a value from persistent storage by key.
|
|
105
105
|
*
|
|
106
|
-
*
|
|
106
|
+
* Values are automatically deserialized using SuperJSON, which
|
|
107
|
+
* properly restores Date objects, Maps, Sets, and other complex types.
|
|
108
|
+
*
|
|
109
|
+
* @template T - The expected type of the stored value (must be Serializable)
|
|
107
110
|
* @param key - The storage key to retrieve
|
|
108
111
|
* @returns Promise resolving to the stored value or null
|
|
109
112
|
*/
|
|
110
|
-
protected get<T>(key: string): Promise<T | null>;
|
|
113
|
+
protected get<T extends import("./index").Serializable>(key: string): Promise<T | null>;
|
|
111
114
|
/**
|
|
112
115
|
* Stores a value in persistent storage.
|
|
113
116
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
117
|
+
* The value will be serialized using SuperJSON and stored persistently.
|
|
118
|
+
* SuperJSON automatically handles Date objects, Maps, Sets, undefined values,
|
|
119
|
+
* and other complex types that standard JSON doesn't support.
|
|
116
120
|
*
|
|
121
|
+
* **Important**: Functions and Symbols cannot be stored.
|
|
117
122
|
* **For function references**: Use callbacks instead of storing functions directly.
|
|
118
123
|
*
|
|
119
124
|
* @example
|
|
120
125
|
* ```typescript
|
|
126
|
+
* // ✅ Date objects are preserved
|
|
127
|
+
* await this.set("sync_state", {
|
|
128
|
+
* lastSync: new Date(),
|
|
129
|
+
* minDate: new Date(2024, 0, 1)
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
* // ✅ undefined is now supported
|
|
133
|
+
* await this.set("data", { name: "test", optional: undefined });
|
|
134
|
+
*
|
|
135
|
+
* // ✅ Arrays with undefined are supported
|
|
136
|
+
* await this.set("items", [1, undefined, 3]);
|
|
137
|
+
* await this.set("items", [1, null, 3]); // Also works
|
|
138
|
+
*
|
|
139
|
+
* // ✅ Maps and Sets are supported
|
|
140
|
+
* await this.set("mapping", new Map([["key", "value"]]));
|
|
141
|
+
* await this.set("tags", new Set(["tag1", "tag2"]));
|
|
142
|
+
*
|
|
121
143
|
* // ❌ WRONG: Cannot store functions directly
|
|
122
144
|
* await this.set("handler", this.myHandler);
|
|
123
145
|
*
|
|
@@ -130,12 +152,12 @@ export declare abstract class Tool<TSelf> implements ITool {
|
|
|
130
152
|
* await this.run(token, args);
|
|
131
153
|
* ```
|
|
132
154
|
*
|
|
133
|
-
* @template T - The type of value being stored
|
|
155
|
+
* @template T - The type of value being stored (must be Serializable)
|
|
134
156
|
* @param key - The storage key to use
|
|
135
|
-
* @param value - The value to store (must be
|
|
157
|
+
* @param value - The value to store (must be SuperJSON-serializable)
|
|
136
158
|
* @returns Promise that resolves when the value is stored
|
|
137
159
|
*/
|
|
138
|
-
protected set<T>(key: string, value: T): Promise<void>;
|
|
160
|
+
protected set<T extends import("./index").Serializable>(key: string, value: T): Promise<void>;
|
|
139
161
|
/**
|
|
140
162
|
* Removes a specific key from persistent storage.
|
|
141
163
|
*
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;GAGG;AACH,8BAAsB,KAAK;CAAG;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,8BAAsB,IAAI,CAAC,KAAK,CAAE,YAAW,KAAK;IAE9C,SAAS,CAAC,EAAE,EAAE,MAAM;IACpB,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;IACtC,OAAO,CAAC,QAAQ;gBAFN,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAC9B,QAAQ,EAAE,QAAQ;IAG5B;;;OAGG;IACH,SAAS,KAAK,KAAK,sBAElB;IAED;;;;;;;;;;;;;;;;OAgBG;IAEH,KAAK,CAAC,KAAK,EAAE,WAAW,GAA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