@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
package/dist/access-tokens.d.ts
CHANGED
|
@@ -1,38 +1,182 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InboundAuth, KVStorage } from "./types.js";
|
|
2
2
|
import type { AccessTokensModule } from "./module-contracts.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* One declared agent's token slot as management sees it. Never secret
|
|
5
|
+
* material. `revision` is opaque: it changes on every commit to the slot and
|
|
6
|
+
* is what `expect` names to make an operation conditional on this view.
|
|
7
|
+
*/
|
|
8
|
+
export type AgentTokenSlot = {
|
|
5
9
|
name: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
state: "none";
|
|
11
|
+
revision: string;
|
|
12
|
+
} | {
|
|
13
|
+
name: string;
|
|
14
|
+
state: "issued";
|
|
15
|
+
issuedAt: string;
|
|
16
|
+
revision: string;
|
|
17
|
+
} | {
|
|
18
|
+
name: string;
|
|
19
|
+
state: "revoked";
|
|
20
|
+
revokedAt: string;
|
|
21
|
+
revision: string;
|
|
22
|
+
};
|
|
23
|
+
/** A newly issued secret, returned once, and the slot that now admits it. */
|
|
24
|
+
export interface IssuedAgentToken {
|
|
11
25
|
token: string;
|
|
12
|
-
|
|
26
|
+
agent: AgentTokenSlot;
|
|
13
27
|
}
|
|
28
|
+
/** Why a token operation was refused, for routes and provisioning scripts. */
|
|
29
|
+
export declare class AccessTokenError extends Error {
|
|
30
|
+
readonly code: "unknown_agent" | "conflict" | "slot_changed" | "not_adoptable" | "aborted" | "outcome_unknown";
|
|
31
|
+
readonly name = "AccessTokenError";
|
|
32
|
+
constructor(code: "unknown_agent" | "conflict" | "slot_changed" | "not_adoptable" | "aborted" | "outcome_unknown", message: string);
|
|
33
|
+
}
|
|
34
|
+
/** Options every token mutation takes. */
|
|
35
|
+
export interface AccessTokenOperationOptions {
|
|
36
|
+
/**
|
|
37
|
+
* The request this operation serves. Checked before the commit point, the
|
|
38
|
+
* slot's compare-and-set: an abort before it publishes nothing. An abort
|
|
39
|
+
* after a rotation commits revokes the slot, since the secret cannot be
|
|
40
|
+
* delivered.
|
|
41
|
+
*/
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
/**
|
|
44
|
+
* The request's own deadline, in epoch milliseconds, when it has one. The
|
|
45
|
+
* operation ends at the earlier of this and `OPERATION_WINDOW_MS` after it
|
|
46
|
+
* starts.
|
|
47
|
+
*/
|
|
48
|
+
deadline?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The slot `revision` the caller decided from. When set, the operation
|
|
51
|
+
* refuses with `slot_changed` before minting or writing anything if the
|
|
52
|
+
* slot's current revision differs, and its commit compare-and-sets from
|
|
53
|
+
* exactly the slot with that revision, so a change that lands between the
|
|
54
|
+
* read and the commit refuses the same way instead of being overwritten.
|
|
55
|
+
*/
|
|
56
|
+
expect?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Whether `value` has the shape of a slot revision. */
|
|
59
|
+
export declare function isSlotRevision(value: unknown): value is string;
|
|
14
60
|
/**
|
|
15
|
-
*
|
|
61
|
+
* Agent tokens: one slot per agent declared in code. Secret material is never
|
|
16
62
|
* recoverable: authentication indexes a SHA-256 digest of a random 256-bit
|
|
17
|
-
* token,
|
|
63
|
+
* token, and only that digest persists. A token admits only while its record
|
|
64
|
+
* is bound to a currently declared agent and that agent's slot names it.
|
|
18
65
|
*/
|
|
19
66
|
export declare class AccessTokenManager {
|
|
20
67
|
private readonly storage;
|
|
21
68
|
readonly auth: InboundAuth;
|
|
22
|
-
private readonly
|
|
69
|
+
private readonly agents;
|
|
70
|
+
private readonly agentOrder;
|
|
23
71
|
constructor(storage: KVStorage, options?: {
|
|
24
|
-
|
|
72
|
+
agents?: readonly string[];
|
|
25
73
|
});
|
|
74
|
+
private declared;
|
|
26
75
|
private read;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
76
|
+
private readSlot;
|
|
77
|
+
/** One slot per declared agent, in declaration order. */
|
|
78
|
+
list(): Promise<AgentTokenSlot[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Issue the agent's first token, or replace its current one.
|
|
81
|
+
*
|
|
82
|
+
* 1. The slot is read. With `expect`, a slot whose revision differs refuses
|
|
83
|
+
* with `slot_changed` before any secret is minted.
|
|
84
|
+
* 2. The new record and its lookup are written. They are inert: admission
|
|
85
|
+
* requires the slot to name the record.
|
|
86
|
+
* 3. `signal` is checked.
|
|
87
|
+
* 4. One compare-and-set of the slot, from exactly what was read to
|
|
88
|
+
* `issued` with the new record, is the only commit point. From it the
|
|
89
|
+
* new secret admits and the previous one refuses. Of concurrent
|
|
90
|
+
* rotations exactly one commits; the others publish nothing and refuse
|
|
91
|
+
* with `slot_changed` when they named `expect`, a conflict otherwise.
|
|
92
|
+
* 5. If the request has ended once the commit is decided, the secret cannot
|
|
93
|
+
* be delivered, so the slot moves forward to `revoked`. Everything after
|
|
94
|
+
* the commit runs inside one `OperationWindow`; if it cannot settle in
|
|
95
|
+
* time this rejects with `outcome_unknown` ("rotate again"), never success.
|
|
96
|
+
*
|
|
97
|
+
* Nothing is ever deleted except this call's own record and lookup, while
|
|
98
|
+
* they are known to be uncommitted. The previous record and lookup stay
|
|
99
|
+
* behind, inert, because the slot no longer names them.
|
|
100
|
+
*/
|
|
101
|
+
rotate(name: string, issuedBy?: string, options?: AccessTokenOperationOptions): Promise<IssuedAgentToken>;
|
|
102
|
+
/** Whether the agent's slot names `tokenId`, read back inside the window. */
|
|
103
|
+
private slotNames;
|
|
104
|
+
/**
|
|
105
|
+
* Move the slot forward to `revoked` if it still names `tokenId`, inside the
|
|
106
|
+
* window. An unsettled outcome is reported, never swallowed.
|
|
107
|
+
*/
|
|
108
|
+
private revokeIfNamed;
|
|
109
|
+
/**
|
|
110
|
+
* Revoke the agent's token. One compare-and-set of the slot to `revoked` is
|
|
111
|
+
* the commit; `signal` is checked after the read and before it. The record
|
|
112
|
+
* and lookup stay behind, inert. With `expect`, a slot whose revision
|
|
113
|
+
* differs refuses with `slot_changed` before anything is written, and so
|
|
114
|
+
* does a slot that changes between the read and the commit; without it,
|
|
115
|
+
* whatever the slot names by then is revoked instead.
|
|
116
|
+
*/
|
|
117
|
+
revoke(name: string, options?: AccessTokenOperationOptions): Promise<AgentTokenSlot>;
|
|
118
|
+
/**
|
|
119
|
+
* Settle a conditional revocation whose commit went unanswered, inside the
|
|
120
|
+
* window. Only a slot carrying this call's own `revocationId` is its
|
|
121
|
+
* success. A slot still as read is revoked again from exactly that slot,
|
|
122
|
+
* with the same id; anything else is `slot_changed`.
|
|
123
|
+
*/
|
|
124
|
+
private settleRevocation;
|
|
125
|
+
/**
|
|
126
|
+
* Trusted provisioning: let a declared agent keep using a machine token
|
|
127
|
+
* issued before agents. The legacy record is never changed.
|
|
128
|
+
*
|
|
129
|
+
* 1. A write-once claim, `access-token:v1:adopted:<legacy id>`, is set from
|
|
130
|
+
* absent to the agent's name. It is never deleted: once any adoption has
|
|
131
|
+
* started, the legacy token belongs to that agent forever, even after it
|
|
132
|
+
* is revoked or rotated away, so a retired secret can never be adopted
|
|
133
|
+
* again. It is inert to admission; an abort after it leaves the token
|
|
134
|
+
* adoptable only by the same agent.
|
|
135
|
+
* 2. A new record carrying `agent` and the legacy digest is written; it is
|
|
136
|
+
* inert until the slot names it.
|
|
137
|
+
* 3. `signal` is checked.
|
|
138
|
+
* 4. One compare-and-set of the slot from none to `issued` with the new
|
|
139
|
+
* record is the commit. Adopt delivers no secret, so once committed it is
|
|
140
|
+
* completed even if the request ended.
|
|
141
|
+
* 5. The digest's lookup is moved from the legacy record to the new one by
|
|
142
|
+
* compare-and-set; from then the existing secret admits as the agent.
|
|
143
|
+
*
|
|
144
|
+
* The commit and everything after it run inside one `OperationWindow`.
|
|
145
|
+
* Retrying an adoption whose slot already names a record with this digest
|
|
146
|
+
* completes step 5 and succeeds. With `expect`, a slot whose revision
|
|
147
|
+
* differs refuses with `slot_changed` before the claim, and so does a
|
|
148
|
+
* commit that loses its compare-and-set. Human-bound, revoked, and claimed tokens are
|
|
149
|
+
* refused, as is an agent whose slot names anything else.
|
|
150
|
+
*/
|
|
151
|
+
adopt(tokenId: string, name: string, options?: AccessTokenOperationOptions): Promise<AgentTokenSlot>;
|
|
152
|
+
/**
|
|
153
|
+
* Step 4 of adoption, idempotent and inside the window: point the digest's
|
|
154
|
+
* lookup at the record the slot names. If another agent's adoption took the
|
|
155
|
+
* lookup first, this slot can never admit, so it moves forward to `revoked`
|
|
156
|
+
* and this refuses.
|
|
157
|
+
*/
|
|
158
|
+
private completeAdoption;
|
|
159
|
+
/** The declared agent whose issued slot names a record with this digest, if any, read inside the window. */
|
|
160
|
+
private agentCarrying;
|
|
161
|
+
/**
|
|
162
|
+
* Trusted provisioning: the legacy records `adopt` can take, oldest first:
|
|
163
|
+
* unbound, unrevoked, never claimed by an adoption, still the owner of their
|
|
164
|
+
* digest's lookup, and with a digest no declared agent's slot carries. Ids, names and creation times
|
|
165
|
+
* only; never secret material.
|
|
166
|
+
*/
|
|
167
|
+
unboundTokens(): Promise<Array<{
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
createdAt: string;
|
|
171
|
+
}>>;
|
|
33
172
|
private authorize;
|
|
34
173
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
174
|
+
/** accessTokens() takes no options: the agents declared in code bound its slots. */
|
|
175
|
+
type AccessTokensOptions = Record<never, never>;
|
|
176
|
+
/**
|
|
177
|
+
* Agent token authentication and management over the deployment's storage.
|
|
178
|
+
* Reuse the storage that held earlier tokens so their records stay readable;
|
|
179
|
+
* `createConnecta` binds the module to `agents`.
|
|
180
|
+
*/
|
|
181
|
+
export declare function accessTokens(storage: KVStorage, options?: AccessTokensOptions): AccessTokensModule;
|
|
182
|
+
export {};
|