@mastra/ring-signals 0.0.0 → 0.1.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.md +32 -0
- package/README.md +38 -3
- package/dist/crypto.d.ts +35 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/index.cjs +958 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +952 -0
- package/dist/index.js.map +1 -0
- package/dist/ring-api.d.ts +45 -0
- package/dist/ring-api.d.ts.map +1 -0
- package/dist/ring-signals.d.ts +106 -0
- package/dist/ring-signals.d.ts.map +1 -0
- package/dist/types.d.ts +166 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +59 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Portions of this software are licensed as follows:
|
|
2
|
+
|
|
3
|
+
- All content that resides under any directory named `ee/` within this
|
|
4
|
+
repository, including but not limited to:
|
|
5
|
+
- `@mastra/core/auth/ee`
|
|
6
|
+
- `@mastra/core/agent-builder/ee`
|
|
7
|
+
- `@mastra/editor/ee`
|
|
8
|
+
|
|
9
|
+
is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
|
|
10
|
+
|
|
11
|
+
- All third-party components incorporated into the Mastra Software are
|
|
12
|
+
licensed under the original license provided by the owner of the
|
|
13
|
+
applicable component.
|
|
14
|
+
|
|
15
|
+
- Content outside of the above-mentioned directories or restrictions is
|
|
16
|
+
available under the "Apache License 2.0" as defined below.
|
|
17
|
+
|
|
18
|
+
# Apache License 2.0
|
|
19
|
+
|
|
20
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
21
|
+
|
|
22
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
you may not use this file except in compliance with the License.
|
|
24
|
+
You may obtain a copy of the License at
|
|
25
|
+
|
|
26
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
|
|
28
|
+
Unless required by applicable law or agreed to in writing, software
|
|
29
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
30
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
+
See the License for the specific language governing permissions and
|
|
32
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
# @mastra/ring-signals
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@mastra/ring-signals` connects Ring doorbells and cameras to Mastra agents. It receives Ring webhooks, sends each event to an agent thread as a notification signal, and adds `ring_snapshot` and `ring_clip` tools so the agent can fetch a still image or video clip for an event.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/ring-signals
|
|
9
|
+
npm install @mastra/memory
|
|
7
10
|
```
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Add `RingSignals` to an agent's `signals`. Mastra adds the Ring account-linking, webhook, and media routes to the server when the agent is registered. Linked accounts are saved in Mastra storage, so the Mastra instance needs a storage adapter.
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { Agent } from '@mastra/core/agent';
|
|
18
|
+
import { Memory } from '@mastra/memory';
|
|
19
|
+
import { RingSignals } from '@mastra/ring-signals';
|
|
20
|
+
|
|
21
|
+
export const homeAgent = new Agent({
|
|
22
|
+
id: 'home-agent',
|
|
23
|
+
name: 'Home Agent',
|
|
24
|
+
instructions: 'Watch the front door and say briefly whether each event needs attention.',
|
|
25
|
+
model: 'openai/gpt-6.1-sol',
|
|
26
|
+
memory: new Memory(),
|
|
27
|
+
signals: [new RingSignals()],
|
|
28
|
+
});
|
|
9
29
|
```
|
|
30
|
+
|
|
31
|
+
`RING_CLIENT_ID`, `RING_CLIENT_SECRET`, `RING_HMAC_KEY`, and `RING_BASE_URL` are read from the environment by default.
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
- [Ring](https://mastra.ai/integrations/channels/ring)
|
|
36
|
+
- [RingSignals reference](https://mastra.ai/reference/signals/ring-signals)
|
|
37
|
+
|
|
38
|
+
## Changelog
|
|
39
|
+
|
|
40
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/signals/ring/CHANGELOG.md) for version history and release notes.
|
|
41
|
+
|
|
42
|
+
## Support
|
|
43
|
+
|
|
44
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encrypt a string with AES-256-GCM using an HKDF-SHA256 derived key.
|
|
3
|
+
* Format: `aes-256-gcm-hkdf:base64(salt):base64(iv):base64(authTag):base64(ciphertext)`
|
|
4
|
+
*/
|
|
5
|
+
export declare function encrypt(plaintext: string, key: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Decrypt a value produced by `encrypt()`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function decrypt(ciphertext: string, key: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Constant-time string comparison.
|
|
12
|
+
*/
|
|
13
|
+
export declare function safeEqual(a: string, b: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Ring account-linking nonce: `HMAC-SHA256(key, "<time>:<accountId>")`, URL-safe base64 without padding.
|
|
16
|
+
*/
|
|
17
|
+
export declare function computeLinkNonce(hmacKey: string, time: string, accountId: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Ring webhook signature: `sha256=` + hex HMAC-SHA256 of the raw request body.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeWebhookSignature(hmacKey: string, rawBody: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a value was produced by `encrypt()`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isEncrypted(value: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Derive the key that signs media URLs from the Ring HMAC key, so the key Ring uses
|
|
28
|
+
* to sign webhooks isn't also used to sign URLs that end up in thread history.
|
|
29
|
+
*/
|
|
30
|
+
export declare function deriveMediaKey(hmacKey: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Sign a media URL path and its expiry so the media route can't be used as an open proxy to Ring.
|
|
33
|
+
*/
|
|
34
|
+
export declare function signMediaPath(mediaKey: string, path: string, expires: number): string;
|
|
35
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ9D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAU/D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAIvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErF"}
|