@1agents/dsh-plugin-todo 0.1.0 → 0.1.1
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
CHANGED
|
@@ -23,7 +23,7 @@ npm test
|
|
|
23
23
|
前提:Apple 芯片的 macOS、Node.js 20 或以上、已安装的 DeepSeek Harness。提醒事项和日历只在这台 Mac 上读写。当前发布的原生程序是 arm64,Intel Mac 不能安装。
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
dsh plugin --profile web add @1agents/dsh-plugin-todo@0.1.
|
|
26
|
+
dsh plugin --profile web add @1agents/dsh-plugin-todo@0.1.1
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
装完后重启 DSH。左侧栏「历史会话」上方出现「日程」。Host 启动时会把 MCP 登记到 `127.0.0.1:36908`。网关没在跑时,页面仍可用,Agent 搜索不到工具。当前这个对话窗口走的是 desktop profile;要在 `dsh web`(默认 `http://127.0.0.1:3080`)里看到,安装目标是 web profile。
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
<key>CFBundlePackageType</key>
|
|
14
14
|
<string>APPL</string>
|
|
15
15
|
<key>CFBundleVersion</key>
|
|
16
|
-
<string>0.1.
|
|
16
|
+
<string>0.1.1</string>
|
|
17
17
|
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>0.1.
|
|
18
|
+
<string>0.1.1</string>
|
|
19
19
|
<key>LSUIElement</key>
|
|
20
20
|
<true/>
|
|
21
21
|
<key>NSCalendarsUsageDescription</key>
|
|
Binary file
|
package/dist/client.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_react = require("react");
|
|
|
30
30
|
var SERVICE = "iosAgenda";
|
|
31
31
|
var PACKAGE = "@1agents/dsh-plugin-todo";
|
|
32
32
|
var PANEL_ID = "ios-agenda";
|
|
33
|
-
var METHODS = ["snapshot", "createReminder", "completeReminder", "deleteReminder", "createEvent", "deleteEvent"];
|
|
33
|
+
var METHODS = ["authorize", "snapshot", "createReminder", "completeReminder", "deleteReminder", "createEvent", "deleteEvent"];
|
|
34
34
|
function objectOf(value) {
|
|
35
35
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
36
36
|
return value;
|
|
@@ -77,6 +77,14 @@ var zh = {
|
|
|
77
77
|
complete: "\u5B8C\u6210",
|
|
78
78
|
remove: "\u5220\u9664",
|
|
79
79
|
permission: "\u9700\u8981\u5728\u7CFB\u7EDF\u8BBE\u7F6E\u91CC\u5141\u8BB8 IosAgenda.app\uFF08work.1agents.ios-agenda\uFF09\u8BBF\u95EE\u63D0\u9192\u4E8B\u9879\u548C\u65E5\u5386\u3002",
|
|
80
|
+
authorize: "\u6388\u6743",
|
|
81
|
+
openSettings: "\u6253\u5F00\u7CFB\u7EDF\u8BBE\u7F6E",
|
|
82
|
+
authTitle: "\u9700\u8981\u8BBF\u95EE\u63D0\u9192\u4E8B\u9879\u548C\u65E5\u5386",
|
|
83
|
+
authBody: "\u70B9\u6388\u6743\u540E\u4F1A\u5F39\u51FA\u7CFB\u7EDF\u8BF7\u6C42\u3002\u5982\u679C\u4E4B\u524D\u62D2\u7EDD\u8FC7\uFF0C\u4F1A\u6253\u5F00\u7CFB\u7EDF\u8BBE\u7F6E\u91CC\u7684\u5BF9\u5E94\u5F00\u5173\u3002",
|
|
84
|
+
authGranted: "\u5DF2\u5141\u8BB8",
|
|
85
|
+
authNeeded: "\u672A\u5141\u8BB8",
|
|
86
|
+
authSettings: "\u7CFB\u7EDF\u8BBE\u7F6E\u5DF2\u6253\u5F00\u3002\u6253\u5F00\u5F00\u5173\u540E\u70B9\u5237\u65B0\u3002",
|
|
87
|
+
reminders: "\u63D0\u9192\u4E8B\u9879",
|
|
80
88
|
allDay: "\u5168\u5929",
|
|
81
89
|
continues: "\u7EED",
|
|
82
90
|
overdue: "\u903E\u671F",
|
|
@@ -104,6 +112,14 @@ var en = {
|
|
|
104
112
|
complete: "Complete",
|
|
105
113
|
remove: "Delete",
|
|
106
114
|
permission: "Allow IosAgenda.app (work.1agents.ios-agenda) to access Reminders and Calendar in System Settings.",
|
|
115
|
+
authorize: "Allow access",
|
|
116
|
+
openSettings: "Open System Settings",
|
|
117
|
+
authTitle: "Reminders and Calendar access",
|
|
118
|
+
authBody: "Allow access to show the system prompt. If access was denied, this opens the matching switch in System Settings.",
|
|
119
|
+
authGranted: "Allowed",
|
|
120
|
+
authNeeded: "Not allowed",
|
|
121
|
+
authSettings: "System Settings is open. Turn the switch on, then refresh.",
|
|
122
|
+
reminders: "Reminders",
|
|
107
123
|
allDay: "All day",
|
|
108
124
|
continues: "Continues",
|
|
109
125
|
overdue: "Overdue",
|
|
@@ -140,6 +156,12 @@ function readViewPreference() {
|
|
|
140
156
|
return empty;
|
|
141
157
|
}
|
|
142
158
|
}
|
|
159
|
+
function accessGranted(status) {
|
|
160
|
+
return status === "fullAccess" || status === "authorized";
|
|
161
|
+
}
|
|
162
|
+
function accessBlocked(status) {
|
|
163
|
+
return status === "denied" || status === "restricted" || status === "writeOnly";
|
|
164
|
+
}
|
|
143
165
|
function soleAccent(colors) {
|
|
144
166
|
const unique = new Set(colors.filter(Boolean));
|
|
145
167
|
return unique.size === 1 ? [...unique][0] : "";
|
|
@@ -482,6 +504,7 @@ function AgendaPage({ t, agenda }) {
|
|
|
482
504
|
const [data, setData] = (0, import_react.useState)(null);
|
|
483
505
|
const [loadedKey, setLoadedKey] = (0, import_react.useState)("");
|
|
484
506
|
const [error, setError] = (0, import_react.useState)("");
|
|
507
|
+
const [auth, setAuth] = (0, import_react.useState)(null);
|
|
485
508
|
const [busy, setBusy] = (0, import_react.useState)(false);
|
|
486
509
|
const [revision, setRevision] = (0, import_react.useState)(0);
|
|
487
510
|
const [hiddenLists, setHiddenLists] = (0, import_react.useState)(() => new Set(viewPreference.hiddenLists));
|
|
@@ -504,9 +527,20 @@ function AgendaPage({ t, agenda }) {
|
|
|
504
527
|
if (!active || requestId !== requestRef.current) return;
|
|
505
528
|
setBusy(false);
|
|
506
529
|
if (!result.ok) {
|
|
507
|
-
|
|
530
|
+
if (result.error?.code === "ACCESS_DENIED") {
|
|
531
|
+
setAuth({
|
|
532
|
+
reminders: result.error.access?.reminders || "notDetermined",
|
|
533
|
+
events: result.error.access?.events || "notDetermined",
|
|
534
|
+
openedSettings: false
|
|
535
|
+
});
|
|
536
|
+
setError("");
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
setAuth(null);
|
|
540
|
+
setError(result.error?.message || t("unavailable"));
|
|
508
541
|
return;
|
|
509
542
|
}
|
|
543
|
+
setAuth(null);
|
|
510
544
|
setError("");
|
|
511
545
|
setData(result.data);
|
|
512
546
|
setLoadedKey(range.key);
|
|
@@ -526,6 +560,26 @@ function AgendaPage({ t, agenda }) {
|
|
|
526
560
|
} catch {
|
|
527
561
|
}
|
|
528
562
|
}, [mode, hiddenLists, hiddenCalendars]);
|
|
563
|
+
async function authorize() {
|
|
564
|
+
setBusy(true);
|
|
565
|
+
const result = await invoke(agenda, "authorize", {});
|
|
566
|
+
setBusy(false);
|
|
567
|
+
if (!result.ok) {
|
|
568
|
+
setError(result.error?.message || t("unavailable"));
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
const report = result.data?.access ?? {};
|
|
572
|
+
if (result.data?.granted) {
|
|
573
|
+
setAuth(null);
|
|
574
|
+
setRevision((value) => value + 1);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
setAuth({
|
|
578
|
+
reminders: report.reminders || "notDetermined",
|
|
579
|
+
events: report.events || "notDetermined",
|
|
580
|
+
openedSettings: Boolean(result.data?.openedSettings)
|
|
581
|
+
});
|
|
582
|
+
}
|
|
529
583
|
function selectDay(date) {
|
|
530
584
|
const day = startOfDay(date);
|
|
531
585
|
setCursor(day);
|
|
@@ -683,12 +737,26 @@ function AgendaPage({ t, agenda }) {
|
|
|
683
737
|
] }),
|
|
684
738
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "ia-refresh", onClick: () => setRevision((value) => value + 1), disabled: busy, children: t("refresh") })
|
|
685
739
|
] }),
|
|
740
|
+
auth && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "ia-auth", children: [
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("authTitle") }),
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("authBody") }),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ia-auth-row", children: [
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("reminders") }),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: accessGranted(auth.reminders) ? t("authGranted") : t("authNeeded") })
|
|
746
|
+
] }),
|
|
747
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ia-auth-row", children: [
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("calendars") }),
|
|
749
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: accessGranted(auth.events) ? t("authGranted") : t("authNeeded") })
|
|
750
|
+
] }),
|
|
751
|
+
auth.openedSettings && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "ia-auth-hint", children: t("authSettings") }),
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: authorize, disabled: busy, children: accessBlocked(auth.reminders) || accessBlocked(auth.events) ? t("openSettings") : t("authorize") })
|
|
753
|
+
] }),
|
|
686
754
|
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "ios-agenda-error", role: "alert", children: error }),
|
|
687
|
-
!ready && !error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "ios-agenda-muted", children: t("loading") }),
|
|
688
|
-
ready && mode === "day" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: "ia-day-list", children: dayList.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgendaBlocks, { blocks: dayList, overdueIds, listColors, calendarColors, t, busy, onComplete: (id) => submit("completeReminder", { id, completed: true }, () => {
|
|
755
|
+
!ready && !error && !auth && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "ios-agenda-muted", children: t("loading") }),
|
|
756
|
+
ready && !auth && mode === "day" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: "ia-day-list", children: dayList.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgendaBlocks, { blocks: dayList, overdueIds, listColors, calendarColors, t, busy, onComplete: (id) => submit("completeReminder", { id, completed: true }, () => {
|
|
689
757
|
}), onDelete: (method, id) => submit(method, { id }, () => {
|
|
690
758
|
}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "ios-agenda-muted", children: t("emptyDay") }) }),
|
|
691
|
-
ready && mode === "week" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ia-week-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ia-week", children: weekDays.map((day) => {
|
|
759
|
+
ready && !auth && mode === "week" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ia-week-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ia-week", children: weekDays.map((day) => {
|
|
692
760
|
const blocks = dayBlocks(day, events, reminders);
|
|
693
761
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: sameDay(day, cursor) ? "ia-week-col is-selected" : "ia-week-col", children: [
|
|
694
762
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: sameDay(day, today) ? "ia-week-head is-today" : "ia-week-head", onClick: () => selectDay(day), children: [
|
|
@@ -700,7 +768,7 @@ function AgendaPage({ t, agenda }) {
|
|
|
700
768
|
}) })
|
|
701
769
|
] }, dayKey(day));
|
|
702
770
|
}) }) }),
|
|
703
|
-
ready && overdueItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "ia-group", ref: overdueRef, children: [
|
|
771
|
+
ready && !auth && overdueItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "ia-group", ref: overdueRef, children: [
|
|
704
772
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("overdue") }),
|
|
705
773
|
overdueItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
706
774
|
AgendaRow,
|
|
@@ -721,7 +789,7 @@ function AgendaPage({ t, agenda }) {
|
|
|
721
789
|
`overdue:${item.id}`
|
|
722
790
|
))
|
|
723
791
|
] }),
|
|
724
|
-
ready && undatedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "ia-group", ref: undatedRef, children: [
|
|
792
|
+
ready && !auth && undatedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "ia-group", ref: undatedRef, children: [
|
|
725
793
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: t("undated") }),
|
|
726
794
|
undatedItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
727
795
|
AgendaRow,
|
|
@@ -742,7 +810,7 @@ function AgendaPage({ t, agenda }) {
|
|
|
742
810
|
))
|
|
743
811
|
] })
|
|
744
812
|
] }),
|
|
745
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "ia-composer", onSubmit: (event) => {
|
|
813
|
+
!auth && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "ia-composer", onSubmit: (event) => {
|
|
746
814
|
event.preventDefault();
|
|
747
815
|
if (!reminderTitle.trim()) return;
|
|
748
816
|
submit("createReminder", { title: reminderTitle.trim() }, () => setReminderTitle(""));
|
|
@@ -751,7 +819,7 @@ function AgendaPage({ t, agenda }) {
|
|
|
751
819
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "submit", disabled: busy || !reminderTitle.trim(), children: t("add") }),
|
|
752
820
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => eventOpen ? setEventOpen(false) : openEvent(), children: t("newEvent") })
|
|
753
821
|
] }),
|
|
754
|
-
eventOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "ia-event-form", onSubmit: (event) => {
|
|
822
|
+
!auth && eventOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "ia-event-form", onSubmit: (event) => {
|
|
755
823
|
event.preventDefault();
|
|
756
824
|
if (!eventTitle.trim() || !eventStart || !eventEnd) return;
|
|
757
825
|
submit("createEvent", {
|
|
@@ -850,6 +918,11 @@ var css = `
|
|
|
850
918
|
.ia-composer { border-top: 1px solid var(--dsw-alias-border-default); }
|
|
851
919
|
.ia-event-form { padding-top: 0; padding-bottom: 14px; }
|
|
852
920
|
.ia-composer input, .ia-event-form input { flex: 1; min-width: 0; border: 1px solid var(--dsw-alias-border-default); background: var(--dsw-alias-bg-layer-1); border-radius: 8px; padding: 8px 10px; }
|
|
921
|
+
.ia-auth { max-width: 440px; margin: 12px 0 20px; padding: 16px; border: 1px solid var(--dsw-alias-border-default); border-radius: 12px; background: var(--dsw-alias-bg-layer-1); }
|
|
922
|
+
.ia-auth h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
|
|
923
|
+
.ia-auth p, .ia-auth-hint { margin: 0 0 12px; color: var(--dsw-alias-label-secondary); }
|
|
924
|
+
.ia-auth-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
|
|
925
|
+
.ia-auth button { margin-top: 8px; border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; background: var(--dsw-alias-state-business-primary); color: var(--dsw-alias-bg-base); }
|
|
853
926
|
.ios-agenda-error { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }
|
|
854
927
|
.ios-agenda input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--dsw-alias-state-business-primary); }
|
|
855
928
|
.ia-filter-row input[type="checkbox"] { flex: none; accent-color: var(--ia-swatch, var(--dsw-alias-state-business-primary)); }
|
package/dist/host.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/contract.js
|
|
2
2
|
var SERVICE = "iosAgenda";
|
|
3
3
|
var PACKAGE = "@1agents/dsh-plugin-todo";
|
|
4
|
-
var METHODS = ["snapshot", "createReminder", "completeReminder", "deleteReminder", "createEvent", "deleteEvent"];
|
|
4
|
+
var METHODS = ["authorize", "snapshot", "createReminder", "completeReminder", "deleteReminder", "createEvent", "deleteEvent"];
|
|
5
5
|
function objectOf(value) {
|
|
6
6
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
7
7
|
return value;
|
|
@@ -57,7 +57,7 @@ async function callNative(binary2, method, input = {}, signal) {
|
|
|
57
57
|
const timer = setTimeout(() => {
|
|
58
58
|
child.kill("SIGTERM");
|
|
59
59
|
finish({ ok: false, error: { code: "TIMEOUT", message: "\u8BFB\u53D6\u65E5\u5386\u6216\u63D0\u9192\u4E8B\u9879\u8D85\u65F6\u3002\u5982\u679C\u7CFB\u7EDF\u6B63\u5728\u8BE2\u95EE\u6743\u9650\uFF0C\u5141\u8BB8\u540E\u518D\u8BD5\u3002" } });
|
|
60
|
-
}, 2e4);
|
|
60
|
+
}, method === "authorize" || method === "snapshot" ? 12e4 : 2e4);
|
|
61
61
|
child.stdout.setEncoding("utf8");
|
|
62
62
|
child.stderr.setEncoding("utf8");
|
|
63
63
|
child.stdout.on("data", (chunk) => {
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agents/dsh-plugin-todo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "管理本机已同步的系统提醒事项和日历。页面在 DSH,工具在 dreammate-node MCP。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"os": [
|
|
8
|
-
|
|
7
|
+
"os": [
|
|
8
|
+
"darwin"
|
|
9
|
+
],
|
|
10
|
+
"cpu": [
|
|
11
|
+
"arm64"
|
|
12
|
+
],
|
|
9
13
|
"repository": {
|
|
10
14
|
"type": "git",
|
|
11
15
|
"url": "git+https://github.com/scottzx/DSH-Plugin-Todo.git"
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
"registry": "https://registry.npmjs.org/"
|
|
20
24
|
},
|
|
21
25
|
"bin": {
|
|
22
|
-
"ios-agenda": "
|
|
26
|
+
"ios-agenda": "bin/ios-agenda.mjs"
|
|
23
27
|
},
|
|
24
28
|
"exports": {
|
|
25
29
|
".": "./dist/host.js",
|
|
@@ -15,6 +15,6 @@ dreammate-node cli inspect --agent http://127.0.0.1:36908 --service mcp-ios-agen
|
|
|
15
15
|
dreammate-node cli invoke --agent http://127.0.0.1:36908 --service mcp-ios-agenda --method agenda_snapshot --params '{}'
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
方法以 inspect 返回的 Schema 为准。常用的是 `agenda_snapshot`、`agenda_create_reminder`、`agenda_complete_reminder`、`agenda_create_event
|
|
18
|
+
方法以 inspect 返回的 Schema 为准。常用的是 `agenda_snapshot`、`agenda_create_reminder`、`agenda_complete_reminder`、`agenda_create_event`。没有访问权限时先调用 `agenda_authorize`:还没决定会弹出系统授权框,已经被拒绝会打开系统设置。写入后不会立刻出现在手机上,要等 iCloud 同步。
|
|
19
19
|
|
|
20
20
|
没有来源时,先在插件仓库执行 `npm run build`,再由 DSH 启用插件,或手动 `dreammate-node mcp add`。来源范围是 `local`。
|