@1outres/dsh-bot-connector-google 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -2
- package/cordis.patch.yml +6 -0
- package/icon.svg +8 -0
- package/lib/index.js +2268 -0
- package/locale/en.json +6 -0
- package/locale/ja.json +6 -0
- package/package.json +61 -3
- package/src/host/calendar/events.ts +139 -0
- package/src/host/calendar/own.ts +28 -0
- package/src/host/calendar/times.ts +40 -0
- package/src/host/calendar/tools.ts +633 -0
- package/src/host/connectors.ts +41 -0
- package/src/host/endpoints.ts +48 -0
- package/src/host/gmail/addresses.ts +73 -0
- package/src/host/gmail/compose.ts +244 -0
- package/src/host/gmail/events.ts +117 -0
- package/src/host/gmail/io.ts +212 -0
- package/src/host/gmail/message.ts +128 -0
- package/src/host/gmail/mime.ts +139 -0
- package/src/host/gmail/tools.ts +916 -0
- package/src/host/google.ts +93 -0
- package/src/host/kit.ts +62 -0
- package/src/host/provider.ts +53 -0
- package/src/host/scopes.ts +18 -0
- package/src/index.ts +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 1outres
|
|
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/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @1outres/dsh-bot-connector-google
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gmail and Google Calendar for the bots of DeepSeek Harness: two connectors (`gmail`, `gcal`) and the connection provider `google` they act through. Setting it up with a real Google account: [docs/google-connector-setup.md](../../docs/google-connector-setup.md). The design: [docs/specs/bot-connectors.md](../../docs/specs/bot-connectors.md) 9 and 10.
|
|
4
|
+
|
|
5
|
+
- **Accounts.** bot-core signs Google accounts in (OAuth 2.0 authorization code with PKCE, a Web application client, `access_type=offline`, `prompt=consent`) and keeps their refresh tokens in DSH's credential store on the Host. This package names Google's endpoints, the scopes and how an account is identified (`openidconnect.googleapis.com/v1/userinfo`). Every tool takes an `account` (its email or label); bot-core resolves it to one of the bot's assigned accounts and hands the tool `run.connection`. Nothing reaches the bot's VM.
|
|
6
|
+
- **Scopes.** Gmail: `gmail.modify` and `gmail.settings.basic` (the filter tools need it). Calendar: `calendar.events`, `calendar.calendarlist.readonly`, `calendar.freebusy`. Identity: `openid`, `email`, `profile`.
|
|
7
|
+
- **APIs.** `@googleapis/gmail` and `@googleapis/calendar` with a `google-auth-library` `OAuth2Client` that only carries bot-core's access token; a 401 asks bot-core for a fresh token once. Sending is an upload (`message/rfc822`) of a MIME message this package builds (`src/host/gmail/mime.ts`): UTF-8 `text/plain`, RFC 2047 headers, `multipart/mixed` for attachments. The preview a person approves and the MIME sent are made from one model (`src/host/gmail/compose.ts`); no signature or other text is added; arguments with line breaks are refused.
|
|
8
|
+
|
|
9
|
+
## Tools and default permissions
|
|
10
|
+
|
|
11
|
+
| Gmail | Default | Calendar | Default |
|
|
12
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
13
|
+
| search, get_thread, get_message, get_attachment (saves to the VM), list_labels, modify_labels (never TRASH or SPAM), create_label, update_label, list_drafts, get_draft, create_draft, update_draft, list_filters | Allow | list_calendars, list_events, get_event, search_events, freebusy, create_personal_event, update_personal_event (refuses events with guests or another organizer) | Allow |
|
|
14
|
+
| send (attachments: files of the VM, snapshot of their sha256, checked again before sending) | Ask | create_event_with_attendees | Ask |
|
|
15
|
+
| reply (snapshot: the original's headers and, with `quote`, its text; recheck: Message-ID, subject, sender, thread) | Ask | update_event (snapshot of the event; recheck: its etag) | Ask |
|
|
16
|
+
| forward (snapshot: the original's text and, with `include_attachments`, its attachments' sha256) | Ask | delete_event (snapshot, recheck) | Ask |
|
|
17
|
+
| trash, untrash, delete_draft, delete_label, delete_filter (each with a snapshot of what it acts on), create_filter | Ask | respond (snapshot, recheck; the organizer is told) | Ask |
|
|
18
|
+
|
|
19
|
+
bot-core adds `gmail_accounts` / `gcal_accounts` (Allow), and `*_events_list` / `*_events_ack` (Allow, Main) while the bot gets the events in a queue. Not built: permanent deletion, sending a draft, vacation replies, forwarding and send-as settings, quick add, calendar sharing.
|
|
20
|
+
|
|
21
|
+
## Events
|
|
22
|
+
|
|
23
|
+
- `gmail.message.received`: `users.history.list` (`messageAdded`, label `INBOX`) from the last `historyId`, every 60 s. The first poll stores `users.getProfile`'s `historyId`. A 404 (history gone) starts again from the profile and reports a gap.
|
|
24
|
+
- `gcal.event.created` / `updated` / `cancelled`: `events.list` with a sync token per calendar the account can write to, every 120 s. A calendar seen for the first time is synced to get its token; a 410 syncs it again and reports a gap. Changes the calendar tools made in this process within 30 minutes are marked `own` (kept, never told).
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
| Field | Default | |
|
|
29
|
+
| -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `development.googleOrigin` | `""` | **Development and tests only.** An origin that serves a fake Google under Google's paths (`dev/fake-google`). Empty uses Google. bot-core never refreshes a connection at another token endpoint than the one that signed it in. |
|
|
31
|
+
|
|
32
|
+
## Fake Google
|
|
33
|
+
|
|
34
|
+
`dev/fake-google` (repository root, never published): OAuth (an account picker), userinfo, and the Gmail and Calendar endpoints the tools call, in memory; `/_admin/deliver`, `/_admin/change-password`, `/_admin/expire-history`, `/_admin/calendar-event`, `/_admin/sent` play the outside world. `node dev/fake-google/cli.js --host <ip> --port <port>` prints the origin and the fake client id and secret. `test/google.test.ts` runs the connectors against it through bot-core's own modules.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Installs this plugin on its own (dsh plugin add @1outres/dsh-bot-connector-google).
|
|
2
|
+
# The @1outres/dsh-bots bundle inserts the same "bot-connector-google" row, so select
|
|
3
|
+
# one bundle or the other, never both.
|
|
4
|
+
- insert:
|
|
5
|
+
- id: bot-connector-google
|
|
6
|
+
name: "@1outres/dsh-bot-connector-google"
|
package/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none" role="img" aria-labelledby="title">
|
|
2
|
+
<title id="title">Gmail and calendar for bots</title>
|
|
3
|
+
<rect x="2" y="2" width="60" height="60" rx="14" fill="#1A73E8"/>
|
|
4
|
+
<rect x="13" y="19" width="38" height="27" rx="4" fill="#FFFFFF"/>
|
|
5
|
+
<path d="M15 22l17 12 17-12" stroke="#1A73E8" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<rect x="38" y="36" width="16" height="16" rx="3" fill="#FFFFFF" stroke="#1A73E8" stroke-width="2"/>
|
|
7
|
+
<path d="M42 34v4M50 34v4M38 41h16" stroke="#1A73E8" stroke-width="2" stroke-linecap="round"/>
|
|
8
|
+
</svg>
|