managed-deepagents 0.5.0-dev.89 → 0.5.0-dev.90
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/channels/index.d.ts +6 -5
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +6 -5
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/messaging-registry.d.ts +8 -4
- package/dist/channels/messaging-registry.d.ts.map +1 -1
- package/dist/channels/messaging-registry.js +22 -16
- package/dist/channels/messaging-registry.js.map +1 -1
- package/dist/channels/registry-types.d.ts +1 -1
- package/dist/channels/registry-types.d.ts.map +1 -1
- package/dist/channels/registry.d.ts.map +1 -1
- package/dist/channels/registry.js +1 -3
- package/dist/channels/registry.js.map +1 -1
- package/dist/channels/schedule-delivery.js +1 -1
- package/dist/channels/schedule-delivery.js.map +1 -1
- package/dist/{connectors → channels}/slack/adapter-core.d.ts +1 -1
- package/dist/channels/slack/adapter-core.d.ts.map +1 -0
- package/dist/channels/slack/adapter-core.js.map +1 -0
- package/dist/{connectors → channels}/slack/adapter.d.ts +3 -3
- package/dist/channels/slack/adapter.d.ts.map +1 -0
- package/dist/channels/slack/adapter.js.map +1 -0
- package/dist/{connectors → channels}/slack/http.d.ts +4 -4
- package/dist/channels/slack/http.d.ts.map +1 -0
- package/dist/{connectors → channels}/slack/http.js +6 -6
- package/dist/channels/slack/http.js.map +1 -0
- package/dist/channels/slack/index.d.ts +89 -0
- package/dist/channels/slack/index.d.ts.map +1 -0
- package/dist/channels/slack/index.js +148 -0
- package/dist/channels/slack/index.js.map +1 -0
- package/dist/{connectors → channels}/slack/normalize.d.ts +3 -3
- package/dist/channels/slack/normalize.d.ts.map +1 -0
- package/dist/{connectors → channels}/slack/normalize.js +1 -1
- package/dist/channels/slack/normalize.js.map +1 -0
- package/dist/channels/slack/source-thread.d.ts.map +1 -0
- package/dist/channels/slack/source-thread.js.map +1 -0
- package/dist/{connectors → channels}/slack/transport.d.ts +1 -1
- package/dist/channels/slack/transport.d.ts.map +1 -0
- package/dist/{connectors → channels}/slack/transport.js +1 -1
- package/dist/channels/slack/transport.js.map +1 -0
- package/dist/connectors/slack/index.d.ts +10 -79
- package/dist/connectors/slack/index.d.ts.map +1 -1
- package/dist/connectors/slack/index.js +24 -127
- package/dist/connectors/slack/index.js.map +1 -1
- package/dist/connectors/toolserver/catalog.d.ts +4 -10
- package/dist/connectors/toolserver/catalog.d.ts.map +1 -1
- package/dist/connectors/toolserver/catalog.js +6 -54
- package/dist/connectors/toolserver/catalog.js.map +1 -1
- package/dist/connectors/toolserver/index.d.ts +5 -7
- package/dist/connectors/toolserver/index.d.ts.map +1 -1
- package/dist/connectors/toolserver/index.js +4 -6
- package/dist/connectors/toolserver/index.js.map +1 -1
- package/dist/connectors/toolserver/integrations.d.ts +4 -4
- package/dist/connectors/toolserver/integrations.d.ts.map +1 -1
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +1 -1
- package/dist/identity/connect-inference.d.ts +6 -7
- package/dist/identity/connect-inference.d.ts.map +1 -1
- package/dist/identity/connect-inference.js +7 -9
- package/dist/identity/connect-inference.js.map +1 -1
- package/dist/identity/github/connect-http.d.ts +4 -4
- package/dist/identity/github/connect-http.js +4 -4
- package/dist/identity/github/index.d.ts +0 -2
- package/dist/identity/github/index.d.ts.map +1 -1
- package/dist/identity/github/index.js +0 -2
- package/dist/identity/github/index.js.map +1 -1
- package/dist/identity/options.d.ts +2 -3
- package/dist/identity/options.d.ts.map +1 -1
- package/dist/identity/options.js.map +1 -1
- package/dist/identity/slack/connect-http.d.ts +3 -1
- package/dist/identity/slack/connect-http.d.ts.map +1 -1
- package/dist/identity/slack/connect-http.js +3 -1
- package/dist/identity/slack/connect-http.js.map +1 -1
- package/dist/identity/slack/links.d.ts +2 -1
- package/dist/identity/slack/links.d.ts.map +1 -1
- package/dist/identity/slack/links.js +2 -1
- package/dist/identity/slack/links.js.map +1 -1
- package/dist/identity/types.d.ts +1 -1
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/namespaces.d.ts +45 -83
- package/dist/namespaces.d.ts.map +1 -1
- package/dist/namespaces.js +12 -21
- package/dist/namespaces.js.map +1 -1
- package/dist/runtime/auth.d.ts +1 -1
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +13 -3
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/channel.d.ts +91 -0
- package/dist/runtime/channel.d.ts.map +1 -0
- package/dist/runtime/channel.js +98 -0
- package/dist/runtime/channel.js.map +1 -0
- package/dist/runtime/connector.d.ts +1 -1
- package/dist/runtime/connector.js +5 -1
- package/dist/runtime/connector.js.map +1 -1
- package/dist/runtime/cors.d.ts +1 -1
- package/dist/runtime/cors.d.ts.map +1 -1
- package/dist/runtime/cors.js +5 -1
- package/dist/runtime/cors.js.map +1 -1
- package/dist/runtime/http.d.ts +1 -2
- package/dist/runtime/http.d.ts.map +1 -1
- package/dist/runtime/http.js +1 -2
- package/dist/runtime/http.js.map +1 -1
- package/dist/runtime/identity-http.d.ts +8 -3
- package/dist/runtime/identity-http.d.ts.map +1 -1
- package/dist/runtime/identity-http.js +50 -8
- package/dist/runtime/identity-http.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/types.d.ts +8 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/connectors/github/adapter-core.d.ts +0 -15
- package/dist/connectors/github/adapter-core.d.ts.map +0 -1
- package/dist/connectors/github/adapter-core.js +0 -52
- package/dist/connectors/github/adapter-core.js.map +0 -1
- package/dist/connectors/github/define.d.ts +0 -168
- package/dist/connectors/github/define.d.ts.map +0 -1
- package/dist/connectors/github/define.js +0 -72
- package/dist/connectors/github/define.js.map +0 -1
- package/dist/connectors/github/http.d.ts +0 -25
- package/dist/connectors/github/http.d.ts.map +0 -1
- package/dist/connectors/github/http.js +0 -146
- package/dist/connectors/github/http.js.map +0 -1
- package/dist/connectors/github/index.d.ts +0 -121
- package/dist/connectors/github/index.d.ts.map +0 -1
- package/dist/connectors/github/index.js +0 -192
- package/dist/connectors/github/index.js.map +0 -1
- package/dist/connectors/github/match.d.ts +0 -20
- package/dist/connectors/github/match.d.ts.map +0 -1
- package/dist/connectors/github/match.js +0 -41
- package/dist/connectors/github/match.js.map +0 -1
- package/dist/connectors/github/normalize.d.ts +0 -32
- package/dist/connectors/github/normalize.d.ts.map +0 -1
- package/dist/connectors/github/normalize.js +0 -152
- package/dist/connectors/github/normalize.js.map +0 -1
- package/dist/connectors/github/sandbox.d.ts +0 -54
- package/dist/connectors/github/sandbox.d.ts.map +0 -1
- package/dist/connectors/github/sandbox.js +0 -532
- package/dist/connectors/github/sandbox.js.map +0 -1
- package/dist/connectors/github/source-thread.d.ts +0 -24
- package/dist/connectors/github/source-thread.d.ts.map +0 -1
- package/dist/connectors/github/source-thread.js +0 -54
- package/dist/connectors/github/source-thread.js.map +0 -1
- package/dist/connectors/github/transport.d.ts +0 -25
- package/dist/connectors/github/transport.d.ts.map +0 -1
- package/dist/connectors/github/transport.js +0 -106
- package/dist/connectors/github/transport.js.map +0 -1
- package/dist/connectors/langsmith/index.d.ts +0 -397
- package/dist/connectors/langsmith/index.d.ts.map +0 -1
- package/dist/connectors/langsmith/index.js +0 -436
- package/dist/connectors/langsmith/index.js.map +0 -1
- package/dist/connectors/langsmith/routes.d.ts +0 -236
- package/dist/connectors/langsmith/routes.d.ts.map +0 -1
- package/dist/connectors/langsmith/routes.js +0 -1154
- package/dist/connectors/langsmith/routes.js.map +0 -1
- package/dist/connectors/slack/adapter-core.d.ts.map +0 -1
- package/dist/connectors/slack/adapter-core.js.map +0 -1
- package/dist/connectors/slack/adapter.d.ts.map +0 -1
- package/dist/connectors/slack/adapter.js.map +0 -1
- package/dist/connectors/slack/http.d.ts.map +0 -1
- package/dist/connectors/slack/http.js.map +0 -1
- package/dist/connectors/slack/normalize.d.ts.map +0 -1
- package/dist/connectors/slack/normalize.js.map +0 -1
- package/dist/connectors/slack/source-thread.d.ts.map +0 -1
- package/dist/connectors/slack/source-thread.js.map +0 -1
- package/dist/connectors/slack/transport.d.ts.map +0 -1
- package/dist/connectors/slack/transport.js.map +0 -1
- /package/dist/{connectors → channels}/slack/adapter-core.js +0 -0
- /package/dist/{connectors → channels}/slack/adapter.js +0 -0
- /package/dist/{connectors → channels}/slack/source-thread.d.ts +0 -0
- /package/dist/{connectors → channels}/slack/source-thread.js +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stable GitHub source-thread keys for trusted channel ingress.
|
|
3
|
-
*
|
|
4
|
-
* Prefer issue/PR scoped keys when a number is known:
|
|
5
|
-
* `github:<installationId>:<owner>/<repo>#<number>`
|
|
6
|
-
* Otherwise fall back to delivery-scoped keys:
|
|
7
|
-
* `github:<installationId>:<owner>/<repo>:delivery:<deliveryId>`
|
|
8
|
-
* `github:<installationId>:delivery:<deliveryId>`
|
|
9
|
-
*/
|
|
10
|
-
export function encodeGitHubSourceThreadKey(input) {
|
|
11
|
-
const install = input.installationId || "unknown";
|
|
12
|
-
if (input.owner &&
|
|
13
|
-
input.repo &&
|
|
14
|
-
typeof input.number === "number" &&
|
|
15
|
-
Number.isFinite(input.number)) {
|
|
16
|
-
return `github:${install}:${input.owner}/${input.repo}#${input.number}`;
|
|
17
|
-
}
|
|
18
|
-
if (input.owner && input.repo && input.deliveryId) {
|
|
19
|
-
return `github:${install}:${input.owner}/${input.repo}:delivery:${input.deliveryId}`;
|
|
20
|
-
}
|
|
21
|
-
if (input.deliveryId) {
|
|
22
|
-
return `github:${install}:delivery:${input.deliveryId}`;
|
|
23
|
-
}
|
|
24
|
-
return `github:${install}:delivery:unknown`;
|
|
25
|
-
}
|
|
26
|
-
export function decodeGitHubSourceThreadKey(key) {
|
|
27
|
-
const issue = /^github:([^:]+):([^/]+)\/([^#]+)#(\d+)$/.exec(key);
|
|
28
|
-
if (issue) {
|
|
29
|
-
return {
|
|
30
|
-
installationId: issue[1],
|
|
31
|
-
owner: issue[2],
|
|
32
|
-
repo: issue[3],
|
|
33
|
-
number: Number(issue[4]),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const repoDelivery = /^github:([^:]+):([^/]+)\/([^:]+):delivery:(.+)$/.exec(key);
|
|
37
|
-
if (repoDelivery) {
|
|
38
|
-
return {
|
|
39
|
-
installationId: repoDelivery[1],
|
|
40
|
-
owner: repoDelivery[2],
|
|
41
|
-
repo: repoDelivery[3],
|
|
42
|
-
deliveryId: repoDelivery[4],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const delivery = /^github:([^:]+):delivery:(.+)$/.exec(key);
|
|
46
|
-
if (delivery) {
|
|
47
|
-
return {
|
|
48
|
-
installationId: delivery[1],
|
|
49
|
-
deliveryId: delivery[2],
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=source-thread.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-thread.js","sourceRoot":"","sources":["../../../src/connectors/github/source-thread.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,UAAU,2BAA2B,CAAC,KAM3C;IACC,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,IAAI,SAAS,CAAC;IAClD,IACE,KAAK,CAAC,KAAK;QACX,KAAK,CAAC,IAAI;QACV,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAC7B,CAAC;QACD,OAAO,UAAU,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EA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,CAAC,CAAC,CAAE;SACzB,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub App installation transport — PR/issue comments via the REST API.
|
|
3
|
-
*/
|
|
4
|
-
import type { ChannelTransport } from "../../channels/runtime.js";
|
|
5
|
-
export declare const GITHUB_APP_ID_ENV = "GITHUB_APP_ID";
|
|
6
|
-
export declare const GITHUB_APP_PRIVATE_KEY_ENV = "GITHUB_APP_PRIVATE_KEY";
|
|
7
|
-
export declare const GITHUB_INSTALLATION_ID_ENV = "GITHUB_INSTALLATION_ID";
|
|
8
|
-
export interface GitHubAppTransportOptions {
|
|
9
|
-
appId: string;
|
|
10
|
-
privateKey: string;
|
|
11
|
-
installationId: string;
|
|
12
|
-
/** Override fetch (tests). */
|
|
13
|
-
fetch?: typeof fetch;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Build a GitHub App transport from env (`GITHUB_APP_ID`,
|
|
17
|
-
* `GITHUB_APP_PRIVATE_KEY`, `GITHUB_INSTALLATION_ID`), or `undefined` when any
|
|
18
|
-
* required value is missing.
|
|
19
|
-
*/
|
|
20
|
-
export declare function transportFromEnv(env?: NodeJS.ProcessEnv): ChannelTransport | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Build a {@link ChannelTransport} that posts/edits issue comments as the App.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createGitHubAppTransport(options: GitHubAppTransportOptions): ChannelTransport;
|
|
25
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/transport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AACjD,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAEnE,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,gBAAgB,GAAG,SAAS,CAM9B;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,yBAAyB,GACjC,gBAAgB,CAmElB"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub App installation transport — PR/issue comments via the REST API.
|
|
3
|
-
*/
|
|
4
|
-
import { createPrivateKey } from "node:crypto";
|
|
5
|
-
import { SignJWT } from "jose";
|
|
6
|
-
import { fetchWithTimeout, PROVIDER_HTTP_TIMEOUT_MS, } from "../../runtime/http.js";
|
|
7
|
-
export const GITHUB_APP_ID_ENV = "GITHUB_APP_ID";
|
|
8
|
-
export const GITHUB_APP_PRIVATE_KEY_ENV = "GITHUB_APP_PRIVATE_KEY";
|
|
9
|
-
export const GITHUB_INSTALLATION_ID_ENV = "GITHUB_INSTALLATION_ID";
|
|
10
|
-
/**
|
|
11
|
-
* Build a GitHub App transport from env (`GITHUB_APP_ID`,
|
|
12
|
-
* `GITHUB_APP_PRIVATE_KEY`, `GITHUB_INSTALLATION_ID`), or `undefined` when any
|
|
13
|
-
* required value is missing.
|
|
14
|
-
*/
|
|
15
|
-
export function transportFromEnv(env = process.env) {
|
|
16
|
-
const appId = env[GITHUB_APP_ID_ENV] ?? "";
|
|
17
|
-
const privateKey = env[GITHUB_APP_PRIVATE_KEY_ENV] ?? "";
|
|
18
|
-
const installationId = env[GITHUB_INSTALLATION_ID_ENV] ?? "";
|
|
19
|
-
if (!appId || !privateKey || !installationId)
|
|
20
|
-
return undefined;
|
|
21
|
-
return createGitHubAppTransport({ appId, privateKey, installationId });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Build a {@link ChannelTransport} that posts/edits issue comments as the App.
|
|
25
|
-
*/
|
|
26
|
-
export function createGitHubAppTransport(options) {
|
|
27
|
-
const fetchImpl = options.fetch ?? fetch;
|
|
28
|
-
let installationToken;
|
|
29
|
-
async function getInstallationToken() {
|
|
30
|
-
const now = Date.now();
|
|
31
|
-
if (installationToken && installationToken.expiresAt > now + 60_000) {
|
|
32
|
-
return installationToken.token;
|
|
33
|
-
}
|
|
34
|
-
const jwt = await appJwt(options.appId, options.privateKey);
|
|
35
|
-
const res = await fetchWithTimeout(`https://api.github.com/app/installations/${options.installationId}/access_tokens`, {
|
|
36
|
-
method: "POST",
|
|
37
|
-
headers: {
|
|
38
|
-
Authorization: `Bearer ${jwt}`,
|
|
39
|
-
Accept: "application/vnd.github+json",
|
|
40
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
41
|
-
},
|
|
42
|
-
}, PROVIDER_HTTP_TIMEOUT_MS, fetchImpl);
|
|
43
|
-
if (!res.ok) {
|
|
44
|
-
throw new Error(`GitHub installation token failed: ${res.status} ${await res.text()}`);
|
|
45
|
-
}
|
|
46
|
-
const body = (await res.json());
|
|
47
|
-
installationToken = {
|
|
48
|
-
token: body.token,
|
|
49
|
-
expiresAt: Date.parse(body.expires_at),
|
|
50
|
-
};
|
|
51
|
-
return body.token;
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
async post(input) {
|
|
55
|
-
const target = parseConversationId(input.conversationId);
|
|
56
|
-
const token = await getInstallationToken();
|
|
57
|
-
const res = await fetchWithTimeout(`https://api.github.com/repos/${target.owner}/${target.repo}/issues/${target.number}/comments`, {
|
|
58
|
-
method: "POST",
|
|
59
|
-
headers: {
|
|
60
|
-
Authorization: `Bearer ${token}`,
|
|
61
|
-
Accept: "application/vnd.github+json",
|
|
62
|
-
"Content-Type": "application/json",
|
|
63
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
64
|
-
},
|
|
65
|
-
body: JSON.stringify({ body: input.text }),
|
|
66
|
-
}, PROVIDER_HTTP_TIMEOUT_MS, fetchImpl);
|
|
67
|
-
if (!res.ok) {
|
|
68
|
-
throw new Error(`GitHub create comment failed: ${res.status} ${await res.text()}`);
|
|
69
|
-
}
|
|
70
|
-
const body = (await res.json());
|
|
71
|
-
return {
|
|
72
|
-
id: `github-comment:${body.id}`,
|
|
73
|
-
providerMessageId: String(body.id),
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function parseConversationId(conversationId) {
|
|
79
|
-
const match = /^([^/]+)\/([^#]+)#(\d+)$/.exec(conversationId);
|
|
80
|
-
if (!match) {
|
|
81
|
-
throw new Error(`GitHub transport cannot parse conversationId "${conversationId}"`);
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
owner: match[1],
|
|
85
|
-
repo: match[2],
|
|
86
|
-
number: Number(match[3]),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Sign an App JWT. Uses Node `createPrivateKey` so both PKCS#1
|
|
91
|
-
* (`BEGIN RSA PRIVATE KEY`, GitHub's download format) and PKCS#8 PEMs work.
|
|
92
|
-
*/
|
|
93
|
-
async function appJwt(appId, privateKeyPem) {
|
|
94
|
-
const key = createPrivateKey(normalizePem(privateKeyPem));
|
|
95
|
-
const now = Math.floor(Date.now() / 1000);
|
|
96
|
-
return new SignJWT({})
|
|
97
|
-
.setProtectedHeader({ alg: "RS256" })
|
|
98
|
-
.setIssuedAt(now - 60)
|
|
99
|
-
.setExpirationTime(now + 9 * 60)
|
|
100
|
-
.setIssuer(appId)
|
|
101
|
-
.sign(key);
|
|
102
|
-
}
|
|
103
|
-
function normalizePem(key) {
|
|
104
|
-
return key.includes("\\n") ? key.replace(/\\n/g, "\n") : key;
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/connectors/github/transport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AACjD,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AACnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAUnE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,MAAM,KAAK,GAAG,GAAG,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IAC3C,MAAM,UAAU,GAAG,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC;IACzD,MAAM,cAAc,GAAG,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC;IAC7D,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;IAC/D,OAAO,wBAAwB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAkC;IAElC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IACzC,IAAI,iBAAmE,CAAC;IAExE,KAAK,UAAU,oBAAoB;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,SAAS,GAAG,GAAG,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,GAAG,IAAI,CAAC,CAAC;IAC1C,OAAO,IAAI,OAAO,CAAC,EAAE,CAAC;SACnB,kBAAkB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;SACpC,WAAW,CAAC,GAAG,GAAG,EAAE,CAAC;SACrB,iBAAiB,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;SAC/B,SAAS,CAAC,KAAK,CAAC;SAChB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC"}
|
|
@@ -1,397 +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 `./routes.ts` and is mounted synchronously by the
|
|
13
|
-
* connector's `http` hook so routes register before LangGraph captures the
|
|
14
|
-
* custom HTTP app.
|
|
15
|
-
*/
|
|
16
|
-
import type { Connector } from "../../runtime/connector.js";
|
|
17
|
-
/** External caller surfaces, mapped onto identity ingress / `source.provider`. */
|
|
18
|
-
export type LangSmithCallerSurface = "browser" | "backend" | "channel" | "schedule";
|
|
19
|
-
/** Ownership scope MDA proves from `runtime.identity` before the operation. */
|
|
20
|
-
export type LangSmithCapabilityScope = "agent" | "user" | "thread" | "run";
|
|
21
|
-
/** LangSmith resource families the connector can delegate in v0. */
|
|
22
|
-
export type LangSmithResource = "runs" | "threads" | "feedback" | "examples" | "annotation_queues" | "prompts";
|
|
23
|
-
/** Response shaping for a capability (allowlist first, redact as backstop). */
|
|
24
|
-
export interface LangSmithResponseShape {
|
|
25
|
-
include?: string[];
|
|
26
|
-
redact?: string[];
|
|
27
|
-
}
|
|
28
|
-
/** A compiled capability grant. Builders and presets produce these. */
|
|
29
|
-
export interface LangSmithCapability {
|
|
30
|
-
id: string;
|
|
31
|
-
exposeTo: LangSmithCallerSurface[];
|
|
32
|
-
resource: LangSmithResource;
|
|
33
|
-
actions: string[];
|
|
34
|
-
scope: LangSmithCapabilityScope;
|
|
35
|
-
constraints?: Record<string, unknown>;
|
|
36
|
-
response?: LangSmithResponseShape;
|
|
37
|
-
/** Explicit acknowledgement required to include per-resource sensitive fields. */
|
|
38
|
-
allowSensitive?: string[];
|
|
39
|
-
}
|
|
40
|
-
/** Configuration accepted by `connectors.langsmith`. */
|
|
41
|
-
export interface LangSmithConnectorConfig {
|
|
42
|
-
/** Capability grants. Presets return arrays, so nesting is flattened. */
|
|
43
|
-
capabilities: Array<LangSmithCapability | LangSmithCapability[]>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Options for a {@link runs} capability grant.
|
|
47
|
-
*
|
|
48
|
-
* Default response shaping (when `include` / `redact` are omitted):
|
|
49
|
-
* include `id`, `status`, `start_time`, `end_time`, `url`, `metadata`;
|
|
50
|
-
* redact `inputs`, `outputs`, `events`.
|
|
51
|
-
*/
|
|
52
|
-
export interface RunsCapabilityOptions {
|
|
53
|
-
/** Stable capability id used in `POST .../capabilities/{id}`. */
|
|
54
|
-
id: string;
|
|
55
|
-
/** Caller surfaces allowed to invoke this grant. */
|
|
56
|
-
exposeTo: LangSmithCallerSurface[];
|
|
57
|
-
/** Allowed run operations. */
|
|
58
|
-
actions: Array<"read" | "share">;
|
|
59
|
-
/** Ownership boundary proven from `runtime.identity` before the call. */
|
|
60
|
-
scope: LangSmithCapabilityScope;
|
|
61
|
-
/** Response field allowlist (defaults to the browser-safe runs profile). */
|
|
62
|
-
include?: string[];
|
|
63
|
-
/** Fields stripped even if listed in `include` (defaults to sensitive runs fields). */
|
|
64
|
-
redact?: string[];
|
|
65
|
-
/**
|
|
66
|
-
* Explicit opt-in required to include sensitive run fields (`inputs`,
|
|
67
|
-
* `outputs`, `events`) when `exposeTo` includes `browser`.
|
|
68
|
-
*/
|
|
69
|
-
allowSensitive?: string[];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Build a `runs` capability grant (`read` / `share`).
|
|
73
|
-
*
|
|
74
|
-
* Use for redacted trace summaries and share links. Prefer {@link traceViewer}
|
|
75
|
-
* when the default browser surface is enough.
|
|
76
|
-
*
|
|
77
|
-
* @param options - Grant id, surfaces, actions, scope, and optional response shaping.
|
|
78
|
-
* @returns A compiled {@link LangSmithCapability} for the `runs` resource.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* langsmith.runs({
|
|
83
|
-
* id: "app:run-summary",
|
|
84
|
-
* exposeTo: ["browser"],
|
|
85
|
-
* actions: ["read", "share"],
|
|
86
|
-
* scope: "thread",
|
|
87
|
-
* })
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare function runs(options: RunsCapabilityOptions): LangSmithCapability;
|
|
91
|
-
/**
|
|
92
|
-
* Options for a {@link feedback} capability grant.
|
|
93
|
-
*
|
|
94
|
-
* Default response include (when omitted): `id`, `run_id`, `key`, `score`,
|
|
95
|
-
* `created_at`. Default scope: `run`.
|
|
96
|
-
*/
|
|
97
|
-
export interface FeedbackCapabilityOptions {
|
|
98
|
-
/** Stable capability id used in `POST .../capabilities/{id}`. */
|
|
99
|
-
id: string;
|
|
100
|
-
/** Caller surfaces allowed to invoke this grant. */
|
|
101
|
-
exposeTo: LangSmithCallerSurface[];
|
|
102
|
-
/** Allowed feedback operations. */
|
|
103
|
-
actions: Array<"create" | "update" | "delete">;
|
|
104
|
-
/** Ownership boundary; defaults to `run`. */
|
|
105
|
-
scope?: LangSmithCapabilityScope;
|
|
106
|
-
/** Allowlisted feedback keys (e.g. `user_score`). Required. */
|
|
107
|
-
keys: string[];
|
|
108
|
-
/** Allowlisted score/value labels when feedback is categorical. */
|
|
109
|
-
scores?: string[];
|
|
110
|
-
/** Maximum comment length in characters. */
|
|
111
|
-
maxCommentChars?: number;
|
|
112
|
-
/** When true, each user may submit at most one feedback row per run. */
|
|
113
|
-
onePerActor?: boolean;
|
|
114
|
-
/** Response field allowlist (defaults to the browser-safe feedback profile). */
|
|
115
|
-
include?: string[];
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Build a `feedback` capability grant (`create` / `update` / `delete`).
|
|
119
|
-
*
|
|
120
|
-
* Constrains keys, optional categorical scores, comment length, and
|
|
121
|
-
* per-actor uniqueness. Prefer {@link chatFeedback} for the common browser
|
|
122
|
-
* thumbs-up/down + dataset capture surface.
|
|
123
|
-
*
|
|
124
|
-
* @param options - Grant id, surfaces, actions, key/score constraints, and shaping.
|
|
125
|
-
* @returns A compiled {@link LangSmithCapability} for the `feedback` resource.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```ts
|
|
129
|
-
* langsmith.feedback({
|
|
130
|
-
* id: "app:user-score",
|
|
131
|
-
* exposeTo: ["browser"],
|
|
132
|
-
* actions: ["create", "update", "delete"],
|
|
133
|
-
* scope: "run",
|
|
134
|
-
* keys: ["user_score"],
|
|
135
|
-
* scores: ["positive", "negative"],
|
|
136
|
-
* onePerActor: true,
|
|
137
|
-
* })
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
export declare function feedback(options: FeedbackCapabilityOptions): LangSmithCapability;
|
|
141
|
-
/**
|
|
142
|
-
* Options for an {@link examples} capability grant.
|
|
143
|
-
*
|
|
144
|
-
* Default response include (when omitted): `id`, `dataset_id`, `created_at`.
|
|
145
|
-
* Default scope: `thread`.
|
|
146
|
-
*/
|
|
147
|
-
export interface ExamplesCapabilityOptions {
|
|
148
|
-
/** Stable capability id used in `POST .../capabilities/{id}`. */
|
|
149
|
-
id: string;
|
|
150
|
-
/** Caller surfaces allowed to invoke this grant. */
|
|
151
|
-
exposeTo: LangSmithCallerSurface[];
|
|
152
|
-
/** Allowed example operations (currently `create` only). */
|
|
153
|
-
actions: Array<"create">;
|
|
154
|
-
/** Ownership boundary; defaults to `thread`. */
|
|
155
|
-
scope?: LangSmithCapabilityScope;
|
|
156
|
-
/** Target LangSmith dataset name (server-side; not chosen by the client). */
|
|
157
|
-
dataset: string;
|
|
158
|
-
/** Allowlisted top-level fields the client may send on create. */
|
|
159
|
-
allowedFields?: string[];
|
|
160
|
-
/** Cap on examples created per thread for this grant. */
|
|
161
|
-
maxExamplesPerThread?: number;
|
|
162
|
-
/** Response field allowlist (defaults to the browser-safe examples profile). */
|
|
163
|
-
include?: string[];
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Build an `examples` capability grant (`create` into a fixed dataset).
|
|
167
|
-
*
|
|
168
|
-
* The dataset name is fixed in the grant so callers cannot write to arbitrary
|
|
169
|
-
* datasets. Prefer {@link chatFeedback} when pairing with run feedback.
|
|
170
|
-
*
|
|
171
|
-
* @param options - Grant id, surfaces, dataset, and optional field/thread caps.
|
|
172
|
-
* @returns A compiled {@link LangSmithCapability} for the `examples` resource.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* ```ts
|
|
176
|
-
* langsmith.examples({
|
|
177
|
-
* id: "app:capture-thread",
|
|
178
|
-
* exposeTo: ["browser"],
|
|
179
|
-
* actions: ["create"],
|
|
180
|
-
* scope: "thread",
|
|
181
|
-
* dataset: "public-feedback",
|
|
182
|
-
* allowedFields: ["messages", "answer", "feedback", "source"],
|
|
183
|
-
* })
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
export declare function examples(options: ExamplesCapabilityOptions): LangSmithCapability;
|
|
187
|
-
/**
|
|
188
|
-
* Options for an {@link annotationQueues} capability grant.
|
|
189
|
-
*
|
|
190
|
-
* Enqueue is a write with no readable body; the response include is fixed to
|
|
191
|
-
* `["id"]`. Default scope: `run`.
|
|
192
|
-
*/
|
|
193
|
-
export interface AnnotationQueuesCapabilityOptions {
|
|
194
|
-
/** Stable capability id used in `POST .../capabilities/{id}`. */
|
|
195
|
-
id: string;
|
|
196
|
-
/** Caller surfaces allowed to invoke this grant. */
|
|
197
|
-
exposeTo: LangSmithCallerSurface[];
|
|
198
|
-
/** Allowed queue operations (currently `enqueue_run` only). */
|
|
199
|
-
actions: Array<"enqueue_run">;
|
|
200
|
-
/** Ownership boundary; defaults to `run`. */
|
|
201
|
-
scope?: LangSmithCapabilityScope;
|
|
202
|
-
/** Target annotation queue id/name (server-side; not chosen by the client). */
|
|
203
|
-
queue: string;
|
|
204
|
-
/** Allowlisted priority labels when the client may set priority. */
|
|
205
|
-
allowedPriorities?: string[];
|
|
206
|
-
/** Maximum note length in characters. */
|
|
207
|
-
maxNoteChars?: number;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Build an `annotation_queues` capability grant (`enqueue_run` into a fixed queue).
|
|
211
|
-
*
|
|
212
|
-
* The queue is fixed in the grant so callers cannot enqueue into arbitrary
|
|
213
|
-
* queues.
|
|
214
|
-
*
|
|
215
|
-
* @param options - Grant id, surfaces, queue, and optional priority/note limits.
|
|
216
|
-
* @returns A compiled {@link LangSmithCapability} for the `annotation_queues` resource.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* ```ts
|
|
220
|
-
* langsmith.annotationQueues({
|
|
221
|
-
* id: "app:enqueue-review",
|
|
222
|
-
* exposeTo: ["backend"],
|
|
223
|
-
* actions: ["enqueue_run"],
|
|
224
|
-
* scope: "run",
|
|
225
|
-
* queue: "human-review",
|
|
226
|
-
* })
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
export declare function annotationQueues(options: AnnotationQueuesCapabilityOptions): LangSmithCapability;
|
|
230
|
-
/**
|
|
231
|
-
* Options for a {@link prompts} capability grant.
|
|
232
|
-
*
|
|
233
|
-
* Default response shaping (when omitted): include `name`, `commit_hash`,
|
|
234
|
-
* `updated_at`; redact `content`, `messages`. Default scope: `agent`.
|
|
235
|
-
*/
|
|
236
|
-
export interface PromptsCapabilityOptions {
|
|
237
|
-
/** Stable capability id used in `POST .../capabilities/{id}`. */
|
|
238
|
-
id: string;
|
|
239
|
-
/** Caller surfaces allowed to invoke this grant. */
|
|
240
|
-
exposeTo: LangSmithCallerSurface[];
|
|
241
|
-
/** Allowed prompt operations (currently `read_metadata` only). */
|
|
242
|
-
actions: Array<"read_metadata">;
|
|
243
|
-
/** Ownership boundary; defaults to `agent`. */
|
|
244
|
-
scope?: LangSmithCapabilityScope;
|
|
245
|
-
/** Response field allowlist (defaults to the browser-safe prompts profile). */
|
|
246
|
-
include?: string[];
|
|
247
|
-
/** Fields stripped even if listed in `include` (defaults to prompt content). */
|
|
248
|
-
redact?: string[];
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Build a `prompts` capability grant (`read_metadata`).
|
|
252
|
-
*
|
|
253
|
-
* Returns prompt metadata only by default; prompt body fields stay redacted.
|
|
254
|
-
*
|
|
255
|
-
* @param options - Grant id, surfaces, and optional response shaping.
|
|
256
|
-
* @returns A compiled {@link LangSmithCapability} for the `prompts` resource.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* ```ts
|
|
260
|
-
* langsmith.prompts({
|
|
261
|
-
* id: "app:prompt-meta",
|
|
262
|
-
* exposeTo: ["browser"],
|
|
263
|
-
* actions: ["read_metadata"],
|
|
264
|
-
* scope: "agent",
|
|
265
|
-
* })
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
export declare function prompts(options: PromptsCapabilityOptions): LangSmithCapability;
|
|
269
|
-
/**
|
|
270
|
-
* Options for a {@link threads} capability grant.
|
|
271
|
-
*
|
|
272
|
-
* Default response shaping (when omitted): include `thread_id`, `created_at`,
|
|
273
|
-
* `metadata.title`; redact `messages`, `values`. Default scope: `user`.
|
|
274
|
-
*/
|
|
275
|
-
export interface ThreadsCapabilityOptions {
|
|
276
|
-
/** Stable capability id used in `POST .../capabilities/{id}`. */
|
|
277
|
-
id: string;
|
|
278
|
-
/** Caller surfaces allowed to invoke this grant. */
|
|
279
|
-
exposeTo: LangSmithCallerSurface[];
|
|
280
|
-
/** Allowed thread operations. */
|
|
281
|
-
actions: Array<"read" | "update_metadata">;
|
|
282
|
-
/** Ownership boundary; defaults to `user`. */
|
|
283
|
-
scope?: LangSmithCapabilityScope;
|
|
284
|
-
/** Allowlisted metadata keys the client may read or update. */
|
|
285
|
-
metadataKeys?: string[];
|
|
286
|
-
/** Maximum title length when updating thread metadata. */
|
|
287
|
-
maxTitleChars?: number;
|
|
288
|
-
/** Response field allowlist (defaults to the browser-safe threads profile). */
|
|
289
|
-
include?: string[];
|
|
290
|
-
/**
|
|
291
|
-
* Explicit opt-in required to include sensitive thread fields (`messages`,
|
|
292
|
-
* `values`) when `exposeTo` includes `browser`.
|
|
293
|
-
*/
|
|
294
|
-
allowSensitive?: string[];
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Build a `threads` capability grant (`read` / `update_metadata`).
|
|
298
|
-
*
|
|
299
|
-
* Thread message bodies stay redacted unless `allowSensitive` acknowledges
|
|
300
|
-
* them for a browser surface.
|
|
301
|
-
*
|
|
302
|
-
* @param options - Grant id, surfaces, actions, metadata constraints, and shaping.
|
|
303
|
-
* @returns A compiled {@link LangSmithCapability} for the `threads` resource.
|
|
304
|
-
*
|
|
305
|
-
* @example
|
|
306
|
-
* ```ts
|
|
307
|
-
* langsmith.threads({
|
|
308
|
-
* id: "app:thread-title",
|
|
309
|
-
* exposeTo: ["browser"],
|
|
310
|
-
* actions: ["read", "update_metadata"],
|
|
311
|
-
* scope: "user",
|
|
312
|
-
* metadataKeys: ["title"],
|
|
313
|
-
* maxTitleChars: 120,
|
|
314
|
-
* })
|
|
315
|
-
* ```
|
|
316
|
-
*/
|
|
317
|
-
export declare function threads(options: ThreadsCapabilityOptions): LangSmithCapability;
|
|
318
|
-
/**
|
|
319
|
-
* Browser chat feedback preset: thumbs up/down on a run, plus optional dataset
|
|
320
|
-
* capture of the conversation.
|
|
321
|
-
*
|
|
322
|
-
* Expands to two grants with stable capability ids (safe to hard-code in
|
|
323
|
-
* clients):
|
|
324
|
-
*
|
|
325
|
-
* - `langsmith:chat-feedback` — run-scoped {@link feedback} for browsers.
|
|
326
|
-
* Key `user_score`, scores `positive`/`negative`, comments ≤ 2000 chars,
|
|
327
|
-
* `onePerActor: true`.
|
|
328
|
-
* - `langsmith:chat-feedback-examples` — thread-scoped {@link examples} create
|
|
329
|
-
* into `dataset`, allowing fields `messages`, `answer`, `feedback`, `source`.
|
|
330
|
-
*
|
|
331
|
-
* Pass the returned array in `capabilities`.
|
|
332
|
-
*
|
|
333
|
-
* @param options.dataset - LangSmith dataset name for the examples capability.
|
|
334
|
-
* @returns Capability grants for feedback + example capture.
|
|
335
|
-
*
|
|
336
|
-
* @example
|
|
337
|
-
* ```ts
|
|
338
|
-
* export const connector = connectors.langsmith({
|
|
339
|
-
* capabilities: [connectors.langsmith.chatFeedback({ dataset: "public-feedback" })],
|
|
340
|
-
* });
|
|
341
|
-
* // POST /connectors/langsmith/capabilities/langsmith:chat-feedback
|
|
342
|
-
* ```
|
|
343
|
-
*/
|
|
344
|
-
export declare function chatFeedback(options: {
|
|
345
|
-
dataset: string;
|
|
346
|
-
}): LangSmithCapability[];
|
|
347
|
-
/**
|
|
348
|
-
* Browser trace viewer preset: read a redacted run summary and create a share
|
|
349
|
-
* link for the caller's thread.
|
|
350
|
-
*
|
|
351
|
-
* Expands to one grant with a stable capability id:
|
|
352
|
-
*
|
|
353
|
-
* - `langsmith:trace-viewer` — thread-scoped {@link runs} with actions
|
|
354
|
-
* `read` and `share`, exposed to `browser`. Responses include
|
|
355
|
-
* `id` / `status` / `start_time` / `end_time` / `url` / `metadata` and redact
|
|
356
|
-
* `inputs` / `outputs` / `events` by default.
|
|
357
|
-
*
|
|
358
|
-
* Pass the returned array in `capabilities`.
|
|
359
|
-
*
|
|
360
|
-
* @returns Capability grant for redacted run read/share.
|
|
361
|
-
*
|
|
362
|
-
* @example
|
|
363
|
-
* ```ts
|
|
364
|
-
* export const connector = connectors.langsmith({
|
|
365
|
-
* capabilities: [connectors.langsmith.traceViewer()],
|
|
366
|
-
* });
|
|
367
|
-
* // POST /connectors/langsmith/capabilities/langsmith:trace-viewer
|
|
368
|
-
* ```
|
|
369
|
-
*/
|
|
370
|
-
export declare function traceViewer(): LangSmithCapability[];
|
|
371
|
-
/**
|
|
372
|
-
* Fail-closed authoring checks that do not require the identity config. The
|
|
373
|
-
* identity-dependent checks (scope/ingress sanity, tenancy) run when the
|
|
374
|
-
* connector's `http` hook is mounted, where the resolved identity is available.
|
|
375
|
-
*/
|
|
376
|
-
export declare function validateLangSmithConnector(capabilities: LangSmithCapability[]): void;
|
|
377
|
-
/** The branded LangSmith connector (implements only the `http` hook). */
|
|
378
|
-
export interface LangSmithConnector extends Connector {
|
|
379
|
-
readonly kind: "langsmith";
|
|
380
|
-
readonly capabilities: LangSmithCapability[];
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Build a branded LangSmith connector from capabilities (or preset-produced
|
|
384
|
-
* capability arrays). Runs {@link validateLangSmithConnector} eagerly, then
|
|
385
|
-
* returns a connector whose `http` hook mounts the enforcement engine.
|
|
386
|
-
*
|
|
387
|
-
* Mounting must be synchronous: `buildManagedHttpApp` does not await hooks, and
|
|
388
|
-
* LangGraph captures custom routes at import time. A dynamic `import()` here
|
|
389
|
-
* would race that capture and leave connector paths as platform 404s.
|
|
390
|
-
*
|
|
391
|
-
* `args` is a function rather than a schema: capabilities come from the
|
|
392
|
-
* builders above, already typed, and what is left to check is policy that spans
|
|
393
|
-
* fields — a browser-exposed grant acknowledging its sensitive fields,
|
|
394
|
-
* constraint keys that depend on the resource. Those read better as code.
|
|
395
|
-
*/
|
|
396
|
-
export declare const langsmithConnector: (config: LangSmithConnectorConfig) => LangSmithConnector;
|
|
397
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connectors/langsmith/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAG5D,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,+EAA+E;AAC/E,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE3E,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,SAAS,GACT,UAAU,GACV,UAAU,GACV,mBAAmB,GACnB,SAAS,CAAC;AAEd,+EAA+E;AAC/E,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,wBAAwB,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wDAAwD;AACxD,MAAM,WAAW,wBAAwB;IACvC,yEAAyE;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