@zackbart/connecta 0.32.0 → 0.34.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/CHANGELOG.md +98 -0
- package/README.md +95 -116
- package/SECURITY.md +1 -1
- package/bin/connecta.mjs +24 -6
- package/bin/version.mjs +1 -1
- package/dist/access-tokens.d.ts +167 -23
- package/dist/access-tokens.js +676 -140
- package/dist/activity.d.ts +3 -0
- package/dist/agent-identity.js +47 -0
- package/dist/auth/cloudflare-access.js +13 -5
- package/dist/branding.d.ts +7 -0
- package/dist/branding.js +76 -9
- package/dist/call-admission-context.js +15 -0
- package/dist/call-admission.js +30 -43
- package/dist/call-recovery.js +6 -2
- package/dist/catalog-service.js +15 -1
- package/dist/config-value-sources.js +16 -9
- package/dist/config.d.ts +48 -75
- package/dist/config.js +144 -36
- package/dist/connector-access.d.ts +4 -34
- package/dist/connector-access.js +15 -99
- package/dist/connector-caller.d.ts +7 -1
- package/dist/connector-caller.js +4 -2
- package/dist/connectors/api-connector.d.ts +27 -4
- package/dist/connectors/api-connector.js +2 -0
- package/dist/connectors/remote-mcp.js +2 -0
- package/dist/describe-config.d.ts +31 -7
- package/dist/describe-config.js +8 -17
- package/dist/execute.js +1 -11
- package/dist/fix-prompt.js +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +30 -10
- package/dist/invocation.js +5 -3
- package/dist/membership.d.ts +53 -0
- package/dist/membership.js +121 -0
- package/dist/module-contracts.d.ts +23 -6
- package/dist/oauth-callback-outcome.js +2 -2
- package/dist/operator-record.d.ts +2 -2
- package/dist/operator-record.js +2 -4
- package/dist/operator-ui/agents.d.ts +74 -0
- package/dist/operator-ui/agents.js +104 -0
- package/dist/operator-ui/config-summary.js +562 -0
- package/dist/operator-ui/connection-map.js +375 -0
- package/dist/operator-ui/contract.d.ts +149 -28
- package/dist/operator-ui/endpoints.js +221 -0
- package/dist/operator-ui/fix-prompts.js +5 -5
- package/dist/operator-ui/generated.js +5 -4
- package/dist/operator-ui/member-page.js +97 -0
- package/dist/operator-ui/model.d.ts +14 -6
- package/dist/operator-ui/overview.js +134 -0
- package/dist/operator-ui/view.d.ts +107 -37
- package/dist/operator-ui/view.js +163 -86
- package/dist/page-styles.js +5 -3
- package/dist/provider.d.ts +61 -8
- package/dist/provider.js +46 -7
- package/dist/providers/_shared/google/workspace.d.ts +56 -17
- package/dist/providers/_shared/google/workspace.js +34 -8
- package/dist/providers/_shared/rest/tools.js +2 -2
- package/dist/providers/_shared/rest/value-safety.d.ts +50 -0
- package/dist/providers/_shared/rest/value-safety.js +699 -7
- package/dist/providers/ccb/index.js +2 -2
- package/dist/providers/cloudflare/index.js +3 -3
- package/dist/providers/cloudflare/rest.js +25 -3
- package/dist/providers/cloudflare/skill.generated.js +1 -1
- package/dist/providers/cloudflare/value-safety.js +32 -0
- package/dist/providers/docs/index.js +4 -4
- package/dist/providers/docs/skill.generated.js +2 -2
- package/dist/providers/drive/index.js +4 -4
- package/dist/providers/drive/skill.generated.js +2 -2
- package/dist/providers/forms/index.js +4 -4
- package/dist/providers/forms/skill.generated.js +2 -2
- package/dist/providers/gmail/index.js +11 -9
- package/dist/providers/gmail/skill.generated.js +2 -2
- package/dist/providers/mixpanel/index.js +1 -1
- package/dist/providers/mixpanel/skill.generated.js +3 -3
- package/dist/providers/notion/index.d.ts +7 -0
- package/dist/providers/notion/index.js +100 -11
- package/dist/providers/notion/rest.js +45 -5
- package/dist/providers/notion/skill.generated.js +2 -2
- package/dist/providers/notion/value-safety.js +30 -5
- package/dist/providers/overflow/index.js +2 -2
- package/dist/providers/overflow/skill.generated.js +2 -2
- package/dist/providers/planning-center/index.js +2 -2
- package/dist/providers/planning-center/skill.generated.js +4 -4
- package/dist/providers/revenuecat/skill.generated.js +2 -2
- package/dist/providers/sheets/index.d.ts +3 -0
- package/dist/providers/sheets/index.js +7 -4
- package/dist/providers/sheets/skill.generated.js +2 -2
- package/dist/providers/slides/index.js +4 -4
- package/dist/providers/slides/skill.generated.js +2 -2
- package/dist/providers/stripe/rest.js +9 -2
- package/dist/providers/stripe/skill.generated.js +1 -1
- package/dist/providers/stripe/value-safety.js +22 -0
- package/dist/providers/tithely/index.js +1 -1
- package/dist/providers/vercel/index.js +1 -1
- package/dist/providers/vercel/rest.js +20 -2
- package/dist/providers/vercel/skill.generated.js +2 -2
- package/dist/providers/vercel/value-safety.js +22 -0
- package/dist/registry.d.ts +2 -3
- package/dist/registry.js +23 -9
- package/dist/routes/access-tokens.js +82 -75
- package/dist/routes/activity-disclosure.js +17 -18
- package/dist/routes/activity.js +34 -54
- package/dist/routes/actor-labels.js +33 -4
- package/dist/routes/agent-path.js +43 -0
- package/dist/routes/connect.js +16 -12
- package/dist/routes/credentials.js +16 -40
- package/dist/routes/mcp.js +161 -104
- package/dist/routes/oauth-management.js +11 -5
- package/dist/routes/oauth.js +5 -11
- package/dist/routes/operator.js +24 -23
- package/dist/routes/shared.d.ts +60 -20
- package/dist/routes/shared.js +187 -96
- package/dist/routes/ui-config.js +437 -97
- package/dist/routes/ui-data.js +2 -2
- package/dist/routes/ui.js +9 -16
- package/dist/runtime/call-admission.js +9 -0
- package/dist/server.js +5 -0
- package/dist/skills.js +10 -0
- package/dist/storage/keys.js +9 -1
- package/dist/storage/sql.js +5 -1
- package/dist/types.d.ts +29 -7
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +23 -16
- package/dist/usage-guide.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace-address.js +9 -0
- package/dist/workspace-subject.js +23 -0
- package/documentation/README.md +47 -23
- package/documentation/architecture.md +371 -61
- package/documentation/auth.md +897 -249
- package/documentation/code-mode.md +37 -16
- package/documentation/deploying.md +126 -25
- package/documentation/integrating.md +97 -23
- package/documentation/meta-tools.md +50 -31
- package/documentation/migration-0.33.md +352 -0
- package/documentation/migration-0.34.md +67 -0
- package/documentation/operating.md +3 -1
- package/documentation/operator-tests.md +147 -34
- package/documentation/operator-ui.md +519 -64
- package/documentation/provider-auth-migration.md +37 -23
- package/documentation/provider-migration-0.29.md +2 -2
- package/examples/worker/AGENTS.md +37 -9
- package/examples/worker/README.md +127 -61
- package/examples/worker/src/connecta.config.ts +40 -23
- package/examples/worker/wrangler.jsonc +4 -1
- package/package.json +19 -18
- package/templates/node/.env.example +3 -0
- package/templates/node/AGENTS.md +33 -6
- package/templates/node/Dockerfile +2 -2
- package/templates/node/README.md +80 -52
- package/templates/node/docker-compose.yml +3 -2
- package/templates/node/package.json +4 -3
- package/templates/node/src/adopt-token.ts +23 -0
- package/templates/node/src/connecta.config.ts +28 -12
- package/templates/node/src/rotate-token.ts +17 -0
- package/templates/node/src/provision-token.ts +0 -17
|
@@ -25,6 +25,7 @@ export interface Env {
|
|
|
25
25
|
CONNECTA_DATABASE?: string;
|
|
26
26
|
CLERK_PUBLISHABLE_KEY?: string;
|
|
27
27
|
CLERK_SECRET_KEY?: string;
|
|
28
|
+
CONNECTA_MAINTAINERS?: string;
|
|
28
29
|
CONNECTA_CREDENTIAL_KEY?: string;
|
|
29
30
|
CONNECTA_ACTIVITY?: string;
|
|
30
31
|
}
|
|
@@ -76,19 +77,34 @@ export default defineConfig((env: Env) => {
|
|
|
76
77
|
// Required: model-written programs run in a bounded QuickJS child.
|
|
77
78
|
executor: quickJsExecutor(),
|
|
78
79
|
auth: clerk ? [clerk] : [],
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
80
|
+
// Required with Clerk: the Clerk user ids (comma-separated in
|
|
81
|
+
// CONNECTA_MAINTAINERS) who use plain /mcp, which serves every connector,
|
|
82
|
+
// and the operator UI. They alone administer shared credentials, manage
|
|
83
|
+
// agent tokens, and read activity. Everyone else uses a pool that lists
|
|
84
|
+
// them. Agents are never maintainers.
|
|
85
|
+
maintainers: clerk
|
|
86
|
+
? (set("CONNECTA_MAINTAINERS") ?? "")
|
|
87
|
+
.split(",")
|
|
88
|
+
.map((id) => id.trim())
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
: [],
|
|
91
|
+
// Each pool serves exactly its tools to its members: Clerk user ids at
|
|
92
|
+
// /mcp/<name>, and "agent:<name>" for a declared agent at /agent/<name>.
|
|
93
|
+
// A member connects their own account on the pool's personal connectors.
|
|
94
|
+
// `npm run doctor` checks /agent/local-machine with its token. The starter
|
|
95
|
+
// pool is the agent's base pool, its lowest tier (shared connectors, no
|
|
96
|
+
// owner), named after the agent as the agent pool layout requires.
|
|
97
|
+
pools: { "local-machine": { tools: ["time"], members: ["agent:local-machine"] } },
|
|
98
|
+
// Machine clients are agents declared here by name, each with one cta_
|
|
99
|
+
// token. Issue or rotate one locally with
|
|
100
|
+
// `npm run --silent rotate-token -- local-machine`, or as a signed-in
|
|
101
|
+
// maintainer from the operator UI. Removing a name stops its token on the
|
|
102
|
+
// next request.
|
|
103
|
+
agents: ["local-machine"],
|
|
104
|
+
// Always installed: a slot with no issued token refuses every request.
|
|
105
|
+
// Tokens from before agents stop admitting until `npm run adopt-token`
|
|
106
|
+
// binds each machine's token to an agent; human-bound tokens never do.
|
|
83
107
|
accessTokens: accessTokens(storage),
|
|
84
|
-
// Connection management permissions default to none, so the template
|
|
85
|
-
// grants them. Split members from operators with `connectorAccess`,
|
|
86
|
-
// `activityAccess`, and `accessTokenManagement`, each derived from the
|
|
87
|
-
// authenticated identity and never from an MCP argument.
|
|
88
|
-
identity: {
|
|
89
|
-
credentialAdministration: () => "all",
|
|
90
|
-
personalConnection: () => "all",
|
|
91
|
-
},
|
|
92
108
|
vault: credentialKey ? encryptedCredentialVault(storage, credentialKey) : undefined,
|
|
93
109
|
// Payload-free activity history at /activity: who called what, when, how
|
|
94
110
|
// long it took, and whether it worked. Each write prunes rows older than
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trusted local provisioning: issue or rotate one declared agent's token
|
|
3
|
+
* against the same configuration and database the server uses. The previous
|
|
4
|
+
* secret stops working on its next request.
|
|
5
|
+
*/
|
|
6
|
+
import { AccessTokenManager } from "@zackbart/connecta/auth/access-tokens";
|
|
7
|
+
import connectaConfig from "./connecta.config.js";
|
|
8
|
+
|
|
9
|
+
const agent = process.argv[2];
|
|
10
|
+
if (!agent || process.argv.length !== 3) {
|
|
11
|
+
throw new Error("Usage: npm run --silent rotate-token -- <agent>");
|
|
12
|
+
}
|
|
13
|
+
const { storage, agents } = connectaConfig(process.env);
|
|
14
|
+
const manager = new AccessTokenManager(storage!, { agents: agents ?? [] });
|
|
15
|
+
const { token } = await manager.rotate(agent, "local-provisioning");
|
|
16
|
+
// The secret is returned once. Keep stdout private; storage holds its hash.
|
|
17
|
+
process.stdout.write(`${token}\n`);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Trusted local provisioning against the same database the server uses. */
|
|
2
|
-
import { AccessTokenManager } from "@zackbart/connecta/auth/access-tokens";
|
|
3
|
-
import { openSqlite, sqliteStorage } from "@zackbart/connecta/sqlite";
|
|
4
|
-
|
|
5
|
-
const name = process.argv[2];
|
|
6
|
-
if (!name || process.argv.length !== 3) {
|
|
7
|
-
throw new Error('Usage: npm run provision-token -- "machine-name"');
|
|
8
|
-
}
|
|
9
|
-
const database = openSqlite(process.env.CONNECTA_DATABASE || "./.connecta.sqlite");
|
|
10
|
-
try {
|
|
11
|
-
const manager = new AccessTokenManager(sqliteStorage(database));
|
|
12
|
-
const { token } = await manager.create(name, "local-provisioning");
|
|
13
|
-
// The secret is returned once. Keep stdout private; storage holds its hash.
|
|
14
|
-
process.stdout.write(`${token}\n`);
|
|
15
|
-
} finally {
|
|
16
|
-
database.close();
|
|
17
|
-
}
|