@elizaos/plugin-simple-views 2.0.3-beta.5
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/LICENSE +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +184 -0
- package/dist/plugin.js.map +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +26 -0
- package/dist/register.js.map +1 -0
- package/dist/routes.d.ts +3 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +64 -0
- package/dist/routes.js.map +1 -0
- package/dist/simple-views-view-bundle.d.ts +2 -0
- package/dist/simple-views-view-bundle.d.ts.map +1 -0
- package/dist/simple-views-view-bundle.js +6 -0
- package/dist/simple-views-view-bundle.js.map +1 -0
- package/dist/simple-views.interact.d.ts +9 -0
- package/dist/simple-views.interact.d.ts.map +1 -0
- package/dist/simple-views.interact.js +230 -0
- package/dist/simple-views.interact.js.map +1 -0
- package/dist/storage.d.ts +44 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +179 -0
- package/dist/storage.js.map +1 -0
- package/dist/ui.d.ts +3 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +1041 -0
- package/dist/ui.js.map +1 -0
- package/dist/views/bundle.js +1159 -0
- package/dist/views/bundle.js.map +1 -0
- package/package.json +115 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAC9E,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { simpleViewsPlugin, simpleViewsPlugin as default } from \"./plugin.js\";\nexport type {\n SimpleCalendarEvent,\n SimpleViewsSnapshot,\n StickyColor,\n StickyNote,\n} from \"./storage.js\";\n"],"mappings":"AAAA,SAAS,mBAAwC,qBAArBA,0BAAoC;","names":["simpleViewsPlugin"]}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAkI5D,eAAO,MAAM,iBAAiB,EAAE,MA0D/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { simpleViewsRoutes } from "./routes.js";
|
|
2
|
+
import { interact } from "./simple-views.interact.js";
|
|
3
|
+
const AGENT_SURFACE_CAPABILITIES = [
|
|
4
|
+
{
|
|
5
|
+
id: "list-elements",
|
|
6
|
+
description: "List addressable controls, cards, inputs, and regions in the mounted view."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: "get-agent-state",
|
|
10
|
+
description: "Return the mounted view's agent-surface state and element snapshot."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "describe-element",
|
|
14
|
+
description: "Describe one mounted view element by stable id.",
|
|
15
|
+
params: {
|
|
16
|
+
id: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Stable agent element id.",
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "agent-click",
|
|
25
|
+
description: "Click or activate one mounted view element by stable id.",
|
|
26
|
+
params: {
|
|
27
|
+
id: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Stable agent element id.",
|
|
30
|
+
required: true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "agent-fill",
|
|
36
|
+
description: "Fill one mounted view input or textarea by stable id.",
|
|
37
|
+
params: {
|
|
38
|
+
id: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Stable agent element id.",
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Text value to enter.",
|
|
46
|
+
required: true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
const NOTES_CAPABILITIES = [
|
|
52
|
+
...AGENT_SURFACE_CAPABILITIES,
|
|
53
|
+
{
|
|
54
|
+
id: "get-notes",
|
|
55
|
+
description: "Return all sticky notes as structured data."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "create-note",
|
|
59
|
+
description: "Create a sticky note without needing to drive the form.",
|
|
60
|
+
params: {
|
|
61
|
+
title: { type: "string", description: "Note title." },
|
|
62
|
+
body: { type: "string", description: "Note body." },
|
|
63
|
+
color: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Sticky color: yellow, green, rose, or slate."
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "delete-note",
|
|
71
|
+
description: "Delete one sticky note by id, exact title, or search query.",
|
|
72
|
+
params: {
|
|
73
|
+
id: { type: "string", description: "Note id." },
|
|
74
|
+
title: { type: "string", description: "Exact note title." },
|
|
75
|
+
query: { type: "string", description: "Title/body search query." },
|
|
76
|
+
name: { type: "string", description: "Alias for title or query." }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "clear-notes",
|
|
81
|
+
description: "Clear all sticky notes from storage."
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
const CALENDAR_CAPABILITIES = [
|
|
85
|
+
...AGENT_SURFACE_CAPABILITIES,
|
|
86
|
+
{
|
|
87
|
+
id: "get-calendar-state",
|
|
88
|
+
description: "Return selected date and all simple calendar events as structured data."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "select-calendar-date",
|
|
92
|
+
description: "Select a calendar date by ISO day.",
|
|
93
|
+
params: {
|
|
94
|
+
date: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Date in YYYY-MM-DD format.",
|
|
97
|
+
required: true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "create-calendar-event",
|
|
103
|
+
description: "Create a simple calendar event without driving the form.",
|
|
104
|
+
params: {
|
|
105
|
+
title: { type: "string", description: "Event title.", required: true },
|
|
106
|
+
date: { type: "string", description: "Date in YYYY-MM-DD format." },
|
|
107
|
+
time: { type: "string", description: "Time label, for example 09:00." },
|
|
108
|
+
notes: { type: "string", description: "Event notes." },
|
|
109
|
+
color: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Event color: yellow, green, rose, or slate."
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "delete-calendar-event",
|
|
117
|
+
description: "Delete one simple calendar event by id.",
|
|
118
|
+
params: {
|
|
119
|
+
id: { type: "string", description: "Event id.", required: true }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
const simpleViewsPlugin = {
|
|
124
|
+
name: "@elizaos/plugin-simple-views",
|
|
125
|
+
description: "Agent-drivable Notes and Simple Calendar app views for view switching, split-pane, and capability QA.",
|
|
126
|
+
routes: simpleViewsRoutes,
|
|
127
|
+
views: [
|
|
128
|
+
{
|
|
129
|
+
id: "notes",
|
|
130
|
+
label: "Notes",
|
|
131
|
+
description: "Simple sticky notes wall. The agent can create, read, delete, fill fields, and click stable controls.",
|
|
132
|
+
icon: "StickyNote",
|
|
133
|
+
path: "/notes",
|
|
134
|
+
order: 920,
|
|
135
|
+
viewKind: "developer",
|
|
136
|
+
modalities: ["gui", "xr"],
|
|
137
|
+
tags: [
|
|
138
|
+
"notes",
|
|
139
|
+
"notepad",
|
|
140
|
+
"sticky notes",
|
|
141
|
+
"scratchpad",
|
|
142
|
+
"qa",
|
|
143
|
+
"agent-drivable"
|
|
144
|
+
],
|
|
145
|
+
bundlePath: "dist/views/bundle.js",
|
|
146
|
+
componentExport: "NotesView",
|
|
147
|
+
visibleInManager: true,
|
|
148
|
+
desktopTabEnabled: true,
|
|
149
|
+
capabilities: NOTES_CAPABILITIES,
|
|
150
|
+
serverInteract: interact
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "simple-calendar",
|
|
154
|
+
label: "Simple Calendar",
|
|
155
|
+
description: "Simple local calendar for view switching QA. The production Calendar view remains the main user calendar.",
|
|
156
|
+
icon: "CalendarDays",
|
|
157
|
+
path: "/simple-calendar",
|
|
158
|
+
order: 921,
|
|
159
|
+
viewKind: "developer",
|
|
160
|
+
modalities: ["gui", "xr"],
|
|
161
|
+
tags: [
|
|
162
|
+
"calendar",
|
|
163
|
+
"calender",
|
|
164
|
+
"schedule",
|
|
165
|
+
"events",
|
|
166
|
+
"planner",
|
|
167
|
+
"qa",
|
|
168
|
+
"agent-drivable"
|
|
169
|
+
],
|
|
170
|
+
bundlePath: "dist/views/bundle.js",
|
|
171
|
+
componentExport: "SimpleCalendarView",
|
|
172
|
+
visibleInManager: true,
|
|
173
|
+
desktopTabEnabled: true,
|
|
174
|
+
capabilities: CALENDAR_CAPABILITIES,
|
|
175
|
+
serverInteract: interact
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
};
|
|
179
|
+
var plugin_default = simpleViewsPlugin;
|
|
180
|
+
export {
|
|
181
|
+
plugin_default as default,
|
|
182
|
+
simpleViewsPlugin
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Plugin, ViewCapability } from \"@elizaos/core\";\nimport { simpleViewsRoutes } from \"./routes.js\";\nimport { interact } from \"./simple-views.interact.js\";\n\nconst AGENT_SURFACE_CAPABILITIES: ViewCapability[] = [\n {\n id: \"list-elements\",\n description:\n \"List addressable controls, cards, inputs, and regions in the mounted view.\",\n },\n {\n id: \"get-agent-state\",\n description:\n \"Return the mounted view's agent-surface state and element snapshot.\",\n },\n {\n id: \"describe-element\",\n description: \"Describe one mounted view element by stable id.\",\n params: {\n id: {\n type: \"string\",\n description: \"Stable agent element id.\",\n required: true,\n },\n },\n },\n {\n id: \"agent-click\",\n description: \"Click or activate one mounted view element by stable id.\",\n params: {\n id: {\n type: \"string\",\n description: \"Stable agent element id.\",\n required: true,\n },\n },\n },\n {\n id: \"agent-fill\",\n description: \"Fill one mounted view input or textarea by stable id.\",\n params: {\n id: {\n type: \"string\",\n description: \"Stable agent element id.\",\n required: true,\n },\n value: {\n type: \"string\",\n description: \"Text value to enter.\",\n required: true,\n },\n },\n },\n];\n\nconst NOTES_CAPABILITIES: ViewCapability[] = [\n ...AGENT_SURFACE_CAPABILITIES,\n {\n id: \"get-notes\",\n description: \"Return all sticky notes as structured data.\",\n },\n {\n id: \"create-note\",\n description: \"Create a sticky note without needing to drive the form.\",\n params: {\n title: { type: \"string\", description: \"Note title.\" },\n body: { type: \"string\", description: \"Note body.\" },\n color: {\n type: \"string\",\n description: \"Sticky color: yellow, green, rose, or slate.\",\n },\n },\n },\n {\n id: \"delete-note\",\n description: \"Delete one sticky note by id, exact title, or search query.\",\n params: {\n id: { type: \"string\", description: \"Note id.\" },\n title: { type: \"string\", description: \"Exact note title.\" },\n query: { type: \"string\", description: \"Title/body search query.\" },\n name: { type: \"string\", description: \"Alias for title or query.\" },\n },\n },\n {\n id: \"clear-notes\",\n description: \"Clear all sticky notes from storage.\",\n },\n];\n\nconst CALENDAR_CAPABILITIES: ViewCapability[] = [\n ...AGENT_SURFACE_CAPABILITIES,\n {\n id: \"get-calendar-state\",\n description:\n \"Return selected date and all simple calendar events as structured data.\",\n },\n {\n id: \"select-calendar-date\",\n description: \"Select a calendar date by ISO day.\",\n params: {\n date: {\n type: \"string\",\n description: \"Date in YYYY-MM-DD format.\",\n required: true,\n },\n },\n },\n {\n id: \"create-calendar-event\",\n description: \"Create a simple calendar event without driving the form.\",\n params: {\n title: { type: \"string\", description: \"Event title.\", required: true },\n date: { type: \"string\", description: \"Date in YYYY-MM-DD format.\" },\n time: { type: \"string\", description: \"Time label, for example 09:00.\" },\n notes: { type: \"string\", description: \"Event notes.\" },\n color: {\n type: \"string\",\n description: \"Event color: yellow, green, rose, or slate.\",\n },\n },\n },\n {\n id: \"delete-calendar-event\",\n description: \"Delete one simple calendar event by id.\",\n params: {\n id: { type: \"string\", description: \"Event id.\", required: true },\n },\n },\n];\n\nexport const simpleViewsPlugin: Plugin = {\n name: \"@elizaos/plugin-simple-views\",\n description:\n \"Agent-drivable Notes and Simple Calendar app views for view switching, split-pane, and capability QA.\",\n routes: simpleViewsRoutes,\n views: [\n {\n id: \"notes\",\n label: \"Notes\",\n description:\n \"Simple sticky notes wall. The agent can create, read, delete, fill fields, and click stable controls.\",\n icon: \"StickyNote\",\n path: \"/notes\",\n order: 920,\n viewKind: \"developer\",\n modalities: [\"gui\", \"xr\"],\n tags: [\n \"notes\",\n \"notepad\",\n \"sticky notes\",\n \"scratchpad\",\n \"qa\",\n \"agent-drivable\",\n ],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"NotesView\",\n visibleInManager: true,\n desktopTabEnabled: true,\n capabilities: NOTES_CAPABILITIES,\n serverInteract: interact,\n },\n {\n id: \"simple-calendar\",\n label: \"Simple Calendar\",\n description:\n \"Simple local calendar for view switching QA. The production Calendar view remains the main user calendar.\",\n icon: \"CalendarDays\",\n path: \"/simple-calendar\",\n order: 921,\n viewKind: \"developer\",\n modalities: [\"gui\", \"xr\"],\n tags: [\n \"calendar\",\n \"calender\",\n \"schedule\",\n \"events\",\n \"planner\",\n \"qa\",\n \"agent-drivable\",\n ],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"SimpleCalendarView\",\n visibleInManager: true,\n desktopTabEnabled: true,\n capabilities: CALENDAR_CAPABILITIES,\n serverInteract: interact,\n },\n ],\n};\n\nexport default simpleViewsPlugin;\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":""}
|
package/dist/register.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { registerAppShellPage } from "@elizaos/ui/app-shell-registry";
|
|
2
|
+
registerAppShellPage({
|
|
3
|
+
id: "notes",
|
|
4
|
+
pluginId: "@elizaos/plugin-simple-views",
|
|
5
|
+
label: "Notes",
|
|
6
|
+
icon: "StickyNote",
|
|
7
|
+
path: "/notes",
|
|
8
|
+
order: 920,
|
|
9
|
+
viewKind: "developer",
|
|
10
|
+
loader: () => import("./ui.js").then((module) => ({
|
|
11
|
+
default: module.NotesView
|
|
12
|
+
}))
|
|
13
|
+
});
|
|
14
|
+
registerAppShellPage({
|
|
15
|
+
id: "simple-calendar",
|
|
16
|
+
pluginId: "@elizaos/plugin-simple-views",
|
|
17
|
+
label: "Simple Calendar",
|
|
18
|
+
icon: "CalendarDays",
|
|
19
|
+
path: "/simple-calendar",
|
|
20
|
+
order: 921,
|
|
21
|
+
viewKind: "developer",
|
|
22
|
+
loader: () => import("./ui.js").then((module) => ({
|
|
23
|
+
default: module.SimpleCalendarView
|
|
24
|
+
}))
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register.ts"],"sourcesContent":["import { registerAppShellPage } from \"@elizaos/ui/app-shell-registry\";\n\nregisterAppShellPage({\n id: \"notes\",\n pluginId: \"@elizaos/plugin-simple-views\",\n label: \"Notes\",\n icon: \"StickyNote\",\n path: \"/notes\",\n order: 920,\n viewKind: \"developer\",\n loader: () =>\n import(\"./ui.js\").then((module) => ({\n default: module.NotesView,\n })),\n});\n\nregisterAppShellPage({\n id: \"simple-calendar\",\n pluginId: \"@elizaos/plugin-simple-views\",\n label: \"Simple Calendar\",\n icon: \"CalendarDays\",\n path: \"/simple-calendar\",\n order: 921,\n viewKind: \"developer\",\n loader: () =>\n import(\"./ui.js\").then((module) => ({\n default: module.SimpleCalendarView,\n })),\n});\n"],"mappings":"AAAA,SAAS,4BAA4B;AAErC,qBAAqB;AAAA,EACnB,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ,MACN,OAAO,SAAS,EAAE,KAAK,CAAC,YAAY;AAAA,IAClC,SAAS,OAAO;AAAA,EAClB,EAAE;AACN,CAAC;AAED,qBAAqB;AAAA,EACnB,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ,MACN,OAAO,SAAS,EAAE,KAAK,CAAC,YAAY;AAAA,IAClC,SAAS,OAAO;AAAA,EAClB,EAAE;AACN,CAAC;","names":[]}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AA2B3C,eAAO,MAAM,iBAAiB,EAAE,KAAK,EA+CpC,CAAC"}
|
package/dist/routes.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { interact } from "./simple-views.interact.js";
|
|
2
|
+
import { simpleViewsSnapshot } from "./storage.js";
|
|
3
|
+
function requestBodyRecord(body) {
|
|
4
|
+
return body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
5
|
+
}
|
|
6
|
+
function stringBodyField(body, key) {
|
|
7
|
+
const value = body[key];
|
|
8
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
9
|
+
}
|
|
10
|
+
function paramsBodyField(body) {
|
|
11
|
+
const value = body.params;
|
|
12
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
13
|
+
}
|
|
14
|
+
const simpleViewsRoutes = [
|
|
15
|
+
{
|
|
16
|
+
type: "GET",
|
|
17
|
+
name: "simple-views-state",
|
|
18
|
+
path: "/api/simple-views/state",
|
|
19
|
+
public: true,
|
|
20
|
+
rawPath: true,
|
|
21
|
+
routeHandler: async () => ({
|
|
22
|
+
status: 200,
|
|
23
|
+
body: simpleViewsSnapshot()
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: "POST",
|
|
28
|
+
name: "simple-views-interact",
|
|
29
|
+
path: "/api/simple-views/interact",
|
|
30
|
+
// Auth required: this is a state-mutating write. (The GET /state read above
|
|
31
|
+
// stays public.) An unauthenticated POST must not mutate server state.
|
|
32
|
+
rawPath: true,
|
|
33
|
+
routeHandler: async ({ body }) => {
|
|
34
|
+
const record = requestBodyRecord(body);
|
|
35
|
+
const capability = stringBodyField(record, "capability");
|
|
36
|
+
if (!capability) {
|
|
37
|
+
return {
|
|
38
|
+
status: 400,
|
|
39
|
+
body: { success: false, text: "Capability is required." }
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const interaction = await interact(capability, paramsBodyField(record));
|
|
44
|
+
return {
|
|
45
|
+
status: interaction.success ? 200 : 400,
|
|
46
|
+
body: interaction
|
|
47
|
+
};
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
status: 400,
|
|
51
|
+
body: {
|
|
52
|
+
success: false,
|
|
53
|
+
text: error instanceof Error ? error.message : String(error),
|
|
54
|
+
state: simpleViewsSnapshot()
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
export {
|
|
62
|
+
simpleViewsRoutes
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/routes.ts"],"sourcesContent":["import type { Route } from \"@elizaos/core\";\nimport { interact } from \"./simple-views.interact.js\";\nimport { simpleViewsSnapshot } from \"./storage.js\";\n\nfunction requestBodyRecord(body: unknown): Record<string, unknown> {\n return body && typeof body === \"object\" && !Array.isArray(body)\n ? (body as Record<string, unknown>)\n : {};\n}\n\nfunction stringBodyField(\n body: Record<string, unknown>,\n key: string,\n): string | null {\n const value = body[key];\n return typeof value === \"string\" && value.trim() ? value.trim() : null;\n}\n\nfunction paramsBodyField(\n body: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const value = body.params;\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nexport const simpleViewsRoutes: Route[] = [\n {\n type: \"GET\",\n name: \"simple-views-state\",\n path: \"/api/simple-views/state\",\n public: true,\n rawPath: true,\n routeHandler: async () => ({\n status: 200,\n body: simpleViewsSnapshot(),\n }),\n },\n {\n type: \"POST\",\n name: \"simple-views-interact\",\n path: \"/api/simple-views/interact\",\n // Auth required: this is a state-mutating write. (The GET /state read above\n // stays public.) An unauthenticated POST must not mutate server state.\n rawPath: true,\n routeHandler: async ({ body }) => {\n const record = requestBodyRecord(body);\n const capability = stringBodyField(record, \"capability\");\n if (!capability) {\n return {\n status: 400,\n body: { success: false, text: \"Capability is required.\" },\n };\n }\n\n try {\n const interaction = await interact(capability, paramsBodyField(record));\n return {\n status: interaction.success ? 200 : 400,\n body: interaction,\n };\n } catch (error) {\n return {\n status: 400,\n body: {\n success: false,\n text: error instanceof Error ? error.message : String(error),\n state: simpleViewsSnapshot(),\n },\n };\n }\n },\n },\n];\n"],"mappings":"AACA,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAEpC,SAAS,kBAAkB,MAAwC;AACjE,SAAO,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,IACzD,OACD,CAAC;AACP;AAEA,SAAS,gBACP,MACA,KACe;AACf,QAAM,QAAQ,KAAK,GAAG;AACtB,SAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;AACpE;AAEA,SAAS,gBACP,MACqC;AACrC,QAAM,QAAQ,KAAK;AACnB,SAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAC5D,QACD;AACN;AAEO,MAAM,oBAA6B;AAAA,EACxC;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,cAAc,aAAa;AAAA,MACzB,QAAQ;AAAA,MACR,MAAM,oBAAoB;AAAA,IAC5B;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA;AAAA;AAAA,IAGN,SAAS;AAAA,IACT,cAAc,OAAO,EAAE,KAAK,MAAM;AAChC,YAAM,SAAS,kBAAkB,IAAI;AACrC,YAAM,aAAa,gBAAgB,QAAQ,YAAY;AACvD,UAAI,CAAC,YAAY;AACf,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,MAAM,EAAE,SAAS,OAAO,MAAM,0BAA0B;AAAA,QAC1D;AAAA,MACF;AAEA,UAAI;AACF,cAAM,cAAc,MAAM,SAAS,YAAY,gBAAgB,MAAM,CAAC;AACtE,eAAO;AAAA,UACL,QAAQ,YAAY,UAAU,MAAM;AAAA,UACpC,MAAM;AAAA,QACR;AAAA,MACF,SAAS,OAAO;AACd,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,MAAM;AAAA,YACJ,SAAS;AAAA,YACT,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,YAC3D,OAAO,oBAAoB;AAAA,UAC7B;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-views-view-bundle.d.ts","sourceRoot":"","sources":["../src/simple-views-view-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/simple-views-view-bundle.ts"],"sourcesContent":["export { NotesView, SimpleCalendarView } from \"./ui.js\";\n"],"mappings":"AAAA,SAAS,WAAW,0BAA0B;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SimpleViewsSnapshot } from "./storage.js";
|
|
2
|
+
export interface SimpleViewsInteractResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
text: string;
|
|
5
|
+
state: SimpleViewsSnapshot;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare function interact(capability: string, params?: Record<string, unknown>): Promise<SimpleViewsInteractResult>;
|
|
9
|
+
//# sourceMappingURL=simple-views.interact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-views.interact.d.ts","sourceRoot":"","sources":["../src/simple-views.interact.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,mBAAmB,EAOzB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,mBAAmB,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAyED,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CAgMpC"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
makeId,
|
|
3
|
+
normalizeColor,
|
|
4
|
+
normalizeDateKey,
|
|
5
|
+
nowIso,
|
|
6
|
+
readEvents,
|
|
7
|
+
readNotes,
|
|
8
|
+
readSelectedDate,
|
|
9
|
+
simpleViewsSnapshot,
|
|
10
|
+
todayDateKey,
|
|
11
|
+
writeEvents,
|
|
12
|
+
writeNotes,
|
|
13
|
+
writeSelectedDate
|
|
14
|
+
} from "./storage.js";
|
|
15
|
+
function textParam(params, key) {
|
|
16
|
+
const value = params?.[key];
|
|
17
|
+
return typeof value === "string" ? value.trim() : "";
|
|
18
|
+
}
|
|
19
|
+
function normalizeLookup(value) {
|
|
20
|
+
return value.toLowerCase().replace(/\s+/g, " ").trim();
|
|
21
|
+
}
|
|
22
|
+
function summarizeNotes(notes) {
|
|
23
|
+
if (notes.length === 0) return "No sticky notes yet.";
|
|
24
|
+
return notes.map((note) => `${note.title}: ${note.body}`).join("\n");
|
|
25
|
+
}
|
|
26
|
+
function summarizeEvents(events, date) {
|
|
27
|
+
const filtered = date ? events.filter((event) => event.date === date) : events;
|
|
28
|
+
if (filtered.length === 0) {
|
|
29
|
+
return date ? `No calendar events for ${date}.` : "No calendar events yet.";
|
|
30
|
+
}
|
|
31
|
+
return filtered.map(
|
|
32
|
+
(event) => `${event.date} ${event.time} - ${event.title}${event.notes ? `: ${event.notes}` : ""}`
|
|
33
|
+
).join("\n");
|
|
34
|
+
}
|
|
35
|
+
function resolveNoteDeleteTarget(notes, target) {
|
|
36
|
+
const normalized = normalizeLookup(target);
|
|
37
|
+
if (!normalized) return null;
|
|
38
|
+
const exact = notes.filter(
|
|
39
|
+
(note) => normalizeLookup(note.id) === normalized || normalizeLookup(note.title) === normalized
|
|
40
|
+
);
|
|
41
|
+
if (exact.length === 1) return exact[0];
|
|
42
|
+
if (exact.length > 1) return { ambiguous: exact };
|
|
43
|
+
const titleMatches = notes.filter(
|
|
44
|
+
(note) => normalizeLookup(note.title).includes(normalized)
|
|
45
|
+
);
|
|
46
|
+
if (titleMatches.length === 1) return titleMatches[0];
|
|
47
|
+
if (titleMatches.length > 1) return { ambiguous: titleMatches };
|
|
48
|
+
const bodyMatches = notes.filter(
|
|
49
|
+
(note) => normalizeLookup(note.body).includes(normalized)
|
|
50
|
+
);
|
|
51
|
+
if (bodyMatches.length === 1) return bodyMatches[0];
|
|
52
|
+
if (bodyMatches.length > 1) return { ambiguous: bodyMatches };
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
function result(fields) {
|
|
56
|
+
return { ...fields, state: simpleViewsSnapshot() };
|
|
57
|
+
}
|
|
58
|
+
async function interact(capability, params) {
|
|
59
|
+
if (capability === "get-notes") {
|
|
60
|
+
const notes = readNotes();
|
|
61
|
+
return result({
|
|
62
|
+
success: true,
|
|
63
|
+
text: summarizeNotes(notes),
|
|
64
|
+
notes
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (capability === "create-note") {
|
|
68
|
+
const now = nowIso();
|
|
69
|
+
const note = {
|
|
70
|
+
id: makeId("note"),
|
|
71
|
+
title: textParam(params, "title") || "Untitled",
|
|
72
|
+
body: textParam(params, "body") || textParam(params, "content") || "New note",
|
|
73
|
+
color: normalizeColor(params?.color),
|
|
74
|
+
createdAt: now,
|
|
75
|
+
updatedAt: now
|
|
76
|
+
};
|
|
77
|
+
writeNotes([note, ...readNotes()]);
|
|
78
|
+
return result({
|
|
79
|
+
success: true,
|
|
80
|
+
text: `Created sticky note "${note.title}".`,
|
|
81
|
+
created: true,
|
|
82
|
+
note
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (capability === "delete-note") {
|
|
86
|
+
const target = textParam(params, "id") || textParam(params, "title") || textParam(params, "query") || textParam(params, "name");
|
|
87
|
+
if (!target) {
|
|
88
|
+
return result({
|
|
89
|
+
success: false,
|
|
90
|
+
text: "Note id, title, or query is required.",
|
|
91
|
+
deleted: false,
|
|
92
|
+
reason: "target is required"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const before = readNotes();
|
|
96
|
+
const resolved = resolveNoteDeleteTarget(before, target);
|
|
97
|
+
if (!resolved) {
|
|
98
|
+
return result({
|
|
99
|
+
success: false,
|
|
100
|
+
text: `No sticky note found for "${target}".`,
|
|
101
|
+
deleted: false,
|
|
102
|
+
target
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if ("ambiguous" in resolved) {
|
|
106
|
+
return result({
|
|
107
|
+
success: false,
|
|
108
|
+
text: `"${target}" matches multiple sticky notes: ${resolved.ambiguous.map((note) => note.title).join(", ")}.`,
|
|
109
|
+
deleted: false,
|
|
110
|
+
target,
|
|
111
|
+
candidates: resolved.ambiguous
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
writeNotes(before.filter((note) => note.id !== resolved.id));
|
|
115
|
+
return result({
|
|
116
|
+
success: true,
|
|
117
|
+
text: `Deleted sticky note "${resolved.title}".`,
|
|
118
|
+
deleted: true,
|
|
119
|
+
id: resolved.id,
|
|
120
|
+
note: resolved
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (capability === "clear-notes") {
|
|
124
|
+
writeNotes([]);
|
|
125
|
+
return result({
|
|
126
|
+
success: true,
|
|
127
|
+
text: "Cleared all sticky notes.",
|
|
128
|
+
cleared: true
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (capability === "get-calendar-state") {
|
|
132
|
+
const requestedDate = textParam(params, "date");
|
|
133
|
+
const selectedDate = requestedDate ? normalizeDateKey(requestedDate) : readSelectedDate();
|
|
134
|
+
if (!selectedDate) {
|
|
135
|
+
return result({
|
|
136
|
+
success: false,
|
|
137
|
+
text: "Date must be YYYY-MM-DD.",
|
|
138
|
+
reason: "date must be YYYY-MM-DD"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const events = readEvents();
|
|
142
|
+
return result({
|
|
143
|
+
success: true,
|
|
144
|
+
text: summarizeEvents(events, selectedDate),
|
|
145
|
+
selectedDate,
|
|
146
|
+
events
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (capability === "select-calendar-date") {
|
|
150
|
+
const date = normalizeDateKey(textParam(params, "date"));
|
|
151
|
+
if (!date) {
|
|
152
|
+
return result({
|
|
153
|
+
success: false,
|
|
154
|
+
text: "Date must be YYYY-MM-DD.",
|
|
155
|
+
selected: false,
|
|
156
|
+
reason: "date must be YYYY-MM-DD"
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
writeSelectedDate(date);
|
|
160
|
+
return result({
|
|
161
|
+
success: true,
|
|
162
|
+
text: `Selected ${date}.`,
|
|
163
|
+
selected: true,
|
|
164
|
+
date
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (capability === "create-calendar-event") {
|
|
168
|
+
const requestedDate = textParam(params, "date");
|
|
169
|
+
const date = requestedDate ? normalizeDateKey(requestedDate) : readSelectedDate() || todayDateKey();
|
|
170
|
+
if (!date) {
|
|
171
|
+
return result({
|
|
172
|
+
success: false,
|
|
173
|
+
text: "Date must be YYYY-MM-DD.",
|
|
174
|
+
created: false,
|
|
175
|
+
reason: "date must be YYYY-MM-DD"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const event = {
|
|
179
|
+
id: makeId("event"),
|
|
180
|
+
title: textParam(params, "title") || "Untitled event",
|
|
181
|
+
date,
|
|
182
|
+
time: textParam(params, "time") || "09:00",
|
|
183
|
+
notes: textParam(params, "notes"),
|
|
184
|
+
color: normalizeColor(params?.color),
|
|
185
|
+
createdAt: nowIso()
|
|
186
|
+
};
|
|
187
|
+
writeEvents([...readEvents(), event]);
|
|
188
|
+
writeSelectedDate(date);
|
|
189
|
+
return result({
|
|
190
|
+
success: true,
|
|
191
|
+
text: `Created calendar event "${event.title}" for ${event.date} at ${event.time}.`,
|
|
192
|
+
created: true,
|
|
193
|
+
event
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (capability === "delete-calendar-event") {
|
|
197
|
+
const id = textParam(params, "id");
|
|
198
|
+
if (!id) {
|
|
199
|
+
return result({
|
|
200
|
+
success: false,
|
|
201
|
+
text: "Event id is required.",
|
|
202
|
+
deleted: false,
|
|
203
|
+
reason: "id is required"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const before = readEvents();
|
|
207
|
+
const event = before.find((candidate) => candidate.id === id);
|
|
208
|
+
if (!event) {
|
|
209
|
+
return result({
|
|
210
|
+
success: false,
|
|
211
|
+
text: `No calendar event found for "${id}".`,
|
|
212
|
+
deleted: false,
|
|
213
|
+
id
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
writeEvents(before.filter((candidate) => candidate.id !== id));
|
|
217
|
+
return result({
|
|
218
|
+
success: true,
|
|
219
|
+
text: `Deleted calendar event "${event.title}".`,
|
|
220
|
+
deleted: true,
|
|
221
|
+
id,
|
|
222
|
+
event
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
throw new Error(`Simple views do not support capability "${capability}".`);
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
interact
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=simple-views.interact.js.map
|