@davidwoods/skylight-mcp 1.21.0 → 1.23.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 +28 -6
- package/dist/canary/checks.d.ts +31 -0
- package/dist/canary/checks.d.ts.map +1 -0
- package/dist/canary/checks.js +82 -0
- package/dist/canary/checks.js.map +1 -0
- package/dist/canary/run.d.ts +30 -0
- package/dist/canary/run.d.ts.map +1 -0
- package/dist/canary/run.js +54 -0
- package/dist/canary/run.js.map +1 -0
- package/dist/lib-writes.d.ts +98 -0
- package/dist/lib-writes.d.ts.map +1 -0
- package/dist/lib-writes.js +287 -0
- package/dist/lib-writes.js.map +1 -0
- package/dist/lib.d.ts +36 -2
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +36 -6
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -210,6 +210,8 @@ fixed in 1.8.0), the live test suite, and `worker:setup`.
|
|
|
210
210
|
| Tools missing after an update | Fully quit and reopen the client; it caches the tool list. For a hosted connector use its "Refresh tools list". |
|
|
211
211
|
| Worked yesterday, fails today | Skylight has no public API and may have changed. Run `doctor`, then check the issues. |
|
|
212
212
|
|
|
213
|
+
To find out before it bites, run the [breakage canary](canary/README.md) weekly from a host scheduler (optional, Docker). It reads five things through the library entry and exits non-zero when one changes shape; your scheduler does the emailing.
|
|
214
|
+
|
|
213
215
|
### First five things to ask Claude
|
|
214
216
|
|
|
215
217
|
Once `doctor` is clean, try these in order. The first three only read. The last two show how the write guards work, so you see them before anything lands on your Skylight display.
|
|
@@ -462,7 +464,7 @@ last captured are recorded in the repository's build log.
|
|
|
462
464
|
Nothing here is hidden behind a flag. It is either unavailable from Skylight or not yet captured.
|
|
463
465
|
|
|
464
466
|
- **Messages**: sending to specific devices, scheduling, repeating, voice notes, and read-aloud (the option exists on `send_message` but was not tested live). Deleting works but the app has no delete button.
|
|
465
|
-
- **Meals**: editing a repeating meal (refused), repeat rules other than weekly, deleting a meal that was edited on its own after being in a series (refused), saving a meal to the recipe box from the edit form, assigning a meal to a label or anything but a profile (`profiles` takes profile names only; the typed argument was run live on 2026-11-13 for create, rename, unassign and the planner,
|
|
467
|
+
- **Meals**: editing a repeating meal (refused), repeat rules other than weekly, deleting a meal that was edited on its own after being in a series (refused), saving a meal to the recipe box from the edit form, assigning a meal to a label or anything but a profile (`profiles` takes profile names only; the typed argument was run live on 2026-11-13 for create, rename, unassign and the planner, and later that day for weekly and multi-profile meals; not run: scope `one` on an assigned repeating meal, which detaches it and cannot then be deleted here), assigning every profile at once (Skylight has no "everyone" option, so name them), and Skylight's own "Plan Meals" feature.
|
|
466
468
|
- **Task box**: editing or completing tasks, and saving a routine template to it.
|
|
467
469
|
- **Chores**: completing a one-off (non-recurring) chore, Skip, daily or monthly routine schedules (only the weekly format has been captured), and editing a recurring chore's date, time, assignee or stars. Un-completing a routine cannot reduce its `longest_streak`. Whether "this and future" from a later day keeps the earlier days has not been checked (the capture started from the first day).
|
|
468
470
|
- **Profiles**: creating or editing them. Read-only.
|
|
@@ -576,8 +578,8 @@ Meals and recipes need Skylight Plus.
|
|
|
576
578
|
|------|--------|-------------|
|
|
577
579
|
| `get_meal_categories` | read | Breakfast, Lunch, Dinner, Snack and their IDs |
|
|
578
580
|
| `get_meal_sittings` | read | Scheduled meals in a date range, with sitting IDs and who each is for (`for: name, name`; none printed means unassigned); `details: true` also prints notes and instructions |
|
|
579
|
-
| `create_meal_sitting` | write | Schedule a meal on a date (free text or a saved recipe). `repeat: "weekly"` repeats it every week on that weekday. `profiles` names who it is for (exact profile names; an unknown name changes nothing); one meal per person can share a day and category. Run live 2026-11-13: assigned create, and `plan_week_meals` with one meal per person.
|
|
580
|
-
| `update_meal_sitting` | write | Rename, re-categorise, or set the note or the instructions (`description`) of a meal, by sitting ID and its current date; one-offs can also be moved. `profiles` replaces who it is for (`[]` unassigns; omitted keeps it). Repeating meals need `scope` (`one`, `future`, `all`), are preview-first and need `confirm: true`; they cannot be moved. `one` and `future` return a new sitting ID. |
|
|
581
|
+
| `create_meal_sitting` | write | Schedule a meal on a date (free text or a saved recipe). `repeat: "weekly"` repeats it every week on that weekday. `profiles` names who it is for (exact profile names; an unknown name changes nothing); one meal per person can share a day and category. Run live 2026-11-13: assigned create, weekly plus profiles, and `plan_week_meals` with one meal per person. |
|
|
582
|
+
| `update_meal_sitting` | write | Rename, re-categorise, or set the note or the instructions (`description`) of a meal, by sitting ID and its current date; one-offs can also be moved. `profiles` replaces who it is for (`[]` unassigns; omitted keeps it). Repeating meals need `scope` (`one`, `future`, `all`), are preview-first and need `confirm: true`; they cannot be moved. `one` and `future` return a new sitting ID. Run live 2026-11-13 (hosted Worker): `profiles` on a whole series (`all`) and on a split (`future`, which gave later dates a different person and a new ID). `one` with `profiles` not run live. |
|
|
581
583
|
| `delete_meal_sitting` | destructive | Delete a meal. For a repeating meal, `scope` is `one` (default), `future` or `all` (whole series). Previews unless `confirm: true`; reports success only when Skylight confirms the removal. A meal edited on its own after being in a series is refused. |
|
|
582
584
|
| `get_recipes` / `get_recipe` | read | Browse saved recipes |
|
|
583
585
|
| `create_recipe` / `update_recipe` | write | Add or change a recipe |
|
|
@@ -622,16 +624,36 @@ const skylight = createSkylight({
|
|
|
622
624
|
const events = await skylight.calendar.events({ from: "2026-11-09", to: "2026-11-15" });
|
|
623
625
|
```
|
|
624
626
|
|
|
625
|
-
Read methods
|
|
627
|
+
Read methods: `calendar.events`, `calendar.sources`, `profiles.list`, `labels.list`, `chores.list`, `meals.sittings`, `meals.recipes`, `meals.categories`, `lists.list`, `lists.items`. They return plain objects, never raw Skylight records: no emails, event uids, calendar or account ids, or subscription feed addresses (a feed shows only its host; an email-shaped calendar label is replaced). Event ids are opaque: a repeating event's occurrence ids change after a time edit, so do not store or compare them. One write: `calendar.previewCreate` and `calendar.create` (see "Creating events" below).
|
|
626
628
|
|
|
627
629
|
Behaviour an importer should plan for:
|
|
628
630
|
- `chores.list` takes one day (`{ date }`) or a range (`{ from, to }`, both included, at most 31 days), plus an optional `profile`. A repeating chore appears once per day it falls on, and each item's `date` is that day. The range is not yet verified against live Skylight.
|
|
629
631
|
- One `createSkylight` client holds one sign-in and caches what it read from your store, including "nothing stored". After `completeLogin` writes a new credential, or after any `AuthenticationError`, make a new client.
|
|
630
|
-
- Profile names and colours are cached for up to 5 minutes per client, so a renamed profile can show its old name for up to 5 minutes.
|
|
632
|
+
- Profile and label names and colours are cached for up to 5 minutes per client (one read of Skylight's categories serves `profiles.list`, `labels.list` and the names on events), so a renamed profile or label can show its old name or colour for up to 5 minutes.
|
|
633
|
+
- Colouring an event the way Skylight does: it uses every category on the event. `labels.list()` returns `{ id, label, color }[]` for every category that is not a profile (a feed, the holidays calendar, a team), including labels no event uses; `profiles.list()` returns the same shape for people. An event's `profileIds` and `labelIds` hold the ids of its `profiles` and `labels` (same order), so look colours up by id. Names are not unique: two labels can share one, and an email-shaped name is replaced by `Calendar` (in the lists and on events alike), so match by id, not by name.
|
|
634
|
+
- `color` is the string Skylight stores, or `null`. Seen live: six-digit hex with a leading `#`, in either case (`#2178AF`, `#fdb305`), including colours outside the app's palette. The library does not normalise it, so match case-insensitively and validate it before using it as a style.
|
|
631
635
|
- If a refreshed credential cannot be written to your store, the call fails with `CredentialSaveError` (an `AuthenticationError`, `code` `CREDENTIAL_SAVE_FAILED`). Refresh tokens rotate, so the old one in your store is already spent: treat it as signed out and sign in again. The error never includes your store's own message.
|
|
632
636
|
- The library writes no per-request log lines. Errors and warnings still go to `console.error`.
|
|
633
637
|
|
|
634
|
-
What is not there, on purpose:
|
|
638
|
+
What is not there, on purpose: event updates and deletes (planned next), other writes, messages, source-calendar and feed management, and any function that takes a URL or a feed address (sign-in lives in the separate setup entry below, which accepts exactly one address: the Skylight redirect you paste). There is no host or fetch option; the API host is fixed in code and an unknown option is refused. Only the package root and `/setup` are importable (deep imports such as `dist/api/client.js` fail). The library holds a live sign-in, so it stops accidents and token leaks, not a malicious importer. Verified read-only against a real frame on 2026-11-09 (chores and list items were empty that day).
|
|
639
|
+
|
|
640
|
+
### Creating events (experimental)
|
|
641
|
+
|
|
642
|
+
```ts
|
|
643
|
+
const entry = { title: "Dentist", start: "2026-12-03T15:00", end: "2026-12-03T16:00", profileIds: ["123"], calendar: "456" };
|
|
644
|
+
const preview = await skylight.calendar.previewCreate(entry); // changes nothing; show it, get a yes
|
|
645
|
+
const event = await skylight.calendar.create(entry); // same arguments; returns the stored event
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
- Two functions, identical arguments. Both run the same check against fresh reads (profiles, labels, calendars), so the preview cannot drift from the write. `create` checks again, writes once, then reads the event back and resolves only when the read-back shows every field as asked.
|
|
649
|
+
- `calendar` is required: `"skylight"` for Skylight's own calendar (shows on Skylight only), or the `id` of a calendar from `calendar.sources()` whose `writable` is true: a Google calendar this account can edit. Skylight writes the event through to Google, where everyone who shares that calendar sees it, with that calendar's default reminders. The calendar's address and account are looked up inside the call and never returned.
|
|
650
|
+
- Times are wall-clock in the frame's time zone: `start` and `end` as `YYYY-MM-DDTHH:MM`, no offset or `Z`. A time the clocks skip is refused; an ambiguous time (the repeated hour) is read as the earlier one. All day: `allDay: true`, `start` as `YYYY-MM-DD`, `end` left out (one day). The preview shows the times as they will be sent (ISO with the frame's offset).
|
|
651
|
+
- Optional: `location` (500 characters), `notes` (5,000), `profileIds` (from `profiles.list()`), `labelIds` (from `labels.list()`; a label a synced calendar writes to is refused, Skylight assigns it itself). Title: one line, 200 characters. These limits are the library's; Skylight's own are not known.
|
|
652
|
+
- One-off events only: no repeating events, no multi-day all-day events yet.
|
|
653
|
+
- Errors are plain `Error`s with `name` `"SkylightWriteError"` and a `code`; check `name` and `code`, not `instanceof` (the root exports no classes). Input: `bad_input`, `invalid_title`, `invalid_time`, `end_before_start`, `unknown_profile`, `unknown_label`, `label_not_assignable` (each with `ids`), `unknown_calendar`, `calendar_not_writable`, `unsupported`. The write: `skylight_refused` (Skylight said no, with `status`; nothing was written), `outcome_unknown` (a network or server error after sending: it may or may not exist, read before retrying), `not_confirmed` (accepted, with `eventId`, but the read-back did not show it as asked within about 2 seconds; Skylight's list can lag, so read before retrying). Messages are the library's own; Skylight's response text is never included. A sign-in failure stays an `AuthenticationError`.
|
|
654
|
+
- After `create` resolves, a read of that day through the library shows the event (the read-back used the same list). On a Google calendar Skylight adds that calendar's own label to the event, and (seen live) writes it to Google during the create call itself; the library does not check Google.
|
|
655
|
+
- Verified on a real frame on 2026-11-16: a create on Skylight's calendar with a profile, and a create on a linked Google calendar that then showed in Google Calendar with the same title and times. Both test events were deleted afterwards.
|
|
656
|
+
- Nothing de-duplicates: two `create` calls make two events. Debounce taps in your app.
|
|
635
657
|
|
|
636
658
|
### Signing in from your own app (setup entry, experimental)
|
|
637
659
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The breakage canary's checks: read-only calls through the library entry, each judged
|
|
3
|
+
* against what the family's data must look like. Skylight has no official API, so the
|
|
4
|
+
* common breakage is a wrong or empty result, not an HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* A result carries only a fixed check id and a fixed reason word. Nothing Skylight returns
|
|
7
|
+
* (a title, a name, an error message) is ever copied into a result, because the result is
|
|
8
|
+
* sent to a third-party alert service.
|
|
9
|
+
*/
|
|
10
|
+
import type { Skylight } from "../lib.js";
|
|
11
|
+
export type CheckId = "profiles" | "meal-categories" | "meals-week" | "calendar-week" | "calendar-sources";
|
|
12
|
+
export type Reason = "sign-in" | "error" | "empty" | "shape" | "no-dinner";
|
|
13
|
+
export interface CheckResult {
|
|
14
|
+
id: CheckId;
|
|
15
|
+
ok: boolean;
|
|
16
|
+
reason?: Reason;
|
|
17
|
+
}
|
|
18
|
+
export interface CheckInput {
|
|
19
|
+
/** First and last day of the window, YYYY-MM-DD. */
|
|
20
|
+
from: string;
|
|
21
|
+
to: string;
|
|
22
|
+
/** The meal category that must exist. */
|
|
23
|
+
dinnerName: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function runChecks(skylight: Skylight, input: CheckInput): Promise<CheckResult[]>;
|
|
26
|
+
/** One line for the alert. Fixed words only. Sign-in problems collapse to one reason. */
|
|
27
|
+
export declare function summarize(results: readonly CheckResult[]): {
|
|
28
|
+
ok: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/canary/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG1C,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,iBAAiB,GAAG,YAAY,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAC3G,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAiBD,wBAAsB,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAwC7F;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAK3F"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The breakage canary's checks: read-only calls through the library entry, each judged
|
|
3
|
+
* against what the family's data must look like. Skylight has no official API, so the
|
|
4
|
+
* common breakage is a wrong or empty result, not an HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* A result carries only a fixed check id and a fixed reason word. Nothing Skylight returns
|
|
7
|
+
* (a title, a name, an error message) is ever copied into a result, because the result is
|
|
8
|
+
* sent to a third-party alert service.
|
|
9
|
+
*/
|
|
10
|
+
import { AuthenticationError } from "../utils/errors.js";
|
|
11
|
+
const nonEmpty = (v) => typeof v === "string" && v.trim().length > 0;
|
|
12
|
+
const isArray = (v) => Array.isArray(v) && v.every((x) => x !== null && typeof x === "object");
|
|
13
|
+
async function attempt(id, fn) {
|
|
14
|
+
try {
|
|
15
|
+
const reason = await fn();
|
|
16
|
+
return reason ? { id, ok: false, reason } : { id, ok: true };
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
return { id, ok: false, reason: error instanceof AuthenticationError ? "sign-in" : "error" };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function runChecks(skylight, input) {
|
|
23
|
+
const range = { from: input.from, to: input.to };
|
|
24
|
+
return Promise.all([
|
|
25
|
+
attempt("profiles", async () => {
|
|
26
|
+
const list = await skylight.profiles.list();
|
|
27
|
+
if (!isArray(list))
|
|
28
|
+
return "shape";
|
|
29
|
+
if (list.length === 0)
|
|
30
|
+
return "empty";
|
|
31
|
+
return list.every((p) => nonEmpty(p.id) && nonEmpty(p.label)) ? null : "shape";
|
|
32
|
+
}),
|
|
33
|
+
attempt("meal-categories", async () => {
|
|
34
|
+
const list = await skylight.meals.categories();
|
|
35
|
+
if (!isArray(list))
|
|
36
|
+
return "shape";
|
|
37
|
+
if (list.length === 0)
|
|
38
|
+
return "empty";
|
|
39
|
+
if (!list.every((c) => nonEmpty(c.id) && nonEmpty(c.name)))
|
|
40
|
+
return "shape";
|
|
41
|
+
const wanted = input.dinnerName.trim().toLowerCase();
|
|
42
|
+
return list.some((c) => String(c.name).trim().toLowerCase() === wanted) ? null : "no-dinner";
|
|
43
|
+
}),
|
|
44
|
+
attempt("meals-week", async () => {
|
|
45
|
+
// An empty week is allowed: a family may not have planned it. A malformed one is not.
|
|
46
|
+
const list = await skylight.meals.sittings(range);
|
|
47
|
+
if (!isArray(list))
|
|
48
|
+
return "shape";
|
|
49
|
+
return list.every((m) => nonEmpty(m.id) && Array.isArray(m.dates) && m.dates.length > 0 && m.dates.every(nonEmpty))
|
|
50
|
+
? null
|
|
51
|
+
: "shape";
|
|
52
|
+
}),
|
|
53
|
+
attempt("calendar-week", async () => {
|
|
54
|
+
const list = await skylight.calendar.events(range);
|
|
55
|
+
if (!isArray(list))
|
|
56
|
+
return "shape";
|
|
57
|
+
if (list.length === 0)
|
|
58
|
+
return "empty";
|
|
59
|
+
return list.every((e) => nonEmpty(e.id) && typeof e.title === "string" && (e.start === null || nonEmpty(e.start)))
|
|
60
|
+
? null
|
|
61
|
+
: "shape";
|
|
62
|
+
}),
|
|
63
|
+
attempt("calendar-sources", async () => {
|
|
64
|
+
const list = await skylight.calendar.sources();
|
|
65
|
+
if (!isArray(list))
|
|
66
|
+
return "shape";
|
|
67
|
+
if (list.length === 0)
|
|
68
|
+
return "empty";
|
|
69
|
+
return list.every((s) => nonEmpty(s.id) && nonEmpty(s.kind)) ? null : "shape";
|
|
70
|
+
}),
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
/** One line for the alert. Fixed words only. Sign-in problems collapse to one reason. */
|
|
74
|
+
export function summarize(results) {
|
|
75
|
+
const failed = results.filter((r) => !r.ok);
|
|
76
|
+
if (failed.length === 0)
|
|
77
|
+
return { ok: true, message: `all ${results.length} checks passed` };
|
|
78
|
+
if (failed.every((r) => r.reason === "sign-in"))
|
|
79
|
+
return { ok: false, message: "FAILED: sign-in needed" };
|
|
80
|
+
return { ok: false, message: `FAILED: ${failed.map((r) => `${r.id}:${r.reason}`).join(", ")}` };
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -0,0 +1 @@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one line, and exits
|
|
4
|
+
* 0 on a pass or 1 on a failure (including an expired sign-in). It does not schedule itself and
|
|
5
|
+
* sends nothing: run it from the host's scheduler and let the scheduler email you on a non-zero
|
|
6
|
+
* exit (on a Synology NAS, a Task Scheduler user-defined script with "send run details by email
|
|
7
|
+
* only when the script terminates abnormally"). See canary/README.md.
|
|
8
|
+
*
|
|
9
|
+
* Settings come from the environment:
|
|
10
|
+
* SKYLIGHT_FRAME_ID digits (required)
|
|
11
|
+
* SKYLIGHT_TIMEZONE IANA zone (required)
|
|
12
|
+
* CANARY_DINNER_NAME meal category that must exist, default Dinner
|
|
13
|
+
* The sign-in is the CLI's own (`skylight-mcp auth login`), stored in XDG_CONFIG_HOME.
|
|
14
|
+
*
|
|
15
|
+
* node dist/canary/run.js --once
|
|
16
|
+
*/
|
|
17
|
+
import { type Skylight } from "../lib.js";
|
|
18
|
+
export interface CycleDeps {
|
|
19
|
+
skylight: Skylight;
|
|
20
|
+
timezone: string;
|
|
21
|
+
dinnerName: string;
|
|
22
|
+
now: () => number;
|
|
23
|
+
log: (line: string) => void;
|
|
24
|
+
}
|
|
25
|
+
/** One cycle: checks, then one log line. Never logs anything Skylight returned (the message is a fixed vocabulary). */
|
|
26
|
+
export declare function runCycle(deps: CycleDeps): Promise<{
|
|
27
|
+
ok: boolean;
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/canary/run.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1D,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,uHAAuH;AACvH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAMzF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Breakage canary. Runs read-only checks through the library entry, prints one line, and exits
|
|
4
|
+
* 0 on a pass or 1 on a failure (including an expired sign-in). It does not schedule itself and
|
|
5
|
+
* sends nothing: run it from the host's scheduler and let the scheduler email you on a non-zero
|
|
6
|
+
* exit (on a Synology NAS, a Task Scheduler user-defined script with "send run details by email
|
|
7
|
+
* only when the script terminates abnormally"). See canary/README.md.
|
|
8
|
+
*
|
|
9
|
+
* Settings come from the environment:
|
|
10
|
+
* SKYLIGHT_FRAME_ID digits (required)
|
|
11
|
+
* SKYLIGHT_TIMEZONE IANA zone (required)
|
|
12
|
+
* CANARY_DINNER_NAME meal category that must exist, default Dinner
|
|
13
|
+
* The sign-in is the CLI's own (`skylight-mcp auth login`), stored in XDG_CONFIG_HOME.
|
|
14
|
+
*
|
|
15
|
+
* node dist/canary/run.js --once
|
|
16
|
+
*/
|
|
17
|
+
import { pathToFileURL } from "node:url";
|
|
18
|
+
import { defaultCredentialStore } from "../api/credential-store.js";
|
|
19
|
+
import { createSkylight } from "../lib.js";
|
|
20
|
+
import { addDays, dateInZone } from "../utils/schedule.js";
|
|
21
|
+
import { runChecks, summarize } from "./checks.js";
|
|
22
|
+
/** One cycle: checks, then one log line. Never logs anything Skylight returned (the message is a fixed vocabulary). */
|
|
23
|
+
export async function runCycle(deps) {
|
|
24
|
+
const today = dateInZone(deps.now(), deps.timezone);
|
|
25
|
+
const results = await runChecks(deps.skylight, { from: today, to: addDays(today, 6), dinnerName: deps.dinnerName });
|
|
26
|
+
const verdict = summarize(results);
|
|
27
|
+
deps.log(`[canary] ${today} ${verdict.ok ? "PASS" : "FAIL"}: ${verdict.message}`);
|
|
28
|
+
return verdict;
|
|
29
|
+
}
|
|
30
|
+
async function main() {
|
|
31
|
+
const env = process.env;
|
|
32
|
+
const timezone = env.SKYLIGHT_TIMEZONE ?? "";
|
|
33
|
+
const skylight = createSkylight({
|
|
34
|
+
frameId: env.SKYLIGHT_FRAME_ID ?? "",
|
|
35
|
+
timezone,
|
|
36
|
+
credential: defaultCredentialStore(),
|
|
37
|
+
});
|
|
38
|
+
const result = await runCycle({
|
|
39
|
+
skylight,
|
|
40
|
+
timezone,
|
|
41
|
+
dinnerName: env.CANARY_DINNER_NAME ?? "Dinner",
|
|
42
|
+
now: () => Date.now(),
|
|
43
|
+
log: (line) => console.log(line),
|
|
44
|
+
});
|
|
45
|
+
process.exitCode = result.ok ? 0 : 1;
|
|
46
|
+
}
|
|
47
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
48
|
+
main().catch((error) => {
|
|
49
|
+
// Configuration errors only (bad env). Print the message, never the environment.
|
|
50
|
+
console.error(`[canary] cannot start: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
51
|
+
process.exitCode = 78;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/canary/run.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAiB,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC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AC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/E,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,iFAAiF;QACjF,OAAO,CAAC,KAAK,CAAC,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QACpG,OAAO,CAAC,QAAQ,GAAG,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event writes for the library entry (experimental). Stage 1: create a one-off event.
|
|
3
|
+
*
|
|
4
|
+
* Every write is two functions with identical arguments: a preview that changes nothing and a
|
|
5
|
+
* commit. Both call the same plan function, so the checks cannot drift: the commit re-runs
|
|
6
|
+
* every check against fresh reads (the calendar can change between the two calls), then writes,
|
|
7
|
+
* then reads back.
|
|
8
|
+
*
|
|
9
|
+
* Errors for input and for the write itself are plain Errors with `name` "SkylightWriteError"
|
|
10
|
+
* and a stable `code`. Their messages are the library's own wording: Skylight's response text is
|
|
11
|
+
* never included (the HTTP client puts it in its own error messages, so every write error is
|
|
12
|
+
* mapped here). Sign-in errors pass through unchanged (`AuthenticationError`).
|
|
13
|
+
*
|
|
14
|
+
* Nothing here returns a calendar address, an account id or an email: the Google calendar is
|
|
15
|
+
* chosen by its `calendar.sources()` id and resolved inside the call.
|
|
16
|
+
*/
|
|
17
|
+
import type { CalendarEventResource, CreateCalendarEventRequest, SourceCalendarResource } from "./api/types.js";
|
|
18
|
+
export type WriteErrorCode = "bad_input" | "invalid_title" | "invalid_time" | "end_before_start" | "unknown_profile" | "unknown_label" | "label_not_assignable" | "unknown_calendar" | "calendar_not_writable" | "unsupported" | "skylight_refused" | "outcome_unknown" | "not_confirmed";
|
|
19
|
+
export interface SkylightWriteError extends Error {
|
|
20
|
+
name: "SkylightWriteError";
|
|
21
|
+
code: WriteErrorCode;
|
|
22
|
+
/** HTTP status, for `skylight_refused` only. */
|
|
23
|
+
status?: number;
|
|
24
|
+
/** The id Skylight gave the event, for `not_confirmed` only. */
|
|
25
|
+
eventId?: string;
|
|
26
|
+
/** The ids that were not accepted, for `unknown_profile`, `unknown_label` and `label_not_assignable`. */
|
|
27
|
+
ids?: string[];
|
|
28
|
+
}
|
|
29
|
+
export declare function writeError(code: WriteErrorCode, message: string, extra?: {
|
|
30
|
+
status?: number;
|
|
31
|
+
eventId?: string;
|
|
32
|
+
ids?: string[];
|
|
33
|
+
}): SkylightWriteError;
|
|
34
|
+
/**
|
|
35
|
+
* A new one-off event. Times are wall-clock in the frame's time zone: no offset, no "Z".
|
|
36
|
+
* - Timed: `start` and `end` are "YYYY-MM-DDTHH:MM"; `end` after `start`.
|
|
37
|
+
* - All day: `allDay: true`, `start` is "YYYY-MM-DD", and `end` is left out or the same date
|
|
38
|
+
* (one day; multi-day all-day events are not supported yet).
|
|
39
|
+
* `calendar` is required: "skylight" for Skylight's own calendar (shows on Skylight only), or the
|
|
40
|
+
* `id` of a Google calendar from `calendar.sources()` whose `writable` is true (Skylight writes it
|
|
41
|
+
* through to Google, where everyone who shares that calendar sees it).
|
|
42
|
+
*/
|
|
43
|
+
export interface CreateEventInput {
|
|
44
|
+
title: string;
|
|
45
|
+
start: string;
|
|
46
|
+
end?: string;
|
|
47
|
+
allDay?: boolean;
|
|
48
|
+
location?: string;
|
|
49
|
+
notes?: string;
|
|
50
|
+
/** Profile ids from `profiles.list()`. */
|
|
51
|
+
profileIds?: string[];
|
|
52
|
+
/** Label ids from `labels.list()`. A label a synced calendar writes to is refused. */
|
|
53
|
+
labelIds?: string[];
|
|
54
|
+
calendar: string;
|
|
55
|
+
}
|
|
56
|
+
/** Exactly what a create would write, in library terms. Times are as they will be sent (ISO with the frame's offset, or dates for all day). */
|
|
57
|
+
export interface CreatePreview {
|
|
58
|
+
action: "create";
|
|
59
|
+
title: string;
|
|
60
|
+
start: string;
|
|
61
|
+
end: string;
|
|
62
|
+
allDay: boolean;
|
|
63
|
+
location: string | null;
|
|
64
|
+
notes: string | null;
|
|
65
|
+
profileIds: string[];
|
|
66
|
+
profiles: string[];
|
|
67
|
+
labelIds: string[];
|
|
68
|
+
labels: string[];
|
|
69
|
+
calendar: {
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
kind: "skylight" | "google";
|
|
73
|
+
};
|
|
74
|
+
timezone: string;
|
|
75
|
+
}
|
|
76
|
+
/** True when the library can create on this source: a Google calendar this account can write to. */
|
|
77
|
+
export declare function sourceWritable(cal: SourceCalendarResource): boolean;
|
|
78
|
+
interface CreatePlan {
|
|
79
|
+
preview: CreatePreview;
|
|
80
|
+
body: CreateCalendarEventRequest;
|
|
81
|
+
/** For the read-back. */
|
|
82
|
+
startDate: string;
|
|
83
|
+
endDate: string;
|
|
84
|
+
startMs: number;
|
|
85
|
+
endMs: number;
|
|
86
|
+
categoryIds: string[];
|
|
87
|
+
source: "skylight" | "google";
|
|
88
|
+
}
|
|
89
|
+
/** The one check behind previewCreate and create. Reads categories and calendars fresh every time. */
|
|
90
|
+
export declare function planCreate(input: unknown, timeZone: string): Promise<CreatePlan>;
|
|
91
|
+
/**
|
|
92
|
+
* Create, then read back. Returns the stored record only when the read-back shows every field as
|
|
93
|
+
* asked; otherwise throws `not_confirmed` with the id Skylight gave (the event may still appear:
|
|
94
|
+
* Skylight's list can lag a write).
|
|
95
|
+
*/
|
|
96
|
+
export declare function commitCreate(input: unknown, timeZone: string, categoryIdsOf: (e: CalendarEventResource) => string[]): Promise<CalendarEventResource>;
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=lib-writes.d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,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,MAAM,EAAE,GACpD,OAAO,CAAC,qBAAqB,CAAC,CAyBhC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event writes for the library entry (experimental). Stage 1: create a one-off event.
|
|
3
|
+
*
|
|
4
|
+
* Every write is two functions with identical arguments: a preview that changes nothing and a
|
|
5
|
+
* commit. Both call the same plan function, so the checks cannot drift: the commit re-runs
|
|
6
|
+
* every check against fresh reads (the calendar can change between the two calls), then writes,
|
|
7
|
+
* then reads back.
|
|
8
|
+
*
|
|
9
|
+
* Errors for input and for the write itself are plain Errors with `name` "SkylightWriteError"
|
|
10
|
+
* and a stable `code`. Their messages are the library's own wording: Skylight's response text is
|
|
11
|
+
* never included (the HTTP client puts it in its own error messages, so every write error is
|
|
12
|
+
* mapped here). Sign-in errors pass through unchanged (`AuthenticationError`).
|
|
13
|
+
*
|
|
14
|
+
* Nothing here returns a calendar address, an account id or an email: the Google calendar is
|
|
15
|
+
* chosen by its `calendar.sources()` id and resolved inside the call.
|
|
16
|
+
*/
|
|
17
|
+
import { getClient } from "./api/client.js";
|
|
18
|
+
import { getCalendarEvents, createCalendarEvent } from "./api/endpoints/calendar.js";
|
|
19
|
+
import { getCategories } from "./api/endpoints/categories.js";
|
|
20
|
+
import { isoWithOffset } from "./api/endpoints/messages.js";
|
|
21
|
+
import { readBackUntil } from "./api/endpoints/source-calendars.js";
|
|
22
|
+
import { addDays, dateInZone, toLocalParts, zonedToEpoch } from "./utils/schedule.js";
|
|
23
|
+
export function writeError(code, message, extra = {}) {
|
|
24
|
+
const e = new Error(message);
|
|
25
|
+
e.name = "SkylightWriteError";
|
|
26
|
+
e.code = code;
|
|
27
|
+
if (extra.status !== undefined)
|
|
28
|
+
e.status = extra.status;
|
|
29
|
+
if (extra.eventId !== undefined)
|
|
30
|
+
e.eventId = extra.eventId;
|
|
31
|
+
if (extra.ids !== undefined)
|
|
32
|
+
e.ids = extra.ids;
|
|
33
|
+
return e;
|
|
34
|
+
}
|
|
35
|
+
const CREATE_KEYS = new Set(["title", "start", "end", "allDay", "location", "notes", "profileIds", "labelIds", "calendar"]);
|
|
36
|
+
const TITLE_MAX = 200;
|
|
37
|
+
const LOCATION_MAX = 500;
|
|
38
|
+
const NOTES_MAX = 5000;
|
|
39
|
+
const DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
40
|
+
const LOCAL_TIME = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})$/;
|
|
41
|
+
const ID = /^\d+$/;
|
|
42
|
+
// Control characters other than tab and newline (notes may have line breaks; a title may not).
|
|
43
|
+
// eslint-disable-next-line no-control-regex -- matching control characters is the point
|
|
44
|
+
const CONTROL = /[\u0000-\u0008\u000B-\u001F\u007F]/;
|
|
45
|
+
const EMAIL = /[^\s@<>()"',;:]+@[^\s@<>()"',;:]+\.[^\s@<>()"',;:]+/;
|
|
46
|
+
function realDate(value) {
|
|
47
|
+
const m = DATE.exec(value);
|
|
48
|
+
if (!m)
|
|
49
|
+
return false;
|
|
50
|
+
const t = Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
51
|
+
return new Date(t).toISOString().slice(0, 10) === value;
|
|
52
|
+
}
|
|
53
|
+
/** Epoch ms for a wall-clock time, refusing a time the zone skips (a clock change). */
|
|
54
|
+
function localToEpoch(value, timeZone, field) {
|
|
55
|
+
const m = LOCAL_TIME.exec(value);
|
|
56
|
+
if (!m || !realDate(m[1]) || Number(m[2]) > 23 || Number(m[3]) > 59) {
|
|
57
|
+
throw writeError("invalid_time", `${field} must be a local time YYYY-MM-DDTHH:MM, with no offset or Z.`);
|
|
58
|
+
}
|
|
59
|
+
const epoch = zonedToEpoch(m[1], `${m[2]}:${m[3]}`, timeZone);
|
|
60
|
+
const p = toLocalParts(epoch, timeZone);
|
|
61
|
+
if (dateInZone(epoch, timeZone) !== m[1] || p.hour !== Number(m[2]) || p.minute !== Number(m[3])) {
|
|
62
|
+
throw writeError("invalid_time", `${field} does not exist in ${timeZone} (the clocks change at that time).`);
|
|
63
|
+
}
|
|
64
|
+
return epoch;
|
|
65
|
+
}
|
|
66
|
+
function optionalText(value, field, max) {
|
|
67
|
+
if (value === undefined)
|
|
68
|
+
return null;
|
|
69
|
+
if (typeof value !== "string")
|
|
70
|
+
throw writeError("bad_input", `${field} must be text.`);
|
|
71
|
+
if (CONTROL.test(value))
|
|
72
|
+
throw writeError("bad_input", `${field} contains control characters.`);
|
|
73
|
+
if (value.length > max)
|
|
74
|
+
throw writeError("bad_input", `${field} is longer than ${max} characters.`);
|
|
75
|
+
return value.trim() === "" ? null : value;
|
|
76
|
+
}
|
|
77
|
+
function idList(value, field) {
|
|
78
|
+
if (value === undefined)
|
|
79
|
+
return [];
|
|
80
|
+
if (!Array.isArray(value) || !value.every((v) => typeof v === "string" && ID.test(v))) {
|
|
81
|
+
throw writeError("bad_input", `${field} must be a list of ids (digits), from the library's lists.`);
|
|
82
|
+
}
|
|
83
|
+
if (new Set(value).size !== value.length)
|
|
84
|
+
throw writeError("bad_input", `${field} lists an id twice.`);
|
|
85
|
+
return [...value];
|
|
86
|
+
}
|
|
87
|
+
/** Source calendars with their account link. The included account records hold an email and are never read here. */
|
|
88
|
+
async function sourcesWithAccounts() {
|
|
89
|
+
const response = await getClient().get("/api/frames/{frameId}/source_calendars", { include: "calendar_account" });
|
|
90
|
+
return response.data ?? [];
|
|
91
|
+
}
|
|
92
|
+
/** True when the library can create on this source: a Google calendar this account can write to. */
|
|
93
|
+
export function sourceWritable(cal) {
|
|
94
|
+
const a = cal.attributes;
|
|
95
|
+
return a.kind === "gmail" && a.editable !== false && a.role !== "reader";
|
|
96
|
+
}
|
|
97
|
+
/** The one check behind previewCreate and create. Reads categories and calendars fresh every time. */
|
|
98
|
+
export async function planCreate(input, timeZone) {
|
|
99
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
100
|
+
throw writeError("bad_input", "create needs an object of event fields.");
|
|
101
|
+
const raw = input;
|
|
102
|
+
for (const key of Object.keys(raw)) {
|
|
103
|
+
if (!CREATE_KEYS.has(key))
|
|
104
|
+
throw writeError("bad_input", `Unknown field "${key}".`);
|
|
105
|
+
}
|
|
106
|
+
if (typeof raw.title !== "string" || raw.title.trim() === "")
|
|
107
|
+
throw writeError("invalid_title", "title must be non-empty text.");
|
|
108
|
+
const title = raw.title.trim();
|
|
109
|
+
if (title.length > TITLE_MAX)
|
|
110
|
+
throw writeError("invalid_title", `title is longer than ${TITLE_MAX} characters.`);
|
|
111
|
+
if (/[\r\n]/.test(title) || CONTROL.test(title))
|
|
112
|
+
throw writeError("invalid_title", "title must be one line with no control characters.");
|
|
113
|
+
if (raw.allDay !== undefined && typeof raw.allDay !== "boolean")
|
|
114
|
+
throw writeError("bad_input", "allDay must be true or false.");
|
|
115
|
+
const allDay = raw.allDay === true;
|
|
116
|
+
if (typeof raw.start !== "string")
|
|
117
|
+
throw writeError("invalid_time", "start is required.");
|
|
118
|
+
if (raw.end !== undefined && typeof raw.end !== "string")
|
|
119
|
+
throw writeError("invalid_time", "end must be text.");
|
|
120
|
+
let startSent;
|
|
121
|
+
let endSent;
|
|
122
|
+
let startDate;
|
|
123
|
+
let endDate;
|
|
124
|
+
let startMs;
|
|
125
|
+
let endMs;
|
|
126
|
+
if (allDay) {
|
|
127
|
+
if (!realDate(raw.start))
|
|
128
|
+
throw writeError("invalid_time", "For an all-day event start must be a date, YYYY-MM-DD.");
|
|
129
|
+
if (raw.end !== undefined && !realDate(raw.end))
|
|
130
|
+
throw writeError("invalid_time", "For an all-day event end must be a date, YYYY-MM-DD, or left out.");
|
|
131
|
+
if (raw.end !== undefined && raw.end < raw.start)
|
|
132
|
+
throw writeError("end_before_start", "end is before start.");
|
|
133
|
+
if (raw.end !== undefined && raw.end !== raw.start) {
|
|
134
|
+
throw writeError("unsupported", "An all-day event covers one day: leave end out or give the same date. Multi-day all-day events are not supported yet.");
|
|
135
|
+
}
|
|
136
|
+
startDate = raw.start;
|
|
137
|
+
endDate = raw.start;
|
|
138
|
+
startSent = raw.start;
|
|
139
|
+
endSent = addDays(raw.start, 1); // Skylight's all-day end is the next day (exclusive), as the app sends it
|
|
140
|
+
startMs = zonedToEpoch(startDate, "00:00", timeZone);
|
|
141
|
+
endMs = zonedToEpoch(endSent, "00:00", timeZone);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
if (raw.end === undefined)
|
|
145
|
+
throw writeError("invalid_time", "end is required for a timed event.");
|
|
146
|
+
startMs = localToEpoch(raw.start, timeZone, "start");
|
|
147
|
+
endMs = localToEpoch(raw.end, timeZone, "end");
|
|
148
|
+
if (endMs <= startMs)
|
|
149
|
+
throw writeError("end_before_start", "end must be after start.");
|
|
150
|
+
startSent = isoWithOffset(startMs, timeZone);
|
|
151
|
+
endSent = isoWithOffset(endMs, timeZone);
|
|
152
|
+
startDate = dateInZone(startMs, timeZone);
|
|
153
|
+
endDate = dateInZone(endMs - 1, timeZone);
|
|
154
|
+
}
|
|
155
|
+
const location = optionalText(raw.location, "location", LOCATION_MAX);
|
|
156
|
+
const notes = optionalText(raw.notes, "notes", NOTES_MAX);
|
|
157
|
+
const profileIds = idList(raw.profileIds, "profileIds");
|
|
158
|
+
const labelIds = idList(raw.labelIds, "labelIds");
|
|
159
|
+
if (typeof raw.calendar !== "string" || (raw.calendar !== "skylight" && !ID.test(raw.calendar))) {
|
|
160
|
+
throw writeError("bad_input", 'calendar is required: "skylight", or the id of a Google calendar from calendar.sources().');
|
|
161
|
+
}
|
|
162
|
+
// Fresh reads: a profile, label or calendar removed a minute ago must not be written to.
|
|
163
|
+
const categories = await getCategories(false);
|
|
164
|
+
const byId = new Map(categories.map((c) => [String(c.id), c]));
|
|
165
|
+
const name = (c) => {
|
|
166
|
+
const label = typeof c.attributes.label === "string" ? c.attributes.label : "";
|
|
167
|
+
return EMAIL.test(label) ? "Calendar" : label;
|
|
168
|
+
};
|
|
169
|
+
const badProfiles = profileIds.filter((id) => byId.get(id)?.attributes.linked_to_profile !== true);
|
|
170
|
+
if (badProfiles.length)
|
|
171
|
+
throw writeError("unknown_profile", "Not a profile on this frame: see profiles.list().", { ids: badProfiles });
|
|
172
|
+
const unknownLabels = labelIds.filter((id) => {
|
|
173
|
+
const c = byId.get(id);
|
|
174
|
+
return !c || c.attributes.linked_to_profile === true;
|
|
175
|
+
});
|
|
176
|
+
if (unknownLabels.length)
|
|
177
|
+
throw writeError("unknown_label", "Not a label on this frame: see labels.list().", { ids: unknownLabels });
|
|
178
|
+
const fedLabels = labelIds.filter((id) => (byId.get(id)?.relationships?.source_calendars?.data ?? []).length > 0);
|
|
179
|
+
if (fedLabels.length) {
|
|
180
|
+
throw writeError("label_not_assignable", "A synced calendar writes to this label; Skylight assigns it to that calendar's events itself.", { ids: fedLabels });
|
|
181
|
+
}
|
|
182
|
+
let target = null;
|
|
183
|
+
if (raw.calendar !== "skylight") {
|
|
184
|
+
const cal = (await sourcesWithAccounts()).find((c) => String(c.id) === raw.calendar);
|
|
185
|
+
if (!cal)
|
|
186
|
+
throw writeError("unknown_calendar", "No synced calendar with that id: see calendar.sources().");
|
|
187
|
+
const a = cal.attributes;
|
|
188
|
+
if (!sourceWritable(cal))
|
|
189
|
+
throw writeError("calendar_not_writable", "That calendar is not a Google calendar this account can write to.");
|
|
190
|
+
const sourceId = typeof a.source_id === "string" ? a.source_id : "";
|
|
191
|
+
const account = cal.relationships?.calendar_account?.data?.id;
|
|
192
|
+
if (!sourceId || !((typeof account === "string" && account !== "") || typeof account === "number")) {
|
|
193
|
+
throw writeError("calendar_not_writable", "Skylight did not report that calendar's account, so it cannot be written to.");
|
|
194
|
+
}
|
|
195
|
+
const label = typeof a.label === "string" && !EMAIL.test(a.label) ? a.label : "Google calendar";
|
|
196
|
+
target = { calendarId: sourceId, accountId: account, label, id: String(cal.id) };
|
|
197
|
+
}
|
|
198
|
+
const categoryIds = [...profileIds, ...labelIds];
|
|
199
|
+
const body = {
|
|
200
|
+
summary: title,
|
|
201
|
+
kind: "standard",
|
|
202
|
+
starts_at: startSent,
|
|
203
|
+
ends_at: endSent,
|
|
204
|
+
all_day: allDay,
|
|
205
|
+
timezone: timeZone,
|
|
206
|
+
description: notes ?? "",
|
|
207
|
+
location: location ?? "",
|
|
208
|
+
category_ids: categoryIds,
|
|
209
|
+
...(target ? { calendar_id: target.calendarId, calendar_account_id: target.accountId } : {}),
|
|
210
|
+
};
|
|
211
|
+
const preview = {
|
|
212
|
+
action: "create",
|
|
213
|
+
title,
|
|
214
|
+
start: startSent,
|
|
215
|
+
end: endSent,
|
|
216
|
+
allDay,
|
|
217
|
+
location,
|
|
218
|
+
notes,
|
|
219
|
+
profileIds,
|
|
220
|
+
profiles: profileIds.map((id) => name(byId.get(id))),
|
|
221
|
+
labelIds,
|
|
222
|
+
labels: labelIds.map((id) => name(byId.get(id))),
|
|
223
|
+
calendar: target ? { id: target.id, label: target.label, kind: "google" } : { id: "skylight", label: "Skylight", kind: "skylight" },
|
|
224
|
+
timezone: timeZone,
|
|
225
|
+
};
|
|
226
|
+
return { preview, body, startDate, endDate, startMs, endMs, categoryIds, source: target ? "google" : "skylight" };
|
|
227
|
+
}
|
|
228
|
+
/** Map anything the write itself threw to the library's own error, never Skylight's text. Sign-in errors pass through. */
|
|
229
|
+
function mapWriteFailure(error) {
|
|
230
|
+
const e = error;
|
|
231
|
+
if (e && (e.name === "AuthenticationError" || e.name === "CredentialSaveError"))
|
|
232
|
+
return error;
|
|
233
|
+
const status = typeof e?.statusCode === "number" ? e.statusCode : undefined;
|
|
234
|
+
if (status !== undefined && status >= 400 && status < 500) {
|
|
235
|
+
return writeError("skylight_refused", `Skylight refused the write (HTTP ${status}). Nothing was written.`, { status });
|
|
236
|
+
}
|
|
237
|
+
return writeError("outcome_unknown", "The write was sent but no answer came back (a network error or a Skylight server error). It may or may not have been written: read the calendar before trying again.");
|
|
238
|
+
}
|
|
239
|
+
function sameText(stored, wanted) {
|
|
240
|
+
const s = typeof stored === "string" ? stored : "";
|
|
241
|
+
return s.trim() === (wanted ?? "").trim();
|
|
242
|
+
}
|
|
243
|
+
/** Did Skylight store what was asked? Profiles and labels asked for must all be there; Skylight may add the calendar's own label. */
|
|
244
|
+
function matchesPlan(event, plan, categoryIdsOf) {
|
|
245
|
+
const a = event.attributes;
|
|
246
|
+
if (a.summary !== plan.preview.title)
|
|
247
|
+
return false;
|
|
248
|
+
if ((a.all_day === true) !== plan.preview.allDay)
|
|
249
|
+
return false;
|
|
250
|
+
if (Date.parse(String(a.starts_at)) !== plan.startMs || Date.parse(String(a.ends_at)) !== plan.endMs) {
|
|
251
|
+
// All-day records come back as local midnights with an offset; timed ones as instants. Both are compared as instants.
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
if (!sameText(a.location, plan.preview.location) || !sameText(a.description, plan.preview.notes))
|
|
255
|
+
return false;
|
|
256
|
+
if (a.source !== plan.source)
|
|
257
|
+
return false;
|
|
258
|
+
const stored = new Set(categoryIdsOf(event));
|
|
259
|
+
return plan.categoryIds.every((id) => stored.has(id));
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Create, then read back. Returns the stored record only when the read-back shows every field as
|
|
263
|
+
* asked; otherwise throws `not_confirmed` with the id Skylight gave (the event may still appear:
|
|
264
|
+
* Skylight's list can lag a write).
|
|
265
|
+
*/
|
|
266
|
+
export async function commitCreate(input, timeZone, categoryIdsOf) {
|
|
267
|
+
const plan = await planCreate(input, timeZone);
|
|
268
|
+
let created;
|
|
269
|
+
try {
|
|
270
|
+
created = await createCalendarEvent(plan.body);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
throw mapWriteFailure(error);
|
|
274
|
+
}
|
|
275
|
+
const id = created?.id !== undefined && created?.id !== null ? String(created.id) : "";
|
|
276
|
+
if (!id)
|
|
277
|
+
throw writeError("outcome_unknown", "Skylight accepted the write but did not say which event it created. Read the calendar before trying again.");
|
|
278
|
+
const back = await readBackUntil(() => getCalendarEvents({ dateMin: plan.startDate, dateMax: plan.endDate, timezone: timeZone }), (list) => list.some((e) => String(e.id) === id && matchesPlan(e, plan, categoryIdsOf)));
|
|
279
|
+
const stored = back.value.find((e) => String(e.id) === id);
|
|
280
|
+
if (!back.ok || !stored) {
|
|
281
|
+
throw writeError("not_confirmed", stored
|
|
282
|
+
? "Skylight created the event but reading it back shows different fields from those asked. Read it before changing it."
|
|
283
|
+
: "Skylight accepted the write but the event did not show on reading it back. It may still appear: read the calendar before trying again.", { eventId: id });
|
|
284
|
+
}
|
|
285
|
+
return stored;
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=lib-writes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-writes.js","sourceRoot":"","sources":["../src/lib-writes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA4BtF,MAAM,UAAU,UAAU,CAAC,IAAoB,EAAE,OAAe,EAAE,QAA+D,EAAE;IACjI,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAuB,CAAC;IACnD,CAAC,CAAC,IAAI,GAAG,oBAAoB,CAAC;IAC9B,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;IACd,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,M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AC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CACvF,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,UAAU,CACd,eAAe,EACf,MAAM;YACJ,CAAC,CAAC,qHAAqH;YACvH,CAAC,CAAC,wIAAwI,EAC5I,EAAE,OAAO,EAAE,EAAE,EAAE,CAChB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/lib.d.ts
CHANGED
|
@@ -12,13 +12,16 @@
|
|
|
12
12
|
* - No function takes a URL or a feed address (so the feed-address helper is not exported either).
|
|
13
13
|
* - Importing this module starts nothing and reads nothing from process.argv.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Reads, plus event creation (experimental, stage 1 of event writes): `calendar.previewCreate`
|
|
16
|
+
* and `calendar.create` take identical arguments and share one check (src/lib-writes.ts).
|
|
17
|
+
* Updates, deletes, messages, source-calendar management and login are deliberately not exported.
|
|
17
18
|
*
|
|
18
19
|
* Honest limit: an importer holds a live bearer token and can do whatever the token
|
|
19
20
|
* allows. These guards stop accidents and token leakage, not a malicious importer.
|
|
20
21
|
*/
|
|
21
22
|
import type { CredentialStore } from "./api/credential-types.js";
|
|
23
|
+
import { type CreateEventInput, type CreatePreview } from "./lib-writes.js";
|
|
24
|
+
export type { CreateEventInput, CreatePreview, SkylightWriteError, WriteErrorCode } from "./lib-writes.js";
|
|
22
25
|
export type { CredentialStore };
|
|
23
26
|
/** Where the sign-in comes from: a store that refreshes it, or a fixed token that does not. */
|
|
24
27
|
export type SkylightCredential = CredentialStore | {
|
|
@@ -44,8 +47,14 @@ export interface EventDto {
|
|
|
44
47
|
end: string | null;
|
|
45
48
|
allDay: boolean;
|
|
46
49
|
location: string | null;
|
|
50
|
+
/** Profile names, as `profiles.list()` labels them. */
|
|
47
51
|
profiles: string[];
|
|
52
|
+
/** Label names, as `labels.list()` labels them. Two labels can share a name: use `labelIds` to tell them apart. */
|
|
48
53
|
labels: string[];
|
|
54
|
+
/** Ids of `profiles`, same order. Match these against `profiles.list()` ids. */
|
|
55
|
+
profileIds: string[];
|
|
56
|
+
/** Ids of `labels`, same order. Match these against `labels.list()` ids. */
|
|
57
|
+
labelIds: string[];
|
|
49
58
|
recurring: boolean;
|
|
50
59
|
seriesId: string | null;
|
|
51
60
|
editable: boolean;
|
|
@@ -60,12 +69,25 @@ export interface SourceDto {
|
|
|
60
69
|
editable: boolean;
|
|
61
70
|
/** Scheme and host of a subscription feed only; null otherwise. */
|
|
62
71
|
host: string | null;
|
|
72
|
+
/** True when `calendar.create` can write to it: a Google calendar this account can edit. */
|
|
73
|
+
writable: boolean;
|
|
63
74
|
}
|
|
64
75
|
export interface ProfileDto {
|
|
65
76
|
id: string;
|
|
66
77
|
label: string;
|
|
67
78
|
color: string | null;
|
|
68
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* A label: a category that is not a profile (a feed, a holiday calendar, a team). Same shape as
|
|
82
|
+
* ProfileDto. `color` is the string Skylight stores, or null. Seen live: six-digit hex with a "#",
|
|
83
|
+
* in either case ("#2178AF", "#fdb305"), including colours outside the app's palette. Treat it as untrusted text and validate before using it as a style.
|
|
84
|
+
* `label` is an email-shaped name replaced by "Calendar", exactly as in `EventDto.labels`.
|
|
85
|
+
*/
|
|
86
|
+
export interface LabelDto {
|
|
87
|
+
id: string;
|
|
88
|
+
label: string;
|
|
89
|
+
color: string | null;
|
|
90
|
+
}
|
|
69
91
|
export interface ChoreDto {
|
|
70
92
|
id: string;
|
|
71
93
|
title: string;
|
|
@@ -115,10 +137,22 @@ export interface Skylight {
|
|
|
115
137
|
to: string;
|
|
116
138
|
}): Promise<EventDto[]>;
|
|
117
139
|
sources(): Promise<SourceDto[]>;
|
|
140
|
+
/** Check a new event and return exactly what `create` would write. Changes nothing. */
|
|
141
|
+
previewCreate(input: CreateEventInput): Promise<CreatePreview>;
|
|
142
|
+
/**
|
|
143
|
+
* Re-run the same check against fresh reads, write, then read back. Resolves with the event as
|
|
144
|
+
* Skylight stored it, only when the read-back shows every field as asked. Throws an Error with
|
|
145
|
+
* `name` "SkylightWriteError" and a `code` otherwise (see CreateEventInput and README).
|
|
146
|
+
*/
|
|
147
|
+
create(input: CreateEventInput): Promise<EventDto>;
|
|
118
148
|
};
|
|
119
149
|
profiles: {
|
|
120
150
|
list(): Promise<ProfileDto[]>;
|
|
121
151
|
};
|
|
152
|
+
/** Every label (category not linked to a profile), in Skylight's order, including labels no event uses. */
|
|
153
|
+
labels: {
|
|
154
|
+
list(): Promise<LabelDto[]>;
|
|
155
|
+
};
|
|
122
156
|
/**
|
|
123
157
|
* Chores for one day (`date`) or a range (`from` and `to`, both included, at most 31 days).
|
|
124
158
|
* Pass one or the other, not both. A repeating chore appears once per day it falls on; `date`
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAWjE,OAAO,EAA4C,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEtH,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,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,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;QACzE,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QAChC,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;KAC1C,CAAC;IACF,KAAK,EAAE;QACL,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;KAC/C,CAAC;CACH;AA2JD,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,QAAQ,CA2HvE"}
|
package/dist/lib.js
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* - No function takes a URL or a feed address (so the feed-address helper is not exported either).
|
|
13
13
|
* - Importing this module starts nothing and reads nothing from process.argv.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Reads, plus event creation (experimental, stage 1 of event writes): `calendar.previewCreate`
|
|
16
|
+
* and `calendar.create` take identical arguments and share one check (src/lib-writes.ts).
|
|
17
|
+
* Updates, deletes, messages, source-calendar management and login are deliberately not exported.
|
|
17
18
|
*
|
|
18
19
|
* Honest limit: an importer holds a live bearer token and can do whatever the token
|
|
19
20
|
* allows. These guards stop accidents and token leakage, not a malicious importer.
|
|
@@ -28,6 +29,7 @@ import { getMealCategories, getMealSittings, getRecipes, mealCategoryName } from
|
|
|
28
29
|
import { isChoreDone, parseOccurrenceId } from "./api/endpoints/chores.js";
|
|
29
30
|
import { addDays } from "./utils/schedule.js";
|
|
30
31
|
import { redactFeedUrl } from "./utils/redact.js";
|
|
32
|
+
import { commitCreate, planCreate, sourceWritable } from "./lib-writes.js";
|
|
31
33
|
// ---------------------------------------------------------------------------
|
|
32
34
|
// Validation: refuse, never ignore.
|
|
33
35
|
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -97,16 +99,30 @@ function categoryIds(event) {
|
|
|
97
99
|
return [...ids];
|
|
98
100
|
}
|
|
99
101
|
const str = (v) => (typeof v === "string" && v !== "" ? v : null);
|
|
102
|
+
/** A category's name as it leaves the library: an email-shaped name is replaced, so no address escapes. */
|
|
103
|
+
function categoryName(c) {
|
|
104
|
+
const label = str(c?.attributes.label);
|
|
105
|
+
return label !== null && EMAIL.test(label) ? "Calendar" : label;
|
|
106
|
+
}
|
|
100
107
|
function toEvent(event, categories) {
|
|
101
108
|
const a = event.attributes;
|
|
102
109
|
const profiles = [];
|
|
103
110
|
const labels = [];
|
|
111
|
+
const profileIds = [];
|
|
112
|
+
const labelIds = [];
|
|
104
113
|
for (const id of categoryIds(event)) {
|
|
105
114
|
const c = categories.get(id);
|
|
106
|
-
const label =
|
|
115
|
+
const label = categoryName(c);
|
|
107
116
|
if (!c || !label)
|
|
108
117
|
continue;
|
|
109
|
-
(c.attributes.linked_to_profile === true
|
|
118
|
+
if (c.attributes.linked_to_profile === true) {
|
|
119
|
+
profiles.push(label);
|
|
120
|
+
profileIds.push(String(c.id));
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
labels.push(label);
|
|
124
|
+
labelIds.push(String(c.id));
|
|
125
|
+
}
|
|
110
126
|
}
|
|
111
127
|
const id = String(event.id);
|
|
112
128
|
const composite = /^(\d+)-\d+$/.exec(id);
|
|
@@ -120,6 +136,8 @@ function toEvent(event, categories) {
|
|
|
120
136
|
location: str(a.location),
|
|
121
137
|
profiles,
|
|
122
138
|
labels,
|
|
139
|
+
profileIds,
|
|
140
|
+
labelIds,
|
|
123
141
|
recurring: a.recurring === true || a.recurring_config === true,
|
|
124
142
|
seriesId: composite ? composite[1] : null,
|
|
125
143
|
editable: a.editable !== false,
|
|
@@ -141,6 +159,7 @@ function toSource(cal) {
|
|
|
141
159
|
role: str(a.role),
|
|
142
160
|
editable: a.editable === true,
|
|
143
161
|
host: hostMatch ? hostMatch[1] : null,
|
|
162
|
+
writable: sourceWritable(cal),
|
|
144
163
|
};
|
|
145
164
|
}
|
|
146
165
|
function toChore(chore, names) {
|
|
@@ -180,11 +199,22 @@ export function createSkylight(options) {
|
|
|
180
199
|
return events.map((e) => toEvent(e, byId));
|
|
181
200
|
}),
|
|
182
201
|
sources: () => run(async () => (await getSourceCalendars()).map(toSource)),
|
|
202
|
+
previewCreate: (input) => run(async () => (await planCreate(input, config.timezone)).preview),
|
|
203
|
+
create: (input) => run(async () => {
|
|
204
|
+
const stored = await commitCreate(input, config.timezone, categoryIds);
|
|
205
|
+
const byId = new Map((await getCategories()).map((c) => [String(c.id), c]));
|
|
206
|
+
return toEvent(stored, byId);
|
|
207
|
+
}),
|
|
183
208
|
},
|
|
184
209
|
profiles: {
|
|
185
210
|
list: () => run(async () => (await getCategories())
|
|
186
|
-
.filter((c) => c.attributes.linked_to_profile === true &&
|
|
187
|
-
.map((c) => ({ id: String(c.id), label: c
|
|
211
|
+
.filter((c) => c.attributes.linked_to_profile === true && categoryName(c))
|
|
212
|
+
.map((c) => ({ id: String(c.id), label: categoryName(c), color: str(c.attributes.color) }))),
|
|
213
|
+
},
|
|
214
|
+
labels: {
|
|
215
|
+
list: () => run(async () => (await getCategories())
|
|
216
|
+
.filter((c) => c.attributes.linked_to_profile !== true && categoryName(c))
|
|
217
|
+
.map((c) => ({ id: String(c.id), label: categoryName(c), color: str(c.attributes.color) }))),
|
|
188
218
|
},
|
|
189
219
|
chores: {
|
|
190
220
|
list: (opts) => run(async () => {
|
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE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AE,EAAE,CAChB,GAAG,CAAC,KAAK,IAAI,EAAE;gBACb,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;gBAC9G,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBACjD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACvB,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;oBAChB,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE;oBACpC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,WAAW;oBACzC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;iBACnC,CAAC,CAAC,CAAC;YACN,CAAC,CAAC;SACL;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@davidwoods/skylight-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Unofficial MCP server for Skylight Calendar: local (stdio) and hosted (Cloudflare Workers), with browser-paste OAuth sign-in and an encrypted credential store",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/lib.js",
|