visionclaw 0.1.25 → 0.1.27
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/CHANGELOG.md +207 -0
- package/dist/agent/system-prompt.d.ts.map +1 -1
- package/dist/agent/system-prompt.js +4 -3
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/drive/google-drive.d.ts +82 -0
- package/dist/drive/google-drive.d.ts.map +1 -0
- package/dist/drive/google-drive.js +190 -0
- package/dist/drive/google-drive.js.map +1 -0
- package/dist/obs/ui.d.ts.map +1 -1
- package/dist/obs/ui.js +7 -5
- package/dist/obs/ui.js.map +1 -1
- package/dist/onboarding/google-auth.js +1 -1
- package/dist/onboarding/google-auth.js.map +1 -1
- package/dist/tools/drive.d.ts +29 -0
- package/dist/tools/drive.d.ts.map +1 -0
- package/dist/tools/drive.js +363 -0
- package/dist/tools/drive.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/sleep-interval.d.ts +5 -0
- package/dist/tools/sleep-interval.d.ts.map +1 -0
- package/dist/tools/sleep-interval.js +25 -0
- package/dist/tools/sleep-interval.js.map +1 -0
- package/package.json +7 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
## [0.1.26](https://github.com/babelcloud/visionclaw/compare/v0.1.25...v0.1.26) (2026-02-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update UI title and enhance header with logo; adjust padding in wrap class for improved layout ([79d9cd8](https://github.com/babelcloud/visionclaw/commit/79d9cd831b8f5250f5b2d2b07fe6ca32d497e60b))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [0.1.25](https://github.com/babelcloud/visionclaw/compare/v0.1.24...v0.1.25) (2026-02-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.24](https://github.com/babelcloud/visionclaw/compare/v0.1.23...v0.1.24) (2026-02-22)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add OBS tunnel support with cloudflared and ngrok options, enhance onboarding process for tunnel selection, and implement notification for tunnel URL availability ([646f4cc](https://github.com/babelcloud/visionclaw/commit/646f4cccbef544b266a979569e1f10ffbb264aea))
|
|
20
|
+
* refactor observability UI by separating HTML rendering into a new ui.ts file and enhancing server.ts with memory and skill interfaces ([251437c](https://github.com/babelcloud/visionclaw/commit/251437c7523656f38718709f566e28284f7ce60d))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [0.1.23](https://github.com/babelcloud/visionclaw/compare/v0.1.22...v0.1.23) (2026-02-22)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [0.1.22](https://github.com/babelcloud/visionclaw/compare/v0.1.21...v0.1.22) (2026-02-22)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* implement activity tracking and fast response handling for agent interrupts ([63b0b43](https://github.com/babelcloud/visionclaw/commit/63b0b437c77aeb4b0aae4e0fe2e6db947555c7c8))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.1.21](https://github.com/babelcloud/visionclaw/compare/v0.1.20...v0.1.21) (2026-02-22)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* add delay for automatic restart in upgrade tool to allow user response before process exit ([62b008b](https://github.com/babelcloud/visionclaw/commit/62b008b3bc716e0061ec3c5ad1e3f44631e353cf))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [0.1.20](https://github.com/babelcloud/visionclaw/compare/v0.1.19...v0.1.20) (2026-02-22)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* implement upgrade tool to check and update VisionClaw version via npm, including automatic restart support ([b2d50cf](https://github.com/babelcloud/visionclaw/commit/b2d50cfe660599a4f459e84a6b3f08e86ce5f5a6))
|
|
52
|
+
* update heartbeat interval to use a constant and enhance build scripts with linting ([9a55fa2](https://github.com/babelcloud/visionclaw/commit/9a55fa2c3349c5d1521dea2dead8fe37e4148d56))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## [0.1.19](https://github.com/babelcloud/visionclaw/compare/v0.1.18...v0.1.19) (2026-02-21)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
* add browser tool for launching Chrome with CDP support and implement tests ([1c6f473](https://github.com/babelcloud/visionclaw/commit/1c6f473a8b0e056cef9d59fec832fc8853ea3bca))
|
|
62
|
+
* enhance error handling for session compaction and add unhandled promise rejection logging ([32cddd8](https://github.com/babelcloud/visionclaw/commit/32cddd8e208136bd6fe7e563409456643d23f4c5))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## [0.1.18](https://github.com/babelcloud/visionclaw/compare/v0.1.17...v0.1.18) (2026-02-21)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
* enhance session compaction with error handling and logging ([2a32193](https://github.com/babelcloud/visionclaw/commit/2a32193341f415f2f3a02d8b70647b5dc08e36fa))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## [0.1.17](https://github.com/babelcloud/visionclaw/compare/v0.1.16...v0.1.17) (2026-02-21)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Features
|
|
79
|
+
|
|
80
|
+
* remove countJsonlLines function and enhance session management for proactive compaction ([95ace6e](https://github.com/babelcloud/visionclaw/commit/95ace6eb992259e6df241950026a2994c4cd4522))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## [0.1.16](https://github.com/babelcloud/visionclaw/compare/v0.1.15...v0.1.16) (2026-02-21)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Features
|
|
88
|
+
|
|
89
|
+
* add countJsonlLines function and integrate it into session management for transcript compaction ([70d8035](https://github.com/babelcloud/visionclaw/commit/70d803524f6e24093df323d05a1a1a9e0de98f65))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## [0.1.15](https://github.com/babelcloud/visionclaw/compare/v0.1.14...v0.1.15) (2026-02-21)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Features
|
|
97
|
+
|
|
98
|
+
* enhance base64 image block validation to ignore placeholder images ([e121750](https://github.com/babelcloud/visionclaw/commit/e121750b28ddf4819f7db45f6fbd9be3b8b2c520))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## [0.1.14](https://github.com/babelcloud/visionclaw/compare/v0.1.13...v0.1.14) (2026-02-21)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* add script to copy built-in skills and update installation logic ([3f97aa6](https://github.com/babelcloud/visionclaw/commit/3f97aa67e21c39e43115eaf4969aaec9a03f9ce6))
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## [0.1.13](https://github.com/babelcloud/visionclaw/compare/v0.1.12...v0.1.13) (2026-02-21)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Features
|
|
115
|
+
|
|
116
|
+
* improve built-in skills installation logic to check for valid skill folders ([e45397f](https://github.com/babelcloud/visionclaw/commit/e45397f11901aee419decfbca2094716a16db553))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## [0.1.12](https://github.com/babelcloud/visionclaw/compare/v0.1.11...v0.1.12) (2026-02-21)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Features
|
|
124
|
+
|
|
125
|
+
* enhance installBuiltinSkills function to support force option for overwriting existing skills ([ec6b183](https://github.com/babelcloud/visionclaw/commit/ec6b183d9781e82dbaacab622f703740656ab9cc))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## [0.1.11](https://github.com/babelcloud/visionclaw/compare/v0.1.10...v0.1.11) (2026-02-21)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
* implement image pruning functionality in session management ([dbc0a7e](https://github.com/babelcloud/visionclaw/commit/dbc0a7e561fc1a900b3ce6d5daa660910b0e286f))
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## [0.1.10](https://github.com/babelcloud/visionclaw/compare/v0.1.9...v0.1.10) (2026-02-20)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Features
|
|
142
|
+
|
|
143
|
+
* add reconfigure command for updating existing profiles and channels ([1cc9dd4](https://github.com/babelcloud/visionclaw/commit/1cc9dd461539547b0574041de8926274db4e0583))
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## [0.1.9](https://github.com/babelcloud/visionclaw/compare/v0.1.8...v0.1.9) (2026-02-20)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## [0.1.8](https://github.com/babelcloud/visionclaw/compare/v0.1.7...v0.1.8) (2026-02-20)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
## [0.1.7](https://github.com/babelcloud/visionclaw/compare/v0.1.6...v0.1.7) (2026-02-20)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## [0.1.6](https://github.com/babelcloud/visionclaw/compare/v0.1.5...v0.1.6) (2026-02-20)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
### Features
|
|
163
|
+
|
|
164
|
+
* add local testing harness for computer_use tools and enhance cliclick command handling ([ee37084](https://github.com/babelcloud/visionclaw/commit/ee37084455792ce9236bb9b547c052cb49fbb36f))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## [0.1.5](https://github.com/babelcloud/visionclaw/compare/v0.1.4...v0.1.5) (2026-02-20)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### Features
|
|
172
|
+
|
|
173
|
+
* add refresh_token handling and enable debug logging option ([a0c3d9e](https://github.com/babelcloud/visionclaw/commit/a0c3d9e886ef9a1e3db04769a901c192d3626e1b))
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
## [0.1.4](https://github.com/babelcloud/visionclaw/compare/v0.1.3...v0.1.4) (2026-02-20)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### Bug Fixes
|
|
181
|
+
|
|
182
|
+
* update default host to 0.0.0.0 in ObsConfigSchema and main function ([ba12d53](https://github.com/babelcloud/visionclaw/commit/ba12d535bc43524a06c730b1df568ea3b3db638e))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## [0.1.3](https://github.com/babelcloud/visionclaw/compare/v0.1.2...v0.1.3) (2026-02-20)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
### Bug Fixes
|
|
190
|
+
|
|
191
|
+
* add optional chaining for labels in email tool management ([48dc44d](https://github.com/babelcloud/visionclaw/commit/48dc44d67661e9fa56ddff41e56b2f82712097c1))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## [0.1.2](https://github.com/babelcloud/visionclaw/compare/v0.1.1...v0.1.2) (2026-02-20)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
## [0.1.1](https://github.com/babelcloud/visionclaw/compare/703bdd8dff001a01ae8093d86e332cfc29973288...v0.1.1) (2026-02-20)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### Features
|
|
203
|
+
|
|
204
|
+
* implement self-contained agent bundle and Node.js runtime download ([703bdd8](https://github.com/babelcloud/visionclaw/commit/703bdd8dff001a01ae8093d86e332cfc29973288))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAsJlE"}
|
|
@@ -49,7 +49,7 @@ When you need to communicate results, answer questions, or ask for help, use the
|
|
|
49
49
|
### Wake Cycle
|
|
50
50
|
You are triggered by:
|
|
51
51
|
1. **New messages** from any enabled channel
|
|
52
|
-
2. **Heartbeat events** every ${config.heartbeatIntervalMs / 1000} seconds
|
|
52
|
+
2. **Heartbeat events** every ${config.heartbeatIntervalMs / 1000} seconds (current interval — you can change this at runtime using the \`set_sleep_interval\` tool)
|
|
53
53
|
|
|
54
54
|
Every time you wake up:
|
|
55
55
|
- You receive a screenshot of the current desktop state
|
|
@@ -97,10 +97,11 @@ During heartbeat wakes (no new messages), review your calendar, check for pendin
|
|
|
97
97
|
- **manage_skills**: Create, update, delete, or list your skills (SKILL.md files invoked by the Skill tool)
|
|
98
98
|
- **upgrade**: Check for and install updates to yourself
|
|
99
99
|
- **manage_calendar**: Create, update, delete, list Google Calendar events
|
|
100
|
-
- **manage_calendar**: Create, update, delete, list Google Calendar events
|
|
101
100
|
- **manage_email**: List, search, read, send, reply, and manage Gmail messages
|
|
101
|
+
- **manage_drive**: List, upload, download, share, move, and delete files in Google Drive
|
|
102
102
|
- **memory**: Persistent memory storage (view, create, str_replace, insert, delete, rename files in /memories)
|
|
103
|
-
- **browser**: Launch a Chrome instance with remote-debugging (CDP) enabled.
|
|
103
|
+
- **browser**: Launch a Chrome instance with remote-debugging (CDP) enabled.
|
|
104
|
+
- **set_sleep_interval**: Change the heartbeat sleep interval at runtime (1-1440 minutes)
|
|
104
105
|
|
|
105
106
|
### Browser Tools (Playwright MCP)
|
|
106
107
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAwB;IACxD,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE;QAC7C,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;KAClB,CAAC,CAAC;IAEH,OAAO;;UAEC,MAAM,CAAC,SAAS,oHAAoH,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;;;cAGnL,MAAM,CAAC,SAAS;eACf,MAAM,CAAC,KAAK;kDACuB,MAAM,CAAC,KAAK;EAC5D,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,6BAA6B;;;EAGzF,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,6BAA6B;EACpF,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAyB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;EACrE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAA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ary {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
size?: string;
|
|
7
|
+
modifiedTime?: string;
|
|
8
|
+
webViewLink?: string;
|
|
9
|
+
parents?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface DriveUploadResult {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
webViewLink?: string;
|
|
16
|
+
size?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Wrapper around Google Drive API v3.
|
|
20
|
+
* Uses OAuth tokens from onboarding to manage files in the agent's Google Drive.
|
|
21
|
+
*/
|
|
22
|
+
export declare class GoogleDriveClient {
|
|
23
|
+
private drive;
|
|
24
|
+
constructor(config: VisionClawConfig);
|
|
25
|
+
/**
|
|
26
|
+
* List files in Google Drive with optional query filtering.
|
|
27
|
+
*/
|
|
28
|
+
listFiles(options: {
|
|
29
|
+
query?: string;
|
|
30
|
+
maxResults?: number;
|
|
31
|
+
folderId?: string;
|
|
32
|
+
orderBy?: string;
|
|
33
|
+
}): Promise<DriveFileSummary[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Get metadata for a specific file.
|
|
36
|
+
*/
|
|
37
|
+
getFile(fileId: string): Promise<DriveFileSummary>;
|
|
38
|
+
/**
|
|
39
|
+
* Upload a local file to Google Drive.
|
|
40
|
+
*/
|
|
41
|
+
uploadFile(options: {
|
|
42
|
+
localPath: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
mimeType?: string;
|
|
45
|
+
folderId?: string;
|
|
46
|
+
}): Promise<DriveUploadResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Download a file from Google Drive to a local path.
|
|
49
|
+
*/
|
|
50
|
+
downloadFile(options: {
|
|
51
|
+
fileId: string;
|
|
52
|
+
localPath: string;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Create a folder in Google Drive.
|
|
56
|
+
*/
|
|
57
|
+
createFolder(options: {
|
|
58
|
+
name: string;
|
|
59
|
+
parentId?: string;
|
|
60
|
+
}): Promise<DriveFileSummary>;
|
|
61
|
+
/**
|
|
62
|
+
* Share a file with a specific email address.
|
|
63
|
+
*/
|
|
64
|
+
shareFile(options: {
|
|
65
|
+
fileId: string;
|
|
66
|
+
email: string;
|
|
67
|
+
role: "reader" | "writer" | "commenter";
|
|
68
|
+
sendNotification?: boolean;
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Move a file to trash (soft delete).
|
|
72
|
+
*/
|
|
73
|
+
deleteFile(fileId: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Move a file to a different folder.
|
|
76
|
+
*/
|
|
77
|
+
moveFile(options: {
|
|
78
|
+
fileId: string;
|
|
79
|
+
newFolderId: string;
|
|
80
|
+
}): Promise<DriveFileSummary>;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=google-drive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-drive.d.ts","sourceRoot":"","sources":["../../src/drive/google-drive.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;C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AI,CAAC;IAO/C;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA0B9B"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { google } from "googleapis";
|
|
4
|
+
import { loadGoogleTokens, saveGoogleTokens } from "../config/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Wrapper around Google Drive API v3.
|
|
7
|
+
* Uses OAuth tokens from onboarding to manage files in the agent's Google Drive.
|
|
8
|
+
*/
|
|
9
|
+
export class GoogleDriveClient {
|
|
10
|
+
drive;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
const tokens = loadGoogleTokens();
|
|
13
|
+
const oauth2Client = new google.auth.OAuth2(config.googleClientId, config.googleClientSecret);
|
|
14
|
+
oauth2Client.setCredentials({
|
|
15
|
+
access_token: tokens.access_token,
|
|
16
|
+
refresh_token: tokens.refresh_token,
|
|
17
|
+
token_type: tokens.token_type,
|
|
18
|
+
expiry_date: tokens.expiry_date,
|
|
19
|
+
});
|
|
20
|
+
// Auto-refresh tokens
|
|
21
|
+
oauth2Client.on("tokens", (newTokens) => {
|
|
22
|
+
const existing = loadGoogleTokens();
|
|
23
|
+
saveGoogleTokens({
|
|
24
|
+
...existing,
|
|
25
|
+
access_token: newTokens.access_token ?? existing.access_token,
|
|
26
|
+
refresh_token: newTokens.refresh_token ?? existing.refresh_token,
|
|
27
|
+
expiry_date: newTokens.expiry_date ?? existing.expiry_date,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
this.drive = google.drive({ version: "v3", auth: oauth2Client });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* List files in Google Drive with optional query filtering.
|
|
34
|
+
*/
|
|
35
|
+
async listFiles(options) {
|
|
36
|
+
let q = "trashed = false";
|
|
37
|
+
if (options.folderId) {
|
|
38
|
+
q += ` and '${options.folderId}' in parents`;
|
|
39
|
+
}
|
|
40
|
+
if (options.query) {
|
|
41
|
+
q += ` and (${options.query})`;
|
|
42
|
+
}
|
|
43
|
+
const res = await this.drive.files.list({
|
|
44
|
+
q,
|
|
45
|
+
pageSize: options.maxResults ?? 20,
|
|
46
|
+
orderBy: options.orderBy ?? "modifiedTime desc",
|
|
47
|
+
fields: "files(id, name, mimeType, size, modifiedTime, webViewLink, parents)",
|
|
48
|
+
});
|
|
49
|
+
return (res.data.files ?? []).map((f) => ({
|
|
50
|
+
id: f.id ?? "",
|
|
51
|
+
name: f.name ?? "",
|
|
52
|
+
mimeType: f.mimeType ?? "",
|
|
53
|
+
size: f.size ?? undefined,
|
|
54
|
+
modifiedTime: f.modifiedTime ?? undefined,
|
|
55
|
+
webViewLink: f.webViewLink ?? undefined,
|
|
56
|
+
parents: f.parents ?? undefined,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get metadata for a specific file.
|
|
61
|
+
*/
|
|
62
|
+
async getFile(fileId) {
|
|
63
|
+
const res = await this.drive.files.get({
|
|
64
|
+
fileId,
|
|
65
|
+
fields: "id, name, mimeType, size, modifiedTime, webViewLink, parents",
|
|
66
|
+
});
|
|
67
|
+
const f = res.data;
|
|
68
|
+
return {
|
|
69
|
+
id: f.id ?? "",
|
|
70
|
+
name: f.name ?? "",
|
|
71
|
+
mimeType: f.mimeType ?? "",
|
|
72
|
+
size: f.size ?? undefined,
|
|
73
|
+
modifiedTime: f.modifiedTime ?? undefined,
|
|
74
|
+
webViewLink: f.webViewLink ?? undefined,
|
|
75
|
+
parents: f.parents ?? undefined,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Upload a local file to Google Drive.
|
|
80
|
+
*/
|
|
81
|
+
async uploadFile(options) {
|
|
82
|
+
const localPath = options.localPath;
|
|
83
|
+
const name = options.name ?? path.basename(localPath);
|
|
84
|
+
const fileStream = fs.createReadStream(localPath);
|
|
85
|
+
const res = await this.drive.files.create({
|
|
86
|
+
requestBody: {
|
|
87
|
+
name,
|
|
88
|
+
parents: options.folderId ? [options.folderId] : undefined,
|
|
89
|
+
},
|
|
90
|
+
media: {
|
|
91
|
+
mimeType: options.mimeType ?? "application/octet-stream",
|
|
92
|
+
body: fileStream,
|
|
93
|
+
},
|
|
94
|
+
fields: "id, name, mimeType, size, webViewLink",
|
|
95
|
+
});
|
|
96
|
+
const f = res.data;
|
|
97
|
+
return {
|
|
98
|
+
id: f.id ?? "",
|
|
99
|
+
name: f.name ?? "",
|
|
100
|
+
mimeType: f.mimeType ?? "",
|
|
101
|
+
webViewLink: f.webViewLink ?? undefined,
|
|
102
|
+
size: f.size ?? undefined,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Download a file from Google Drive to a local path.
|
|
107
|
+
*/
|
|
108
|
+
async downloadFile(options) {
|
|
109
|
+
const dest = fs.createWriteStream(options.localPath);
|
|
110
|
+
const res = await this.drive.files.get({ fileId: options.fileId, alt: "media" }, { responseType: "stream" });
|
|
111
|
+
await new Promise((resolve, reject) => {
|
|
112
|
+
res.data
|
|
113
|
+
.on("end", resolve)
|
|
114
|
+
.on("error", reject)
|
|
115
|
+
.pipe(dest);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Create a folder in Google Drive.
|
|
120
|
+
*/
|
|
121
|
+
async createFolder(options) {
|
|
122
|
+
const res = await this.drive.files.create({
|
|
123
|
+
requestBody: {
|
|
124
|
+
name: options.name,
|
|
125
|
+
mimeType: "application/vnd.google-apps.folder",
|
|
126
|
+
parents: options.parentId ? [options.parentId] : undefined,
|
|
127
|
+
},
|
|
128
|
+
fields: "id, name, mimeType, webViewLink, parents",
|
|
129
|
+
});
|
|
130
|
+
const f = res.data;
|
|
131
|
+
return {
|
|
132
|
+
id: f.id ?? "",
|
|
133
|
+
name: f.name ?? "",
|
|
134
|
+
mimeType: f.mimeType ?? "",
|
|
135
|
+
webViewLink: f.webViewLink ?? undefined,
|
|
136
|
+
parents: f.parents ?? undefined,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Share a file with a specific email address.
|
|
141
|
+
*/
|
|
142
|
+
async shareFile(options) {
|
|
143
|
+
await this.drive.permissions.create({
|
|
144
|
+
fileId: options.fileId,
|
|
145
|
+
sendNotificationEmail: options.sendNotification ?? false,
|
|
146
|
+
requestBody: {
|
|
147
|
+
type: "user",
|
|
148
|
+
role: options.role,
|
|
149
|
+
emailAddress: options.email,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Move a file to trash (soft delete).
|
|
155
|
+
*/
|
|
156
|
+
async deleteFile(fileId) {
|
|
157
|
+
await this.drive.files.update({
|
|
158
|
+
fileId,
|
|
159
|
+
requestBody: { trashed: true },
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Move a file to a different folder.
|
|
164
|
+
*/
|
|
165
|
+
async moveFile(options) {
|
|
166
|
+
// Get current parents first
|
|
167
|
+
const current = await this.drive.files.get({
|
|
168
|
+
fileId: options.fileId,
|
|
169
|
+
fields: "parents",
|
|
170
|
+
});
|
|
171
|
+
const previousParents = (current.data.parents ?? []).join(",");
|
|
172
|
+
const res = await this.drive.files.update({
|
|
173
|
+
fileId: options.fileId,
|
|
174
|
+
addParents: options.newFolderId,
|
|
175
|
+
removeParents: previousParents,
|
|
176
|
+
fields: "id, name, mimeType, size, modifiedTime, webViewLink, parents",
|
|
177
|
+
});
|
|
178
|
+
const f = res.data;
|
|
179
|
+
return {
|
|
180
|
+
id: f.id ?? "",
|
|
181
|
+
name: f.name ?? "",
|
|
182
|
+
mimeType: f.mimeType ?? "",
|
|
183
|
+
size: f.size ?? undefined,
|
|
184
|
+
modifiedTime: f.modifiedTime ?? undefined,
|
|
185
|
+
webViewLink: f.webViewLink ?? undefined,
|
|
186
|
+
parents: f.parents ?? undefined,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=google-drive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-drive.js","sourceRoot":"","sources":["../../src/drive/google-drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAiB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAqBxE;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,KAAK,CAAiB;IAE9B,YAAY,MAAwB;QAClC,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;QAClC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CACzC,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,kBAAkB,CAC1B,CAAC;QACF,YAAY,CAAC,cAAc,CAAC;YAC1B,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC;QAEH,sBAAsB;QACtB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;YACpC,gBAAgB,CAAC;gBACf,GAAG,QAAQ;gBACX,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY;gBAC7D,aAAa,EAAE,SAAS,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa;gBAChE,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW;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G,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;YACxC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,UAAU,EAAE,OAAO,CAAC,WAAW;YAC/B,aAAa,EAAE,eAAe;YAC9B,MAAM,EAAE,8DAA8D;SACvE,CAAC,CAAC;QAEH,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;QACnB,OAAO;YACL,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE;YACd,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE;YAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE;YAC1B,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,SAAS;YACzB,YAAY,EAAE,CAAC,CAAC,YAAY,IAAI,SAAS;YACzC,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,SAAS;YACvC,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,SAAS;SAChC,CAAC;IACJ,CAAC;CACF"}
|
package/dist/obs/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/obs/ui.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/obs/ui.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,IAAI,MAAM,CA8oBxC"}
|
package/dist/obs/ui.js
CHANGED
|
@@ -6,7 +6,8 @@ export function renderIndexHtml() {
|
|
|
6
6
|
<head>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
-
<title>VisionClaw
|
|
9
|
+
<title>VisionClaw</title>
|
|
10
|
+
<link rel="icon" type="image/png" href="https://i.imghippo.com/files/HDPC2282Umg.png" />
|
|
10
11
|
<style>
|
|
11
12
|
:root {
|
|
12
13
|
--bg: #0b1020;
|
|
@@ -23,10 +24,11 @@ export function renderIndexHtml() {
|
|
|
23
24
|
--sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
|
|
24
25
|
}
|
|
25
26
|
body { margin: 0; background: radial-gradient(1200px 800px at 15% 10%, rgba(122,162,255,0.18), transparent 60%), var(--bg); color: var(--text); font-family: var(--sans); }
|
|
26
|
-
header { position: sticky; top: 0; backdrop-filter: blur(10px); background: rgba(
|
|
27
|
-
.wrap { max-width: 1200px; margin: 0 auto; padding:
|
|
27
|
+
header { position: sticky; top: 0; backdrop-filter: blur(10px); background: rgba(22,32,55,0.55); border-bottom: 1px solid var(--border); }
|
|
28
|
+
.wrap { max-width: 1200px; margin: 0 auto; padding: 6px 16px; }
|
|
28
29
|
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
|
|
29
|
-
h1 { margin: 0; font-size: 14px; letter-spacing: 0.2px; font-weight: 650; }
|
|
30
|
+
h1 { margin: 0; font-size: 14px; letter-spacing: 0.2px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
|
|
31
|
+
.logo { width: 44px; height: 44px; border-radius: 8px; background: transparent; }
|
|
30
32
|
.pill { border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--muted); padding: 6px 10px; border-radius: 999px; font-size: 12px; }
|
|
31
33
|
.pill b { color: var(--text); }
|
|
32
34
|
.btn { cursor: pointer; border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text); padding: 8px 10px; border-radius: 10px; font-size: 12px; }
|
|
@@ -134,7 +136,7 @@ export function renderIndexHtml() {
|
|
|
134
136
|
<div class="wrap">
|
|
135
137
|
<div class="row header-bar">
|
|
136
138
|
<div class="row header-info">
|
|
137
|
-
<h1
|
|
139
|
+
<h1><img class="logo" src="https://i.imghippo.com/files/HDPC2282Umg.png" alt="VisionClaw" />VisionClaw</h1>
|
|
138
140
|
<span class="pill">SSE: <span id="sse">connecting…</span></span>
|
|
139
141
|
<span class="pill">Buffer: <b id="count">0</b></span>
|
|
140
142
|
<span class="pill" id="tunnel-pill" style="display:none"><span id="tunnel-url-display"></span></span>
|
package/dist/obs/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/obs/ui.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,oFAAoF;AACpF,MAAM,UAAU,eAAe;IAC7B,OAAO
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/obs/ui.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,oFAAoF;AACpF,MAAM,UAAU,eAAe;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4oBD,CAAC;AACT,CAAC"}
|
|
@@ -8,7 +8,7 @@ const SCOPES = [
|
|
|
8
8
|
"https://www.googleapis.com/auth/gmail.send",
|
|
9
9
|
"https://www.googleapis.com/auth/calendar",
|
|
10
10
|
"https://www.googleapis.com/auth/calendar.events",
|
|
11
|
-
"https://www.googleapis.com/auth/drive
|
|
11
|
+
"https://www.googleapis.com/auth/drive",
|
|
12
12
|
];
|
|
13
13
|
/**
|
|
14
14
|
* Run the Google OAuth2 flow:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-auth.js","sourceRoot":"","sources":["../../src/onboarding/google-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,MAAM,GAAG;IACb,8CAA8C;IAC9C,4CAA4C;IAC5C,0CAA0C;IAC1C,iDAAiD;IACjD,
|
|
1
|
+
{"version":3,"file":"google-auth.js","sourceRoot":"","sources":["../../src/onboarding/google-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,MAAM,GAAG;IACb,8CAA8C;IAC9C,4CAA4C;IAC5C,0CAA0C;IAC1C,iDAAiD;IACjD,uCAAuC;CACxC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,YAA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AC;AACL,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const manageDriveTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
3
|
+
action: z.ZodEnum<{
|
|
4
|
+
list_files: "list_files";
|
|
5
|
+
get_file: "get_file";
|
|
6
|
+
upload_file: "upload_file";
|
|
7
|
+
download_file: "download_file";
|
|
8
|
+
create_folder: "create_folder";
|
|
9
|
+
share_file: "share_file";
|
|
10
|
+
move_file: "move_file";
|
|
11
|
+
delete_file: "delete_file";
|
|
12
|
+
}>;
|
|
13
|
+
file_id: z.ZodOptional<z.ZodString>;
|
|
14
|
+
name: z.ZodOptional<z.ZodString>;
|
|
15
|
+
local_path: z.ZodOptional<z.ZodString>;
|
|
16
|
+
mime_type: z.ZodOptional<z.ZodString>;
|
|
17
|
+
folder_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
query: z.ZodOptional<z.ZodString>;
|
|
19
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
email: z.ZodOptional<z.ZodString>;
|
|
21
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
reader: "reader";
|
|
23
|
+
writer: "writer";
|
|
24
|
+
commenter: "commenter";
|
|
25
|
+
}>>;
|
|
26
|
+
send_notification: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
new_folder_id: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=drive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/tools/drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;EAqZ3B,CAAC"}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tool } from "@anthropic-ai/claude-agent-sdk";
|
|
3
|
+
import { GoogleDriveClient } from "../drive/google-drive.js";
|
|
4
|
+
import { getAgentState } from "../agent/loop.js";
|
|
5
|
+
export const manageDriveTool = tool("manage_drive", `Manage Google Drive files and folders. Use this to list, upload, download, share, move, and delete files in Google Drive.
|
|
6
|
+
|
|
7
|
+
Available actions:
|
|
8
|
+
- list_files: List files in Drive with optional search query and folder filter
|
|
9
|
+
- get_file: Get metadata for a specific file by ID
|
|
10
|
+
- upload_file: Upload a local file to Google Drive
|
|
11
|
+
- download_file: Download a file from Google Drive to a local path
|
|
12
|
+
- create_folder: Create a new folder in Google Drive
|
|
13
|
+
- share_file: Share a file or folder with another user
|
|
14
|
+
- move_file: Move a file to a different folder
|
|
15
|
+
- delete_file: Move a file to trash`, {
|
|
16
|
+
action: z
|
|
17
|
+
.enum([
|
|
18
|
+
"list_files",
|
|
19
|
+
"get_file",
|
|
20
|
+
"upload_file",
|
|
21
|
+
"download_file",
|
|
22
|
+
"create_folder",
|
|
23
|
+
"share_file",
|
|
24
|
+
"move_file",
|
|
25
|
+
"delete_file",
|
|
26
|
+
])
|
|
27
|
+
.describe("Drive action to perform"),
|
|
28
|
+
file_id: z
|
|
29
|
+
.string()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Google Drive file or folder ID (for get_file, download_file, share_file, move_file, delete_file)"),
|
|
32
|
+
name: z
|
|
33
|
+
.string()
|
|
34
|
+
.optional()
|
|
35
|
+
.describe("File or folder name (for create_folder; optional override for upload_file)"),
|
|
36
|
+
local_path: z
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Absolute path to a local file (for upload_file as source, download_file as destination)"),
|
|
40
|
+
mime_type: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe("MIME type of the file being uploaded (optional, e.g. 'image/png', 'application/pdf')"),
|
|
44
|
+
folder_id: z
|
|
45
|
+
.string()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe("Parent folder ID in Drive (for list_files to filter by folder, upload_file or create_folder to set parent)"),
|
|
48
|
+
query: z
|
|
49
|
+
.string()
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("Google Drive search query (for list_files, e.g. \"name contains 'report'\" or \"mimeType = 'application/pdf'\")"),
|
|
52
|
+
max_results: z
|
|
53
|
+
.number()
|
|
54
|
+
.int()
|
|
55
|
+
.min(1)
|
|
56
|
+
.max(100)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Maximum number of files to return for list_files (default: 20)"),
|
|
59
|
+
email: z
|
|
60
|
+
.string()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Email address to share the file with (for share_file)"),
|
|
63
|
+
role: z
|
|
64
|
+
.enum(["reader", "writer", "commenter"])
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Permission role to grant when sharing (for share_file): reader, writer, or commenter"),
|
|
67
|
+
send_notification: z
|
|
68
|
+
.boolean()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Whether to send an email notification when sharing (for share_file, default: false)"),
|
|
71
|
+
new_folder_id: z
|
|
72
|
+
.string()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("ID of the destination folder (for move_file)"),
|
|
75
|
+
}, async (args) => {
|
|
76
|
+
try {
|
|
77
|
+
const state = getAgentState();
|
|
78
|
+
const client = new GoogleDriveClient(state.config);
|
|
79
|
+
switch (args.action) {
|
|
80
|
+
case "list_files": {
|
|
81
|
+
const files = await client.listFiles({
|
|
82
|
+
query: args.query,
|
|
83
|
+
maxResults: args.max_results,
|
|
84
|
+
folderId: args.folder_id,
|
|
85
|
+
});
|
|
86
|
+
if (files.length === 0) {
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: "No files found matching the criteria.",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const lines = files.map((f) => {
|
|
97
|
+
const size = f.size ? ` (${Math.round(Number(f.size) / 1024)} KB)` : "";
|
|
98
|
+
const modified = f.modifiedTime
|
|
99
|
+
? ` — modified ${new Date(f.modifiedTime).toLocaleDateString()}`
|
|
100
|
+
: "";
|
|
101
|
+
const link = f.webViewLink ? `\n Link: ${f.webViewLink}` : "";
|
|
102
|
+
return `- [${f.id}] ${f.name}${size}${modified}${link}`;
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{
|
|
107
|
+
type: "text",
|
|
108
|
+
text: `Found ${files.length} file(s):\n${lines.join("\n")}`,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
case "get_file": {
|
|
114
|
+
if (!args.file_id) {
|
|
115
|
+
return {
|
|
116
|
+
content: [
|
|
117
|
+
{ type: "text", text: "Error: file_id is required for get_file" },
|
|
118
|
+
],
|
|
119
|
+
isError: true,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const file = await client.getFile(args.file_id);
|
|
123
|
+
const size = file.size
|
|
124
|
+
? `\nSize: ${Math.round(Number(file.size) / 1024)} KB`
|
|
125
|
+
: "";
|
|
126
|
+
const modified = file.modifiedTime
|
|
127
|
+
? `\nModified: ${new Date(file.modifiedTime).toLocaleString()}`
|
|
128
|
+
: "";
|
|
129
|
+
const link = file.webViewLink ? `\nLink: ${file.webViewLink}` : "";
|
|
130
|
+
const parents = file.parents?.length
|
|
131
|
+
? `\nParent folder(s): ${file.parents.join(", ")}`
|
|
132
|
+
: "";
|
|
133
|
+
return {
|
|
134
|
+
content: [
|
|
135
|
+
{
|
|
136
|
+
type: "text",
|
|
137
|
+
text: `File: ${file.name}\nID: ${file.id}\nType: ${file.mimeType}${size}${modified}${link}${parents}`,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
case "upload_file": {
|
|
143
|
+
if (!args.local_path) {
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: "Error: local_path is required for upload_file",
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
isError: true,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const result = await client.uploadFile({
|
|
155
|
+
localPath: args.local_path,
|
|
156
|
+
name: args.name,
|
|
157
|
+
mimeType: args.mime_type,
|
|
158
|
+
folderId: args.folder_id,
|
|
159
|
+
});
|
|
160
|
+
const link = result.webViewLink ? `\nView: ${result.webViewLink}` : "";
|
|
161
|
+
const size = result.size
|
|
162
|
+
? ` (${Math.round(Number(result.size) / 1024)} KB)`
|
|
163
|
+
: "";
|
|
164
|
+
return {
|
|
165
|
+
content: [
|
|
166
|
+
{
|
|
167
|
+
type: "text",
|
|
168
|
+
text: `File uploaded: "${result.name}"${size}\nID: ${result.id}${link}`,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
case "download_file": {
|
|
174
|
+
if (!args.file_id) {
|
|
175
|
+
return {
|
|
176
|
+
content: [
|
|
177
|
+
{
|
|
178
|
+
type: "text",
|
|
179
|
+
text: "Error: file_id is required for download_file",
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
isError: true,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (!args.local_path) {
|
|
186
|
+
return {
|
|
187
|
+
content: [
|
|
188
|
+
{
|
|
189
|
+
type: "text",
|
|
190
|
+
text: "Error: local_path is required for download_file",
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
isError: true,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
await client.downloadFile({
|
|
197
|
+
fileId: args.file_id,
|
|
198
|
+
localPath: args.local_path,
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: "text",
|
|
204
|
+
text: `File downloaded to: ${args.local_path}`,
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
case "create_folder": {
|
|
210
|
+
if (!args.name) {
|
|
211
|
+
return {
|
|
212
|
+
content: [
|
|
213
|
+
{
|
|
214
|
+
type: "text",
|
|
215
|
+
text: "Error: name is required for create_folder",
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
isError: true,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const folder = await client.createFolder({
|
|
222
|
+
name: args.name,
|
|
223
|
+
parentId: args.folder_id,
|
|
224
|
+
});
|
|
225
|
+
const link = folder.webViewLink ? `\nView: ${folder.webViewLink}` : "";
|
|
226
|
+
return {
|
|
227
|
+
content: [
|
|
228
|
+
{
|
|
229
|
+
type: "text",
|
|
230
|
+
text: `Folder created: "${folder.name}"\nID: ${folder.id}${link}`,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
case "share_file": {
|
|
236
|
+
if (!args.file_id) {
|
|
237
|
+
return {
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: "text",
|
|
241
|
+
text: "Error: file_id is required for share_file",
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
isError: true,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
if (!args.email) {
|
|
248
|
+
return {
|
|
249
|
+
content: [
|
|
250
|
+
{
|
|
251
|
+
type: "text",
|
|
252
|
+
text: "Error: email is required for share_file",
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
isError: true,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
if (!args.role) {
|
|
259
|
+
return {
|
|
260
|
+
content: [
|
|
261
|
+
{
|
|
262
|
+
type: "text",
|
|
263
|
+
text: "Error: role is required for share_file (reader, writer, or commenter)",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
isError: true,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
await client.shareFile({
|
|
270
|
+
fileId: args.file_id,
|
|
271
|
+
email: args.email,
|
|
272
|
+
role: args.role,
|
|
273
|
+
sendNotification: args.send_notification,
|
|
274
|
+
});
|
|
275
|
+
return {
|
|
276
|
+
content: [
|
|
277
|
+
{
|
|
278
|
+
type: "text",
|
|
279
|
+
text: `File ${args.file_id} shared with ${args.email} as ${args.role}.`,
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
case "move_file": {
|
|
285
|
+
if (!args.file_id) {
|
|
286
|
+
return {
|
|
287
|
+
content: [
|
|
288
|
+
{
|
|
289
|
+
type: "text",
|
|
290
|
+
text: "Error: file_id is required for move_file",
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
isError: true,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
if (!args.new_folder_id) {
|
|
297
|
+
return {
|
|
298
|
+
content: [
|
|
299
|
+
{
|
|
300
|
+
type: "text",
|
|
301
|
+
text: "Error: new_folder_id is required for move_file",
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
isError: true,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
const moved = await client.moveFile({
|
|
308
|
+
fileId: args.file_id,
|
|
309
|
+
newFolderId: args.new_folder_id,
|
|
310
|
+
});
|
|
311
|
+
return {
|
|
312
|
+
content: [
|
|
313
|
+
{
|
|
314
|
+
type: "text",
|
|
315
|
+
text: `File "${moved.name}" moved to folder ${args.new_folder_id}.`,
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
case "delete_file": {
|
|
321
|
+
if (!args.file_id) {
|
|
322
|
+
return {
|
|
323
|
+
content: [
|
|
324
|
+
{
|
|
325
|
+
type: "text",
|
|
326
|
+
text: "Error: file_id is required for delete_file",
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
isError: true,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
await client.deleteFile(args.file_id);
|
|
333
|
+
return {
|
|
334
|
+
content: [
|
|
335
|
+
{
|
|
336
|
+
type: "text",
|
|
337
|
+
text: `File ${args.file_id} moved to trash.`,
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
default: {
|
|
343
|
+
const action = args.action;
|
|
344
|
+
return {
|
|
345
|
+
content: [{ type: "text", text: `Unknown action: ${action}` }],
|
|
346
|
+
isError: true,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
return {
|
|
353
|
+
content: [
|
|
354
|
+
{
|
|
355
|
+
type: "text",
|
|
356
|
+
text: `Drive operation failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
isError: true,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
//# sourceMappingURL=drive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/tools/drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CACjC,cAAc,EACd;;;;;;;;;;oCAUkC,EAClC;IACE,MAAM,EAAE,CAAC;SACN,IAAI,CAAC;QACJ,YAAY;QACZ,UAAU;QACV,aAAa;QACb,eAAe;QACf,eAAe;QACf,YAAY;QACZ,WAAW;QACX,aAAa;KACd,CAAC;SACD,QAAQ,CAAC,yBAAyB,CAAC;IACtC,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,Q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O,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,2BAA2B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;iBACpF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAqBpE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAwBxE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import { manageCalendarTool } from "./calendar.js";
|
|
|
9
9
|
import { manageEmailTool } from "./email.js";
|
|
10
10
|
import { memoryTool } from "./memory.js";
|
|
11
11
|
import { browserTool } from "./browser.js";
|
|
12
|
+
import { setSleepIntervalTool } from "./sleep-interval.js";
|
|
13
|
+
import { manageDriveTool } from "./drive.js";
|
|
12
14
|
import { computerUseClickTool, computerUseScrollTool, computerUseDragTool, computerUseTypeTool, computerUseKeyTool, } from "./computer-use.js";
|
|
13
15
|
/**
|
|
14
16
|
* Create the in-process MCP server that provides all
|
|
@@ -27,6 +29,7 @@ export function createToolServer() {
|
|
|
27
29
|
upgradeTool,
|
|
28
30
|
manageCalendarTool,
|
|
29
31
|
manageEmailTool,
|
|
32
|
+
manageDriveTool,
|
|
30
33
|
memoryTool,
|
|
31
34
|
browserTool,
|
|
32
35
|
computerUseClickTool,
|
|
@@ -34,6 +37,7 @@ export function createToolServer() {
|
|
|
34
37
|
computerUseDragTool,
|
|
35
38
|
computerUseTypeTool,
|
|
36
39
|
computerUseKeyTool,
|
|
40
|
+
setSleepIntervalTool,
|
|
37
41
|
],
|
|
38
42
|
});
|
|
39
43
|
}
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE;YACL,QAAQ;YACR,cAAc;YACd,UAAU;YACV,cAAc;YACd,gBAAgB;YAChB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AoB;YACpB,qBAAqB;YACrB,mBAAmB;YACnB,mBAAmB;YACnB,kBAAkB;YAClB,oBAAoB;SACrB;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep-interval.d.ts","sourceRoot":"","sources":["../../src/tools/sleep-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,oBAAoB;;EAwBhC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tool } from "@anthropic-ai/claude-agent-sdk";
|
|
3
|
+
import { getAgentState } from "../agent/loop.js";
|
|
4
|
+
import { saveConfig } from "../config/index.js";
|
|
5
|
+
export const setSleepIntervalTool = tool("set_sleep_interval", "Change how long the agent sleeps between heartbeat wake-ups. Use this when the user asks you to sleep longer or shorter, or to change the check-in frequency.", {
|
|
6
|
+
minutes: z
|
|
7
|
+
.number()
|
|
8
|
+
.min(1)
|
|
9
|
+
.max(1440)
|
|
10
|
+
.describe("Sleep interval in minutes (1-1440, i.e. up to 24 hours)"),
|
|
11
|
+
}, async (args) => {
|
|
12
|
+
const state = await Promise.resolve(getAgentState());
|
|
13
|
+
const oldMs = state.config.heartbeatIntervalMs;
|
|
14
|
+
state.config.heartbeatIntervalMs = args.minutes * 60 * 1000;
|
|
15
|
+
saveConfig(state.config);
|
|
16
|
+
return {
|
|
17
|
+
content: [
|
|
18
|
+
{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: `Sleep interval changed from ${oldMs / 60000}m to ${args.minutes}m (saved to config).`,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=sleep-interval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep-interval.js","sourceRoot":"","sources":["../../src/tools/sleep-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CACtC,oBAAoB,EACpB,+JAA+J,EAC/J;IACE,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,yDAAyD,CAAC;CACvE,EACD,KAAK,EAAE,IAAI,EAA2B,EAAE;IACtC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAC/C,KAAK,CAAC,MAAM,CAAC,mBAAmB,GAAG,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5D,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,+BAA+B,KAAK,GAAG,KAAK,QAAQ,IAAI,CAAC,OAAO,sBAAsB;aAC7F;SACF;KACF,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visionclaw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "A personal assistant agent that runs on your desktop, receives commands from messaging channels, and executes tasks autonomously.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**/*",
|
|
12
12
|
"dist/builtin-skills/**/*",
|
|
13
|
-
"README.md"
|
|
13
|
+
"README.md",
|
|
14
|
+
"CHANGELOG.md"
|
|
14
15
|
],
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"@anthropic-ai/claude-agent-sdk": "^0.2.42",
|
|
@@ -20,7 +21,6 @@
|
|
|
20
21
|
"better-sqlite3": "^11.7.0",
|
|
21
22
|
"cron-parser": "^4.9.0",
|
|
22
23
|
"discord.js": "^14.25.1",
|
|
23
|
-
"dotenv": "^17.3.1",
|
|
24
24
|
"googleapis": "^144.0.0",
|
|
25
25
|
"node-telegram-bot-api": "^0.66.0",
|
|
26
26
|
"open": "^10.1.0",
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"@types/node": "^22.10.0",
|
|
35
35
|
"@types/node-telegram-bot-api": "^0.64.7",
|
|
36
36
|
"@types/prompts": "^2.4.9",
|
|
37
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
38
|
+
"dotenv": "^17.3.1",
|
|
37
39
|
"esbuild": "^0.27.3",
|
|
38
40
|
"eslint": "^9.39.2",
|
|
39
41
|
"tsx": "^4.19.0",
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
"reconfigure": "tsx scripts/reconfigure.ts",
|
|
58
60
|
"reset-session": "tsx scripts/reset-session.ts",
|
|
59
61
|
"list-profiles": "tsx scripts/list-profiles.ts",
|
|
60
|
-
"
|
|
62
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
63
|
+
"release": "pnpm lint && pnpm build && pnpm version patch && pnpm changelog && git add CHANGELOG.md && git commit --amend --no-edit && pnpm publish"
|
|
61
64
|
}
|
|
62
65
|
}
|