Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/remove-today-and-goal-tools.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
"@plotday/twister": major
---

Removed: the Today and goal surfaces from the Plot tool. The `TodayAccess` and `GoalAccess` permission enums are gone, along with the `today` and `goals` entries in `Plot.Options`, the `getTodayItems()`, `updateTodayItem()`, and `getTodayThreadId()` methods, the `createGoal()`, `getGoals()`, `updateGoal()`, and `archiveGoal()` methods, the `TodayItem`, `TodayItemSection`, and `TodayItemKind` types, the `Note.todayItem` field, and the `@plotday/twister/goal` entry point with its `Goal`, `NewGoal`, `GoalUpdate`, `GoalStatus`, and `GoalCadence` types. To upgrade, drop `today` and `goals` from your `build(Plot, { ... })` options and remove any calls to those methods; a twist that stored per-user intentions through goals can keep them in its own state with `this.set` / `this.get`. Note that the thread `type` value `"goal"` is unaffected — it is a display sub-type and remains available.
5 changes: 0 additions & 5 deletions twister/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,11 +40,6 @@
"types": "./dist/schedule.d.ts",
"default": "./dist/schedule.js"
},
"./goal": {
"@plotday/connector": "./src/goal.ts",
"types": "./dist/goal.d.ts",
"default": "./dist/goal.js"
},
"./tag": {
"@plotday/connector": "./src/tag.ts",
"types": "./dist/tag.d.ts",
Expand Down
69 changes: 0 additions & 69 deletions twister/src/goal.ts

This file was deleted.

1 change: 0 additions & 1 deletion twister/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,6 @@ export * from "./twist";
export * from "./connector";
export * from "./plot";
export * from "./schedule";
export * from "./goal";
export * from "./tag";
export * from "./tool";
export {
Expand Down
11 changes: 0 additions & 11 deletions twister/src/plot.today-item.test-d.ts

This file was deleted.

57 changes: 1 addition & 56 deletions twister/src/plot.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -771,15 +771,6 @@ export type Note = ThreadCommon & {
actions: Array<Action> | null;
/** The note this is a reply to, or null if not a reply */
reNote: { id: Uuid } | null;
/**
* The Today-item context this note was composed against, via the Today
* thread's pin affordance (pin an item to discuss it), or null. Mutually
* exclusive with `reNote` and a forward snapshot — a note is at most one
* of a reply, a forward, or a Today-item reference. Read-only from a
* twist's perspective: only the Plot app sets it, when the user pins a
* Today item and sends a message in the Today thread.
*/
todayItem: { id: Uuid } | null;
/**
* Contacts who can see this note, or null if the note inherits thread visibility.
* When set (even to []), the note is private to the listed contacts plus the creator.
Expand DownExpand Up@@ -837,7 +828,7 @@ export type Note = ThreadCommon & {
export type NewNote = Partial<
Omit<
Note,
"author" | "thread" | "tags" | "reactions" | "mentions" | "accessContacts" | "recipients" | "id" | "key" | "reNote" | "todayItem" | "tagActors"
"author" | "thread" | "tags" | "reactions" | "mentions" | "accessContacts" | "recipients" | "id" | "key" | "reNote" | "tagActors"
>
> &
({ id: Uuid } | { key: string } | {}) & {
Expand DownExpand Up@@ -1662,49 +1653,3 @@ export type PlanOperation =
focusTitle: string;
changes: Partial<Pick<Focus, "title" | "archived">>;
};

/**
* Section of the user's Today snapshot an item belongs to.
* - "priorities": the day's top items (to-dos, events, urgent threads, goals)
* - "updates": important information pulled from unread threads
*/
export type TodayItemSection = "priorities" | "updates";

/**
* The kind of a Today snapshot item. Determines check-off affordances and
* how the item links back to threads/goals.
*/
export type TodayItemKind = "todo" | "event" | "urgent" | "goal" | "update";

/**
* One item in the user's Today snapshot — the pre-generated, per-day list
* of priorities and updates. Items are server-composed; twists read them
* via {@link Plot.getTodayItems} and adjust them (rank / checked /
* dismissed) via {@link Plot.updateTodayItem}. All other fields are
* server-authored and read-only from the SDK.
*/
export type TodayItem = {
id: Uuid;
/** The user-local day this item belongs to, as an ISO date ("YYYY-MM-DD"). */
day: string;
section: TodayItemSection;
kind: TodayItemKind;
/** Order within the section, ascending (lower rank renders higher). */
rank: number;
/** The item line, consolidated where appropriate. */
title: string;
/** 1–2 sentence support text, mainly for "updates" items. */
detail: string | null;
/** Linked threads; the first is the primary open target. May be empty (e.g. goal items). */
threadIds: Uuid[];
/** The focus this item is labeled with, if any. */
focusId: Uuid | null;
/** The goal this item derives from, if any. */
goalId: Uuid | null;
/** Event start (events only). */
startsAt: Date | string | null;
/** Event end (events only). */
endsAt: Date | string | null;
/** When the user checked this item off, or null if unchecked. */
checkedAt: Date | string | null;
};
129 changes: 0 additions & 129 deletions twister/src/tools/plot.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,19 +16,12 @@ import {
type PlanOperation,
type Focus,
type FocusUpdate,
type TodayItem,
Uuid,
} from "..";
import {
type Schedule,
type NewSchedule,
} from "../schedule";
import {
type Goal,
type GoalStatus,
type GoalUpdate,
type NewGoal,
} from "../goal";
import type { Callback } from "./callbacks";

export enum ThreadAccess {
Expand DownExpand Up@@ -78,26 +71,6 @@ export enum LinkAccess {
Full,
}

export enum GoalAccess {
/** Read the owner's goals. */
Read,
/**
* Read, create, update, and archive the owner's goals.
* All Read permissions.
*/
Manage,
}

export enum TodayAccess {
/** Read the user's Today snapshot items and Today-thread id. */
Read,
/**
* Read + adjust Today items: re-rank within a section, check items off,
* and dismiss items from the snapshot. Includes all Read permissions.
*/
Manage,
}

/**
* Intent handler for thread mentions.
* Defines how the twist should respond when mentioned in a thread.
Expand DownExpand Up@@ -350,20 +323,6 @@ export abstract class Plot extends ITool {
contact?: {
access?: ContactAccess;
};
/**
* Enable goal operations. Goals are per-user intentions ("ship X by
* Friday", "3 hours a week on leads") that shape Plot's day planning.
*/
goals?: {
access: GoalAccess;
};
/**
* Access to the user's Today snapshot (per-day priorities/updates items
* and the persistent Today chat thread id).
*/
today?: {
access: TodayAccess;
};
/** Enable semantic search across notes and links owned by the twist's user. */
search?: true;
/**
Expand DownExpand Up@@ -682,56 +641,6 @@ export abstract class Plot extends ITool {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
abstract getSchedules(threadId: Uuid): Promise<Schedule[]>;

/**
* Creates a new goal for the twist owner.
*
* Requires `goals: { access: GoalAccess.Manage }`.
*
* @param goal - The goal data to create (`title` required)
* @returns Promise resolving to the created goal
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
abstract createGoal(goal: NewGoal): Promise<Goal>;

/**
* Lists the twist owner's goals (archived goals are excluded).
*
* Requires `goals: { access: GoalAccess.Read }` (or Manage).
*
* @param filter - Optional status filter
* @returns Promise resolving to the matching goals
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
abstract getGoals(filter?: { status?: GoalStatus }): Promise<Goal[]>;

/**
* Partially updates an existing goal. Omitted fields are left unchanged;
* `null` clears a nullable field. Setting `status: "completed"` records
* the completion time server-side; moving away from `completed` clears it.
*
* Requires `goals: { access: GoalAccess.Manage }`.
*
* @param update - The goal update containing the ID and fields to change
* @returns Promise resolving to the updated goal
* @throws Error if the goal does not exist
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
abstract updateGoal(update: GoalUpdate): Promise<Goal>;

/**
* Archives a goal (soft delete — the row is kept server-side as agent
* memory; goals are never hard-deleted). Prefer
* `updateGoal({ id, status: "dropped" })` for "cancel my goal", which
* keeps it visible in goal listings.
*
* Requires `goals: { access: GoalAccess.Manage }`.
*
* @param id - The goal id to archive
* @throws Error if the goal does not exist
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
abstract archiveGoal(id: Uuid): Promise<void>;

/**
* Reads a focus's agent memory — the facts Plot has been told about that
* focus. Entries whose date is long past are excluded; a recently overdue
Expand DownExpand Up@@ -778,44 +687,6 @@ export abstract class Plot extends ITool {
*/
abstract getBriefs(): Promise<FocusBrief[]>;

/**
* Lists the user's current Today snapshot: all non-archived items for the
* latest generated day, ordered by section ("priorities" first) then rank.
*
* Requires `today` access ({@link TodayAccess.Read} or higher).
*
* @returns Promise resolving to the current Today items (may be empty)
*/
abstract getTodayItems(): Promise<TodayItem[]>;

/**
* Adjusts one Today item. Only the provided fields change:
* - `rank` reorders the item within its section (ascending; lower is higher)
* - `checked: true` stamps the item's checked state; `false` clears it
* - `dismissed: true` removes the item from the snapshot (archives it)
*
* Requires {@link TodayAccess.Manage}.
*
* @param update - The item id plus the fields to change
* @returns Promise that resolves when the update is complete
* @throws Error if the item does not exist or belongs to another user
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
abstract updateTodayItem(update: {
id: Uuid;
rank?: number;
checked?: boolean;
dismissed?: boolean;
}): Promise<void>;

/**
* Returns the id of the user's persistent Today chat thread, or null if
* it has not been created yet (first snapshot generation pending).
*
* Requires `today` access ({@link TodayAccess.Read} or higher).
*/
abstract getTodayThreadId(): Promise<Uuid | null>;

/**
* Retrieves links from connected source channels.
*
Expand Down
Loading