managed-deepagents 0.0.3-dev.38 → 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/dist/connectors.d.ts +2 -7
- package/dist/connectors.d.ts.map +1 -1
- package/dist/connectors.js +1 -18
- package/dist/connectors.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +0 -13
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +12 -39
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/types.d.ts +7 -23
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -12
- package/dist/connectors/langsmith.d.ts +0 -133
- package/dist/connectors/langsmith.d.ts.map +0 -1
- package/dist/connectors/langsmith.js +0 -262
- package/dist/connectors/langsmith.js.map +0 -1
- package/dist/identity.d.ts +0 -273
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js +0 -358
- package/dist/identity.js.map +0 -1
- package/dist/runtime/auth.d.ts +0 -54
- package/dist/runtime/auth.d.ts.map +0 -1
- package/dist/runtime/auth.js +0 -191
- package/dist/runtime/auth.js.map +0 -1
- package/dist/runtime/connector.d.ts +0 -138
- package/dist/runtime/connector.d.ts.map +0 -1
- package/dist/runtime/connector.js +0 -82
- package/dist/runtime/connector.js.map +0 -1
- package/dist/runtime/credentials.d.ts +0 -60
- package/dist/runtime/credentials.d.ts.map +0 -1
- package/dist/runtime/credentials.js +0 -189
- package/dist/runtime/credentials.js.map +0 -1
- package/dist/runtime/identity-http.d.ts +0 -27
- package/dist/runtime/identity-http.d.ts.map +0 -1
- package/dist/runtime/identity-http.js +0 -150
- package/dist/runtime/identity-http.js.map +0 -1
- package/dist/runtime/identity-runtime.d.ts +0 -54
- package/dist/runtime/identity-runtime.d.ts.map +0 -1
- package/dist/runtime/identity-runtime.js +0 -151
- package/dist/runtime/identity-runtime.js.map +0 -1
- package/dist/runtime/langsmith-connector.d.ts +0 -112
- package/dist/runtime/langsmith-connector.d.ts.map +0 -1
- package/dist/runtime/langsmith-connector.js +0 -411
- package/dist/runtime/langsmith-connector.js.map +0 -1
- package/dist/runtime/managed-middleware.d.ts +0 -25
- package/dist/runtime/managed-middleware.d.ts.map +0 -1
- package/dist/runtime/managed-middleware.js +0 -76
- package/dist/runtime/managed-middleware.js.map +0 -1
- package/dist/runtime/managed-tools.d.ts +0 -61
- package/dist/runtime/managed-tools.d.ts.map +0 -1
- package/dist/runtime/managed-tools.js +0 -102
- package/dist/runtime/managed-tools.js.map +0 -1
- package/dist/runtime/validated-token.d.ts +0 -25
- package/dist/runtime/validated-token.d.ts.map +0 -1
- package/dist/runtime/validated-token.js +0 -260
- package/dist/runtime/validated-token.js.map +0 -1
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LangSmith connector — authoring surface.
|
|
3
|
-
*
|
|
4
|
-
* A capability-delegation layer for *external / untrusted* callers (browsers,
|
|
5
|
-
* channels, schedules). The deployment declares a small set of constrained
|
|
6
|
-
* LangSmith capabilities; MDA performs them server-side with the workspace key
|
|
7
|
-
* and returns allowlisted responses. The browser never receives
|
|
8
|
-
* `LANGSMITH_API_KEY`.
|
|
9
|
-
*
|
|
10
|
-
* This module is authoring-only: typed per-resource builders + presets that
|
|
11
|
-
* compile to grants, plus eager validation. The runtime enforcement engine lives
|
|
12
|
-
* in `runtime/langsmith-connector.ts` and is imported lazily by the connector's
|
|
13
|
-
* `http` hook so authoring installs stay light.
|
|
14
|
-
*/
|
|
15
|
-
import { CONNECTOR_BRAND, } from "../runtime/connector.js";
|
|
16
|
-
/** Conservative default `include` allowlists per resource (browser-safe). */
|
|
17
|
-
const DEFAULT_INCLUDE = {
|
|
18
|
-
runs: ["id", "status", "start_time", "end_time", "url", "metadata"],
|
|
19
|
-
feedback: ["id", "run_id", "key", "score", "created_at"],
|
|
20
|
-
examples: ["id", "dataset_id", "created_at"],
|
|
21
|
-
prompts: ["name", "commit_hash", "updated_at"],
|
|
22
|
-
threads: ["thread_id", "created_at", "metadata.title"],
|
|
23
|
-
};
|
|
24
|
-
/** Fields that can never reach a browser without an explicit `allowSensitive`. */
|
|
25
|
-
const SENSITIVE_FIELDS = {
|
|
26
|
-
runs: ["inputs", "outputs", "events"],
|
|
27
|
-
prompts: ["content", "messages"],
|
|
28
|
-
threads: ["messages", "values"],
|
|
29
|
-
};
|
|
30
|
-
/** Constraint keys each resource understands. Unknown keys fail validation. */
|
|
31
|
-
const ALLOWED_CONSTRAINT_KEYS = {
|
|
32
|
-
runs: [],
|
|
33
|
-
feedback: ["keys", "scores", "maxCommentChars", "onePerActor"],
|
|
34
|
-
examples: ["dataset", "allowedFields", "maxExamplesPerThread"],
|
|
35
|
-
annotation_queues: ["queue", "allowedPriorities", "maxNoteChars"],
|
|
36
|
-
prompts: [],
|
|
37
|
-
threads: ["metadataKeys", "maxTitleChars"],
|
|
38
|
-
};
|
|
39
|
-
function omitUndefined(value) {
|
|
40
|
-
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined));
|
|
41
|
-
}
|
|
42
|
-
export function runs(options) {
|
|
43
|
-
return {
|
|
44
|
-
id: options.id,
|
|
45
|
-
exposeTo: options.exposeTo,
|
|
46
|
-
resource: "runs",
|
|
47
|
-
actions: options.actions,
|
|
48
|
-
scope: options.scope,
|
|
49
|
-
response: {
|
|
50
|
-
include: options.include ?? DEFAULT_INCLUDE.runs,
|
|
51
|
-
redact: options.redact ?? SENSITIVE_FIELDS.runs,
|
|
52
|
-
},
|
|
53
|
-
...(options.allowSensitive
|
|
54
|
-
? { allowSensitive: options.allowSensitive }
|
|
55
|
-
: {}),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export function feedback(options) {
|
|
59
|
-
return {
|
|
60
|
-
id: options.id,
|
|
61
|
-
exposeTo: options.exposeTo,
|
|
62
|
-
resource: "feedback",
|
|
63
|
-
actions: options.actions,
|
|
64
|
-
scope: options.scope ?? "run",
|
|
65
|
-
constraints: omitUndefined({
|
|
66
|
-
keys: options.keys,
|
|
67
|
-
scores: options.scores,
|
|
68
|
-
maxCommentChars: options.maxCommentChars,
|
|
69
|
-
onePerActor: options.onePerActor,
|
|
70
|
-
}),
|
|
71
|
-
response: { include: options.include ?? DEFAULT_INCLUDE.feedback },
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
export function examples(options) {
|
|
75
|
-
return {
|
|
76
|
-
id: options.id,
|
|
77
|
-
exposeTo: options.exposeTo,
|
|
78
|
-
resource: "examples",
|
|
79
|
-
actions: options.actions,
|
|
80
|
-
scope: options.scope ?? "thread",
|
|
81
|
-
constraints: omitUndefined({
|
|
82
|
-
dataset: options.dataset,
|
|
83
|
-
allowedFields: options.allowedFields,
|
|
84
|
-
maxExamplesPerThread: options.maxExamplesPerThread,
|
|
85
|
-
}),
|
|
86
|
-
response: { include: options.include ?? DEFAULT_INCLUDE.examples },
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export function annotationQueues(options) {
|
|
90
|
-
return {
|
|
91
|
-
id: options.id,
|
|
92
|
-
exposeTo: options.exposeTo,
|
|
93
|
-
resource: "annotation_queues",
|
|
94
|
-
actions: options.actions,
|
|
95
|
-
scope: options.scope ?? "run",
|
|
96
|
-
constraints: omitUndefined({
|
|
97
|
-
queue: options.queue,
|
|
98
|
-
allowedPriorities: options.allowedPriorities,
|
|
99
|
-
maxNoteChars: options.maxNoteChars,
|
|
100
|
-
}),
|
|
101
|
-
// Enqueue is a write with no readable body; include stays minimal.
|
|
102
|
-
response: { include: ["id"] },
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
export function prompts(options) {
|
|
106
|
-
return {
|
|
107
|
-
id: options.id,
|
|
108
|
-
exposeTo: options.exposeTo,
|
|
109
|
-
resource: "prompts",
|
|
110
|
-
actions: options.actions,
|
|
111
|
-
scope: options.scope ?? "agent",
|
|
112
|
-
response: {
|
|
113
|
-
include: options.include ?? DEFAULT_INCLUDE.prompts,
|
|
114
|
-
redact: options.redact ?? SENSITIVE_FIELDS.prompts,
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
export function threads(options) {
|
|
119
|
-
return {
|
|
120
|
-
id: options.id,
|
|
121
|
-
exposeTo: options.exposeTo,
|
|
122
|
-
resource: "threads",
|
|
123
|
-
actions: options.actions,
|
|
124
|
-
scope: options.scope ?? "actor",
|
|
125
|
-
constraints: omitUndefined({
|
|
126
|
-
metadataKeys: options.metadataKeys,
|
|
127
|
-
maxTitleChars: options.maxTitleChars,
|
|
128
|
-
}),
|
|
129
|
-
response: {
|
|
130
|
-
include: options.include ?? DEFAULT_INCLUDE.threads,
|
|
131
|
-
redact: SENSITIVE_FIELDS.threads,
|
|
132
|
-
},
|
|
133
|
-
...(options.allowSensitive
|
|
134
|
-
? { allowSensitive: options.allowSensitive }
|
|
135
|
-
: {}),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
// --- Presets ---------------------------------------------------------------
|
|
139
|
-
/**
|
|
140
|
-
* The whole browser feedback surface: create/update/delete one bounded feedback
|
|
141
|
-
* per actor on a run, plus capturing the conversation into a fixed dataset.
|
|
142
|
-
* Emits deterministic namespaced ids so the public route contract is stable.
|
|
143
|
-
*/
|
|
144
|
-
export function chatFeedback(options) {
|
|
145
|
-
return [
|
|
146
|
-
feedback({
|
|
147
|
-
id: "langsmith:chat-feedback",
|
|
148
|
-
exposeTo: ["browser"],
|
|
149
|
-
actions: ["create", "update", "delete"],
|
|
150
|
-
scope: "run",
|
|
151
|
-
keys: ["user_score"],
|
|
152
|
-
scores: ["positive", "negative"],
|
|
153
|
-
maxCommentChars: 2000,
|
|
154
|
-
onePerActor: true,
|
|
155
|
-
}),
|
|
156
|
-
examples({
|
|
157
|
-
id: "langsmith:chat-feedback-examples",
|
|
158
|
-
exposeTo: ["browser"],
|
|
159
|
-
actions: ["create"],
|
|
160
|
-
scope: "thread",
|
|
161
|
-
dataset: options.dataset,
|
|
162
|
-
allowedFields: ["messages", "answer", "feedback", "source"],
|
|
163
|
-
}),
|
|
164
|
-
];
|
|
165
|
-
}
|
|
166
|
-
/** A read-only, redacted trace viewer: run summary + share link. */
|
|
167
|
-
export function traceViewer() {
|
|
168
|
-
return [
|
|
169
|
-
runs({
|
|
170
|
-
id: "langsmith:trace-viewer",
|
|
171
|
-
exposeTo: ["browser"],
|
|
172
|
-
actions: ["read", "share"],
|
|
173
|
-
scope: "thread",
|
|
174
|
-
}),
|
|
175
|
-
];
|
|
176
|
-
}
|
|
177
|
-
// --- Validation ------------------------------------------------------------
|
|
178
|
-
/**
|
|
179
|
-
* Fail-closed authoring checks that do not require the identity config. The
|
|
180
|
-
* identity-dependent checks (scope/ingress sanity, tenancy) run when the
|
|
181
|
-
* connector's `http` hook is mounted, where the resolved identity is available.
|
|
182
|
-
*/
|
|
183
|
-
export function validateLangSmithConnector(capabilities) {
|
|
184
|
-
if (capabilities.length === 0) {
|
|
185
|
-
throw new Error("langsmith.connector(...) requires at least one capability.");
|
|
186
|
-
}
|
|
187
|
-
const seen = new Set();
|
|
188
|
-
for (const capability of capabilities) {
|
|
189
|
-
validateCapability(capability, seen);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function validateCapability(capability, seen) {
|
|
193
|
-
if (!capability.id) {
|
|
194
|
-
throw new Error("Every LangSmith capability requires an `id`.");
|
|
195
|
-
}
|
|
196
|
-
if (seen.has(capability.id)) {
|
|
197
|
-
throw new Error(`Duplicate LangSmith capability id: "${capability.id}".`);
|
|
198
|
-
}
|
|
199
|
-
seen.add(capability.id);
|
|
200
|
-
if (capability.exposeTo.length === 0) {
|
|
201
|
-
throw new Error(`LangSmith capability "${capability.id}" must declare at least one exposeTo surface.`);
|
|
202
|
-
}
|
|
203
|
-
if (capability.actions.length === 0) {
|
|
204
|
-
throw new Error(`LangSmith capability "${capability.id}" must declare at least one action.`);
|
|
205
|
-
}
|
|
206
|
-
// Every external-surface grant needs an explicit include allowlist.
|
|
207
|
-
const include = capability.response?.include;
|
|
208
|
-
if (!include || include.length === 0) {
|
|
209
|
-
throw new Error(`LangSmith capability "${capability.id}" must set response.include ` +
|
|
210
|
-
`(fail-closed: unknown fields are dropped).`);
|
|
211
|
-
}
|
|
212
|
-
assertSensitiveOptIn(capability, include);
|
|
213
|
-
assertKnownConstraintKeys(capability);
|
|
214
|
-
}
|
|
215
|
-
function assertSensitiveOptIn(capability, include) {
|
|
216
|
-
const sensitive = SENSITIVE_FIELDS[capability.resource] ?? [];
|
|
217
|
-
const acknowledged = new Set(capability.allowSensitive ?? []);
|
|
218
|
-
const browserExposed = capability.exposeTo.includes("browser");
|
|
219
|
-
if (!browserExposed) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
for (const field of include) {
|
|
223
|
-
const root = field.split(".")[0] ?? field;
|
|
224
|
-
if (sensitive.includes(root) && !acknowledged.has(root)) {
|
|
225
|
-
throw new Error(`LangSmith capability "${capability.id}" includes sensitive field ` +
|
|
226
|
-
`"${root}" for a browser surface. Add allowSensitive: ["${root}"] to ` +
|
|
227
|
-
`acknowledge exposing it.`);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function assertKnownConstraintKeys(capability) {
|
|
232
|
-
const allowed = ALLOWED_CONSTRAINT_KEYS[capability.resource];
|
|
233
|
-
if (!capability.constraints || allowed === undefined) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
for (const key of Object.keys(capability.constraints)) {
|
|
237
|
-
if (!allowed.includes(key)) {
|
|
238
|
-
throw new Error(`LangSmith capability "${capability.id}" has unknown constraint ` +
|
|
239
|
-
`"${key}" for resource "${capability.resource}".`);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Build a branded LangSmith connector from capabilities (or preset-produced
|
|
245
|
-
* capability arrays). Runs {@link validateLangSmithConnector} eagerly, then
|
|
246
|
-
* returns a connector whose `http` hook mounts the enforcement engine.
|
|
247
|
-
*/
|
|
248
|
-
export function connector(...capabilities) {
|
|
249
|
-
const flat = capabilities.flat();
|
|
250
|
-
validateLangSmithConnector(flat);
|
|
251
|
-
const instance = {
|
|
252
|
-
[CONNECTOR_BRAND]: true,
|
|
253
|
-
kind: "langsmith",
|
|
254
|
-
capabilities: flat,
|
|
255
|
-
async http(ctx) {
|
|
256
|
-
const { mountLangSmithRoutes } = await import("../runtime/langsmith-connector.js");
|
|
257
|
-
mountLangSmithRoutes(ctx, flat);
|
|
258
|
-
},
|
|
259
|
-
};
|
|
260
|
-
return instance;
|
|
261
|
-
}
|
|
262
|
-
//# sourceMappingURL=langsmith.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"langsmith.js","sourceRoot":"","sources":["../../src/connectors/langsmith.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,eAAe,GAGhB,MAAM,yBAAyB,CAAC;AAsDjC,6EAA6E;AAC7E,MAAM,eAAe,GAAiD;IACpE,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC;IACnE,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC;IACxD,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;IAC5C,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC;IAC9C,OAAO,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,CAAC;CACvD,CAAC;AAEF,kFAAkF;AAClF,MAAM,gBAAgB,GAAiD;IACrE,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;IACrC,OAAO,EAAE,CAAC,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GAAG,YAAgE;IAEnE,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;IACjC,0BAA0B,CAAC,IAAI,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG;QACf,CAAC,eAAe,CAAC,EAAE,IAAa;QAChC,IAAI,EAAE,WAAoB;QAC1B,YAAY,EAAE,IAAI;QAClB,KAAK,CAAC,IAAI,CAAC,GAAgB;YACzB,MAAM,EAAE,oBAAoB,EAAE,GAC5B,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;YACpD,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/identity.d.ts
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The managed `identity.ts` declaration primitive.
|
|
3
|
-
*
|
|
4
|
-
* A project's root `identity.ts` exports a named `identity` created with
|
|
5
|
-
* `defineIdentity(...)` (or `defineIdentity.preset(...)`). The compiler
|
|
6
|
-
* discovers it, generates the custom-auth handler, and wires thread/memory
|
|
7
|
-
* scoping and downstream credentials. See `specification/identity-final.md`.
|
|
8
|
-
*
|
|
9
|
-
* This module is pure authoring-time config construction plus eager validation —
|
|
10
|
-
* it has no runtime dependency (the `providers.*` helpers return plain data).
|
|
11
|
-
*/
|
|
12
|
-
/** How MDA learns who is calling on the HTTP ingress path (§6). */
|
|
13
|
-
export type HttpIngress = "trusted_backend" | ValidatedTokenIngress;
|
|
14
|
-
/**
|
|
15
|
-
* Browser-direct ingress: MDA verifies the caller's own IdP token server-side
|
|
16
|
-
* and derives identity from its claims (§6.2).
|
|
17
|
-
*/
|
|
18
|
-
export interface ValidatedTokenIngress {
|
|
19
|
-
mode: "validated_token";
|
|
20
|
-
/**
|
|
21
|
-
* The token families this deployment accepts (non-empty). MDA selects a
|
|
22
|
-
* provider per request by the token issuer (`iss`). Use one entry for a single
|
|
23
|
-
* IdP; `id` is required once there is more than one entry.
|
|
24
|
-
*/
|
|
25
|
-
providers: ValidatedTokenProvider[];
|
|
26
|
-
}
|
|
27
|
-
/** A single token family MDA knows how to verify (§6.2). */
|
|
28
|
-
export interface ValidatedTokenProvider {
|
|
29
|
-
/** Label used for routing; required only when there is more than one provider. */
|
|
30
|
-
id?: string;
|
|
31
|
-
/** Expected token issuer (`iss`) — the routing/verification key for real IdP tokens. */
|
|
32
|
-
issuer?: string;
|
|
33
|
-
/** Expected audience (`aud`), so tokens minted for other apps are rejected. */
|
|
34
|
-
audience?: string;
|
|
35
|
-
/** Accepted signing algorithms, e.g. `["RS256"]`. */
|
|
36
|
-
algorithms?: string[];
|
|
37
|
-
/**
|
|
38
|
-
* URL of the IdP's public keys (JWKS). MDA verifies the signature locally —
|
|
39
|
-
* the recommended path for most OAuth/OIDC providers.
|
|
40
|
-
*/
|
|
41
|
-
jwks?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Resolve `jwks`/endpoints from `issuer/.well-known/openid-configuration`
|
|
44
|
-
* instead of a literal `jwks` URL (what `providers.oidc` sets).
|
|
45
|
-
*/
|
|
46
|
-
discover?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Only for opaque tokens: verify by calling the IdP once per request
|
|
49
|
-
* (e.g. Supabase `/auth/v1/user`).
|
|
50
|
-
*/
|
|
51
|
-
introspect?: {
|
|
52
|
-
/** Single introspection endpoint (the common case). */
|
|
53
|
-
url?: string;
|
|
54
|
-
/** Provider-specific endpoint selection by a client header (e.g. Supabase region). */
|
|
55
|
-
regionHeader?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Region value → introspection endpoint. A bare string is the URL (using the
|
|
58
|
-
* shared `headers` below); an object also carries region-specific headers
|
|
59
|
-
* (e.g. a per-region Supabase `apikey`), which override the shared ones.
|
|
60
|
-
*/
|
|
61
|
-
regions?: Record<string, string | {
|
|
62
|
-
url: string;
|
|
63
|
-
headers?: Record<string, string>;
|
|
64
|
-
}>;
|
|
65
|
-
/** Static headers sent with the introspection call (e.g. Supabase `apikey`). */
|
|
66
|
-
headers?: Record<string, string>;
|
|
67
|
-
/** Where MDA puts the user's token when calling the endpoint. Default: "authorization". */
|
|
68
|
-
tokenIn?: "authorization" | "header";
|
|
69
|
-
/** Custom header name when `tokenIn` is "header". */
|
|
70
|
-
header?: string;
|
|
71
|
-
};
|
|
72
|
-
/** MDA issues + verifies short-lived signed tokens for anonymous/guest users. */
|
|
73
|
-
guest?: {
|
|
74
|
-
/** Enable an issue/reissue path for this provider. */
|
|
75
|
-
issue: boolean;
|
|
76
|
-
/** Token lifetime, e.g. "24h". */
|
|
77
|
-
ttl?: string;
|
|
78
|
-
/** Prefix applied to the generated actor id, e.g. "guest:". */
|
|
79
|
-
actorPrefix?: string;
|
|
80
|
-
};
|
|
81
|
-
/** Maps verified token claims → identity envelope fields. */
|
|
82
|
-
claims: {
|
|
83
|
-
/** Claim used as `runtime.identity.actor.id` (e.g. "sub", "email"). */
|
|
84
|
-
actor: string;
|
|
85
|
-
/** Claim used as `runtime.identity.tenant.id` (e.g. "org_id"). */
|
|
86
|
-
tenant?: string;
|
|
87
|
-
/** Claim used as `runtime.identity.actor.email`. */
|
|
88
|
-
email?: string;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/** Which downstream call needs a credential right now (§7). */
|
|
92
|
-
export interface CredentialTarget {
|
|
93
|
-
/** What is being called. */
|
|
94
|
-
kind: "subagent" | "mcp" | "connection" | "langsmith";
|
|
95
|
-
/** The configured name, e.g. "code-reviewer" | "docs" | "github". */
|
|
96
|
-
name: string;
|
|
97
|
-
/** Optional read/write hint so the resolver can mint different tokens (§7.6). */
|
|
98
|
-
intent?: "read" | "write";
|
|
99
|
-
/** Current thread, when the credential is thread-specific. */
|
|
100
|
-
threadId?: string;
|
|
101
|
-
/** Free-form context (e.g. `{ repo, installationId }`); part of the cache key. */
|
|
102
|
-
metadata?: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
/** What a credential resolver returns (§7.2). */
|
|
105
|
-
export interface ResolvedCredential {
|
|
106
|
-
/** Headers MDA attaches to the downstream call (usually Authorization). */
|
|
107
|
-
headers: Record<string, string>;
|
|
108
|
-
/** ISO expiry; MDA caches per (actor, tenant, target) until then. */
|
|
109
|
-
expiresAt?: string;
|
|
110
|
-
}
|
|
111
|
-
/** The frozen identity envelope tools and middleware see (§8). */
|
|
112
|
-
export interface RuntimeIdentity {
|
|
113
|
-
actor: {
|
|
114
|
-
type: "user" | "service";
|
|
115
|
-
id: string;
|
|
116
|
-
email?: string;
|
|
117
|
-
};
|
|
118
|
-
tenant?: {
|
|
119
|
-
id: string;
|
|
120
|
-
};
|
|
121
|
-
source: {
|
|
122
|
-
provider: "http" | "slack" | "schedule" | "cli" | "studio";
|
|
123
|
-
threadId?: string;
|
|
124
|
-
};
|
|
125
|
-
claims?: Record<string, unknown>;
|
|
126
|
-
}
|
|
127
|
-
/** An in-process resolver callback (§7.2). */
|
|
128
|
-
export type CredentialResolver = (args: {
|
|
129
|
-
identity: RuntimeIdentity;
|
|
130
|
-
target: CredentialTarget;
|
|
131
|
-
}) => Promise<ResolvedCredential>;
|
|
132
|
-
/**
|
|
133
|
-
* Provide this (with `scoping.credentials: "custom"`) to mint your own
|
|
134
|
-
* downstream credentials per actor: an in-process callback or a hosted
|
|
135
|
-
* token-exchange endpoint.
|
|
136
|
-
*/
|
|
137
|
-
export type CredentialResolverConfig = {
|
|
138
|
-
resolve: CredentialResolver;
|
|
139
|
-
} | {
|
|
140
|
-
endpoint: {
|
|
141
|
-
url: string;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
/** The tenant boundary (§5). */
|
|
145
|
-
export type Tenancy = "single" | "multi";
|
|
146
|
-
/** Who can open/resume the conversation (§4). */
|
|
147
|
-
export type ThreadScope = "actor" | "channel" | "tenant";
|
|
148
|
-
/** The durable Store namespace prefix (§4). */
|
|
149
|
-
export type MemoryScope = "actor" | "tenant" | "agent" | "none";
|
|
150
|
-
/** Whose token downstream calls carry (§4, §7). */
|
|
151
|
-
export type CredentialScope = "agent" | "actor" | "none" | "custom";
|
|
152
|
-
/** The whole identity config surface (§13.1). */
|
|
153
|
-
export interface IdentityConfig {
|
|
154
|
-
/** How MDA learns who is calling (§6). */
|
|
155
|
-
ingress: {
|
|
156
|
-
http: HttpIngress;
|
|
157
|
-
};
|
|
158
|
-
/** The tenant boundary (§5). */
|
|
159
|
-
tenancy: Tenancy;
|
|
160
|
-
/** The three scoping axes (§4). */
|
|
161
|
-
scoping: {
|
|
162
|
-
/** Who can open/resume the conversation. */
|
|
163
|
-
threads?: ThreadScope;
|
|
164
|
-
/** Durable Store namespace prefix. */
|
|
165
|
-
memory: MemoryScope;
|
|
166
|
-
/** Managed mode, or "custom" when a resolver/endpoint is provided below. */
|
|
167
|
-
credentials?: CredentialScope;
|
|
168
|
-
};
|
|
169
|
-
/** Present when `scoping.credentials` is "custom" (or a resolver is set). */
|
|
170
|
-
credentials?: CredentialResolverConfig;
|
|
171
|
-
}
|
|
172
|
-
/** The object exported from the project's root `identity.ts`. */
|
|
173
|
-
export interface IdentityDefinition {
|
|
174
|
-
readonly kind: "identity";
|
|
175
|
-
readonly config: IdentityConfig;
|
|
176
|
-
}
|
|
177
|
-
/** The archetype presets that expand to a full {@link IdentityConfig} (§3). */
|
|
178
|
-
export type IdentityPresetName = "private-assistant" | "multi-tenant-saas" | "shared-bot" | "internal-tool" | "service";
|
|
179
|
-
/** The signature of {@link defineIdentity}, including its `.preset` helper. */
|
|
180
|
-
export interface DefineIdentity {
|
|
181
|
-
(config: IdentityConfig): IdentityDefinition;
|
|
182
|
-
/**
|
|
183
|
-
* Start from a named archetype and optionally override any subset of it. The
|
|
184
|
-
* headline API for the common case (§3).
|
|
185
|
-
*/
|
|
186
|
-
preset(name: IdentityPresetName, overrides?: DeepPartial<IdentityConfig>): IdentityDefinition;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Declare the identity contract for the deployment.
|
|
190
|
-
*
|
|
191
|
-
* Most developers call {@link defineIdentity.preset} instead. The three scoping
|
|
192
|
-
* axes are the power-user layer underneath.
|
|
193
|
-
*/
|
|
194
|
-
export declare const defineIdentity: DefineIdentity;
|
|
195
|
-
/**
|
|
196
|
-
* A single Supabase region for multi-region introspection. A bare string is the
|
|
197
|
-
* introspection URL (using the shared `${SUPABASE_ANON_KEY}`); an object pins a
|
|
198
|
-
* `projectRef` or explicit `url`, plus an optional region-specific `anonKey`
|
|
199
|
-
* (or raw `headers`) so each region uses its own project and anon key.
|
|
200
|
-
*/
|
|
201
|
-
export type SupabaseRegion = string | {
|
|
202
|
-
projectRef?: string;
|
|
203
|
-
url?: string;
|
|
204
|
-
anonKey?: string;
|
|
205
|
-
headers?: Record<string, string>;
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* Provider integrations — authoring-time sugar over {@link ValidatedTokenProvider}
|
|
209
|
-
* (§6.2). Each returns a plain provider object you can spread-and-override, so
|
|
210
|
-
* there is no new runtime surface.
|
|
211
|
-
*/
|
|
212
|
-
export declare const providers: {
|
|
213
|
-
auth0({ domain, audience, }: {
|
|
214
|
-
domain: string;
|
|
215
|
-
audience?: string;
|
|
216
|
-
}): ValidatedTokenProvider;
|
|
217
|
-
clerk({ domain }: {
|
|
218
|
-
domain: string;
|
|
219
|
-
}): ValidatedTokenProvider;
|
|
220
|
-
okta({ domain, audience, }: {
|
|
221
|
-
domain: string;
|
|
222
|
-
audience?: string;
|
|
223
|
-
}): ValidatedTokenProvider;
|
|
224
|
-
cognito({ userPoolId, region, }: {
|
|
225
|
-
userPoolId: string;
|
|
226
|
-
region: string;
|
|
227
|
-
}): ValidatedTokenProvider;
|
|
228
|
-
entra({ tenantId, audience, }: {
|
|
229
|
-
tenantId: string;
|
|
230
|
-
audience?: string;
|
|
231
|
-
}): ValidatedTokenProvider;
|
|
232
|
-
google({ audience }?: {
|
|
233
|
-
audience?: string;
|
|
234
|
-
}): ValidatedTokenProvider;
|
|
235
|
-
supabase({ projectRef, introspect, regions, regionHeader, }: {
|
|
236
|
-
projectRef?: string;
|
|
237
|
-
introspect?: boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Multi-region introspection: map each region to its Supabase project. A
|
|
240
|
-
* string is a `projectRef`; an object can pin an explicit `url`/`anonKey` (so
|
|
241
|
-
* each region uses its own project + anon key). Only valid with `introspect`.
|
|
242
|
-
*/
|
|
243
|
-
regions?: Record<string, SupabaseRegion>;
|
|
244
|
-
/** Client header carrying the region (default `x-supabase-region`). */
|
|
245
|
-
regionHeader?: string;
|
|
246
|
-
}): ValidatedTokenProvider;
|
|
247
|
-
/** Universal fallback for any OIDC-compliant IdP via discovery. */
|
|
248
|
-
oidc({ issuer, audience, }: {
|
|
249
|
-
issuer: string;
|
|
250
|
-
audience?: string;
|
|
251
|
-
}): ValidatedTokenProvider;
|
|
252
|
-
/**
|
|
253
|
-
* GitHub OAuth access tokens (opaque bearer tokens, not JWTs). MDA verifies
|
|
254
|
-
* each request by calling `GET https://api.github.com/user` with the token.
|
|
255
|
-
*/
|
|
256
|
-
github(): ValidatedTokenProvider;
|
|
257
|
-
/** MDA-issued anonymous/guest tokens. */
|
|
258
|
-
guest({ ttl, actorPrefix, }?: {
|
|
259
|
-
ttl?: string;
|
|
260
|
-
actorPrefix?: string;
|
|
261
|
-
}): ValidatedTokenProvider;
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
* Eagerly reject illegal identity configs at authoring time so misconfig never
|
|
265
|
-
* reaches the compiler or runtime (§4.4).
|
|
266
|
-
*/
|
|
267
|
-
export declare function validateIdentity(config: IdentityConfig): void;
|
|
268
|
-
/** Recursively merge plain objects; arrays and primitives from `patch` win. */
|
|
269
|
-
type DeepPartial<T> = T extends object ? {
|
|
270
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
271
|
-
} : T;
|
|
272
|
-
export {};
|
|
273
|
-
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
DELETED
|
@@ -1 +0,0 @@
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