@nightowlsdev/connectors 1.0.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 +48 -0
- package/dist/index.cjs +695 -0
- package/dist/index.d.cts +478 -0
- package/dist/index.d.ts +478 -0
- package/dist/index.js +647 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Night Owls 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/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @nightowlsdev/connectors
|
|
2
|
+
|
|
3
|
+
The connector seam for Night Owls: declare an external service's **actions** (agent-callable tools) once, and materialize them into approval-gated, output-fenced `SwarmTool`s over a pluggable **backend** (env/static now; Nango/OAuth and remote-MCP later) — with no agent-code change when the backend swaps.
|
|
4
|
+
|
|
5
|
+
Engine-wall clean: depends only on `@nightowlsdev/core` + `zod` (no Mastra types in the public surface).
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { defineConnector, staticBackend } from "@nightowlsdev/connectors";
|
|
12
|
+
|
|
13
|
+
// 1. Declare the connector (plain validated data).
|
|
14
|
+
const slack = defineConnector({
|
|
15
|
+
provider: "slack",
|
|
16
|
+
actions: [
|
|
17
|
+
{ name: "slack.post_message", inputSchema: z.object({ channel: z.string(), text: z.string() }),
|
|
18
|
+
op: { method: "POST", path: "/chat.postMessage" } }, // side-effecting → needsApproval defaults true
|
|
19
|
+
{ name: "slack.search", inputSchema: z.object({ q: z.string() }),
|
|
20
|
+
needsApproval: false, op: { method: "GET", path: "/search.messages" } }, // read-only
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// 2. Pick a backend. `staticBackend` is the zero-infra dev/test backend (creds from env/config).
|
|
25
|
+
const backend = staticBackend({
|
|
26
|
+
connections: { slack: { baseUrl: "https://slack.com/api", secretRef: "slack-bot-token" } },
|
|
27
|
+
secrets, // a SecretResolver (resolved at execute time, scoped by the run's tenant)
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 3. Materialize the actions into SwarmTools (e.g. to grant an agent). Each tool:
|
|
31
|
+
// - runs through the SP5 approval gate (needsApproval),
|
|
32
|
+
// - resolves the connection's credential at execute time,
|
|
33
|
+
// - FENCES its untrusted output before it reaches the model.
|
|
34
|
+
const tools = await backend.materialize(slack, ctx);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## What's here (K1)
|
|
38
|
+
|
|
39
|
+
- `defineConnector` — the declarative DSL (provider + actions + optional events; validated).
|
|
40
|
+
- `ConnectorBackend` / `BoundConnection` / `ConnectionRef` — the pluggable-backend seams.
|
|
41
|
+
- `staticBackend` — env/config credentials + a bearer-token HTTP proxy; the zero-infra reference backend.
|
|
42
|
+
- `fenceConnectorOutput` — the per-backend output-fencing contract.
|
|
43
|
+
|
|
44
|
+
## Roadmap (follow-on)
|
|
45
|
+
|
|
46
|
+
- Core wiring: an async, request-context-aware connector-tool resolver for root **and** sub-agents + `defineSwarm({ connectors, backend })`.
|
|
47
|
+
- Slack/Linear/Email connectors; trigger intake (`handleTriggerEvent`); out-of-band human-in-the-loop delivery.
|
|
48
|
+
- `nangoBackend` (per-user OAuth) — see `docs/superpowers/specs/2026-06-15-connectors-architecture-design.md`.
|