@introspection-sdk/introspection-node 0.21.1 → 0.23.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/README.md +46 -0
- package/dist/client.d.ts +18 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +39 -6
- package/dist/client.js.map +1 -1
- package/dist/http.d.ts +5 -4
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +9 -5
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/annotations.d.ts +28 -0
- package/dist/resources/annotations.d.ts.map +1 -0
- package/dist/resources/annotations.js +198 -0
- package/dist/resources/annotations.js.map +1 -0
- package/dist/resources/connectors.d.ts +94 -0
- package/dist/resources/connectors.d.ts.map +1 -0
- package/dist/resources/connectors.js +170 -0
- package/dist/resources/connectors.js.map +1 -0
- package/dist/resources/experiments.d.ts +6 -6
- package/dist/resources/experiments.d.ts.map +1 -1
- package/dist/resources/experiments.js +29 -6
- package/dist/resources/experiments.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -54,6 +54,52 @@ teardown.
|
|
|
54
54
|
Interrupted runs resume through
|
|
55
55
|
`runner.tasks.runs.resume(taskId, { resume: entries })`.
|
|
56
56
|
|
|
57
|
+
### Annotations
|
|
58
|
+
|
|
59
|
+
Annotations capture what a domain expert found good or bad on an OTel span. They
|
|
60
|
+
are labels, comments, and assignments—not numeric scores. Writes require an
|
|
61
|
+
authenticated business-member token with `annotations:write`; project API
|
|
62
|
+
keys and sandbox credentials cannot write annotations.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const client = new IntrospectionClient({
|
|
66
|
+
token: memberAccessToken,
|
|
67
|
+
cpSession: encodedMemberSession,
|
|
68
|
+
advanced: {
|
|
69
|
+
baseApiUrl: "https://api.introspection.dev", // Control Plane
|
|
70
|
+
dpUrl: memberDataPlaneUrl,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const span = {
|
|
75
|
+
trace_id: "0123456789abcdef0123456789abcdef",
|
|
76
|
+
span_id: "0123456789abcdef",
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
await client.projectLabels.create({
|
|
80
|
+
slug: "strong-structure",
|
|
81
|
+
color: "#f97316",
|
|
82
|
+
description: "A useful structure to preserve during distillation",
|
|
83
|
+
});
|
|
84
|
+
await client.annotations.create(span, { labels: ["strong-structure"] });
|
|
85
|
+
await client.annotations.create(span, {
|
|
86
|
+
comment: "Keep the conclusion before the evidence.",
|
|
87
|
+
});
|
|
88
|
+
await client.annotations.create(span, {
|
|
89
|
+
reviewerEmails: ["expert@example.com"],
|
|
90
|
+
});
|
|
91
|
+
await client.annotations.create(span, { reviewerEmails: [] });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Labels and reviewers are complete snapshots; pass `[]` to clear one. Comments
|
|
95
|
+
append. Every mutation gets a UUIDv7 `event_id` before its
|
|
96
|
+
first transport attempt, so an automatic retry remains one event. Supply
|
|
97
|
+
`{ event_id }` as the final method argument when retrying across processes.
|
|
98
|
+
`client.annotations.list()` and `client.projectLabels.list()` are both awaitable
|
|
99
|
+
for the first page and async-iterable across every cursor page.
|
|
100
|
+
Read immutable annotation history with
|
|
101
|
+
`client.events.list({ event_name: "introspection.annotation", trace_id, span_id })`.
|
|
102
|
+
|
|
57
103
|
## Pi instrumentation
|
|
58
104
|
|
|
59
105
|
Pi is the supported agent-instrumentation path:
|
package/dist/client.d.ts
CHANGED
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
* `@introspection-sdk/introspection-node/otel`.
|
|
13
13
|
*/
|
|
14
14
|
import type { AdvancedOptions } from "@introspection-sdk/types";
|
|
15
|
+
import { EventsApi } from "@introspection-sdk/http";
|
|
15
16
|
import type { IntrospectionClientOptions } from "./types.js";
|
|
16
17
|
import { type ServiceAccountTokenParams } from "./auth.js";
|
|
17
18
|
import { HttpClient } from "./http.js";
|
|
18
19
|
import { type RuntimeHandleFactory, type RuntimesApi } from "./resources/runtimes.js";
|
|
19
20
|
import { type ExperimentHandleFactory, type ExperimentsApi } from "./resources/experiments.js";
|
|
20
21
|
import { type RecipesApi } from "./resources/recipes.js";
|
|
22
|
+
import { type ConnectorsApi } from "./resources/connectors.js";
|
|
23
|
+
import { type AnnotationsApi, type ProjectLabelsApi } from "./resources/annotations.js";
|
|
21
24
|
/**
|
|
22
25
|
* Introspection REST client.
|
|
23
26
|
*
|
|
@@ -41,6 +44,8 @@ import { type RecipesApi } from "./resources/recipes.js";
|
|
|
41
44
|
export declare class IntrospectionClient {
|
|
42
45
|
/** @internal — HTTP client pointed at the CP API with the customer key. */
|
|
43
46
|
readonly cpHttp: HttpClient;
|
|
47
|
+
/** @internal — HTTP client pointed at the project Data Plane. */
|
|
48
|
+
readonly dpHttp: HttpClient;
|
|
44
49
|
/** @internal — passed through to Runner so it can build its own DP HTTP client. */
|
|
45
50
|
readonly advancedOptions: AdvancedOptions;
|
|
46
51
|
/**
|
|
@@ -49,10 +54,7 @@ export declare class IntrospectionClient {
|
|
|
49
54
|
* through the Introspection CLI and platform.
|
|
50
55
|
*/
|
|
51
56
|
readonly runtimes: RuntimesApi & RuntimeHandleFactory;
|
|
52
|
-
/**
|
|
53
|
-
* Reads on `/v1/experiments` plus the `(id) => ExperimentHandle` factory
|
|
54
|
-
* for run lifecycle. Authoring experiment definitions is a CLI action.
|
|
55
|
-
*/
|
|
57
|
+
/** CRUD on `/v1/experiments` plus the callable run-lifecycle handle. */
|
|
56
58
|
readonly experiments: ExperimentsApi & ExperimentHandleFactory;
|
|
57
59
|
/**
|
|
58
60
|
* Reads on `/v1/recipes`. Recipes are immutable build artefacts
|
|
@@ -60,6 +62,18 @@ export declare class IntrospectionClient {
|
|
|
60
62
|
* experiment arms; authoring them is a CLI action.
|
|
61
63
|
*/
|
|
62
64
|
readonly recipes: RecipesApi;
|
|
65
|
+
/**
|
|
66
|
+
* CRUD on `/v1/connectors` (with connections nested under
|
|
67
|
+
* `.connections`) plus `connectors.authorize(id)`, which mints the
|
|
68
|
+
* single-use consent URL a Business hands its customer.
|
|
69
|
+
*/
|
|
70
|
+
readonly connectors: ConnectorsApi;
|
|
71
|
+
/** Read folded span annotations and append one annotation mutation. */
|
|
72
|
+
readonly annotations: AnnotationsApi;
|
|
73
|
+
/** Manage reusable project labels. */
|
|
74
|
+
readonly projectLabels: ProjectLabelsApi;
|
|
75
|
+
/** Read immutable annotation activity and other typed platform events. */
|
|
76
|
+
readonly events: EventsApi;
|
|
63
77
|
constructor(options?: IntrospectionClientOptions);
|
|
64
78
|
/**
|
|
65
79
|
* Authenticate as a confidential service account and return a ready
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAuB,KAAK,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,E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ectionLogs} from
|
|
12
12
|
* `@introspection-sdk/introspection-node/otel`.
|
|
13
13
|
*/
|
|
14
|
+
import { EventsApi } from "@introspection-sdk/http";
|
|
14
15
|
import { logger as sdkLogger, USER_AGENT } from "./utils.js";
|
|
15
16
|
import { serviceAccountToken } from "./auth.js";
|
|
16
17
|
import { HttpClient } from "./http.js";
|
|
17
18
|
import { attachRuntimes, } from "./resources/runtimes.js";
|
|
18
19
|
import { attachExperiments, } from "./resources/experiments.js";
|
|
19
20
|
import { attachRecipes } from "./resources/recipes.js";
|
|
21
|
+
import { attachConnectors, } from "./resources/connectors.js";
|
|
22
|
+
import { attachAnnotations, attachProjectLabels, } from "./resources/annotations.js";
|
|
20
23
|
import { DEV_TARGET_HEADER, resolveDevTarget } from "./dev-target.js";
|
|
21
24
|
/**
|
|
22
25
|
* Introspection REST client.
|
|
@@ -41,6 +44,8 @@ import { DEV_TARGET_HEADER, resolveDevTarget } from "./dev-target.js";
|
|
|
41
44
|
export class IntrospectionClient {
|
|
42
45
|
/** @internal — HTTP client pointed at the CP API with the customer key. */
|
|
43
46
|
cpHttp;
|
|
47
|
+
/** @internal — HTTP client pointed at the project Data Plane. */
|
|
48
|
+
dpHttp;
|
|
44
49
|
/** @internal — passed through to Runner so it can build its own DP HTTP client. */
|
|
45
50
|
advancedOptions;
|
|
46
51
|
/**
|
|
@@ -49,10 +54,7 @@ export class IntrospectionClient {
|
|
|
49
54
|
* through the Introspection CLI and platform.
|
|
50
55
|
*/
|
|
51
56
|
runtimes;
|
|
52
|
-
/**
|
|
53
|
-
* Reads on `/v1/experiments` plus the `(id) => ExperimentHandle` factory
|
|
54
|
-
* for run lifecycle. Authoring experiment definitions is a CLI action.
|
|
55
|
-
*/
|
|
57
|
+
/** CRUD on `/v1/experiments` plus the callable run-lifecycle handle. */
|
|
56
58
|
experiments;
|
|
57
59
|
/**
|
|
58
60
|
* Reads on `/v1/recipes`. Recipes are immutable build artefacts
|
|
@@ -60,12 +62,28 @@ export class IntrospectionClient {
|
|
|
60
62
|
* experiment arms; authoring them is a CLI action.
|
|
61
63
|
*/
|
|
62
64
|
recipes;
|
|
65
|
+
/**
|
|
66
|
+
* CRUD on `/v1/connectors` (with connections nested under
|
|
67
|
+
* `.connections`) plus `connectors.authorize(id)`, which mints the
|
|
68
|
+
* single-use consent URL a Business hands its customer.
|
|
69
|
+
*/
|
|
70
|
+
connectors;
|
|
71
|
+
/** Read folded span annotations and append one annotation mutation. */
|
|
72
|
+
annotations;
|
|
73
|
+
/** Manage reusable project labels. */
|
|
74
|
+
projectLabels;
|
|
75
|
+
/** Read immutable annotation activity and other typed platform events. */
|
|
76
|
+
events;
|
|
63
77
|
constructor(options = {}) {
|
|
64
78
|
const token = options.token || process.env.INTROSPECTION_TOKEN || "";
|
|
65
79
|
const advanced = options.advanced || {};
|
|
66
80
|
const baseApiUrl = advanced.baseApiUrl ||
|
|
67
81
|
process.env.INTROSPECTION_BASE_API_URL ||
|
|
68
82
|
"https://api.introspection.dev";
|
|
83
|
+
// Self-hosted/local stacks commonly route both planes on one host. Hosted
|
|
84
|
+
// token exchanges return the regional DP URL explicitly; callers pass it
|
|
85
|
+
// as `dpUrl` and fromServiceAccount wires it automatically.
|
|
86
|
+
const dpUrl = advanced.dpUrl || baseApiUrl;
|
|
69
87
|
if (!token) {
|
|
70
88
|
sdkLogger.warn("IntrospectionClient: No token provided. REST calls will fail.");
|
|
71
89
|
}
|
|
@@ -93,12 +111,23 @@ export class IntrospectionClient {
|
|
|
93
111
|
this.cpHttp = new HttpClient({
|
|
94
112
|
apiUrl: baseApiUrl,
|
|
95
113
|
token,
|
|
114
|
+
cpSession: options.cpSession,
|
|
115
|
+
additionalHeaders: this.advancedOptions.additionalHeaders,
|
|
116
|
+
fetch: advanced.fetch,
|
|
117
|
+
});
|
|
118
|
+
this.dpHttp = new HttpClient({
|
|
119
|
+
apiUrl: dpUrl,
|
|
120
|
+
token,
|
|
96
121
|
additionalHeaders: this.advancedOptions.additionalHeaders,
|
|
97
122
|
fetch: advanced.fetch,
|
|
98
123
|
});
|
|
99
124
|
this.runtimes = attachRuntimes(this, this.cpHttp);
|
|
100
125
|
this.experiments = attachExperiments(this, this.cpHttp);
|
|
101
126
|
this.recipes = attachRecipes(this.cpHttp);
|
|
127
|
+
this.connectors = attachConnectors(this.cpHttp);
|
|
128
|
+
this.annotations = attachAnnotations(this.cpHttp, this.dpHttp);
|
|
129
|
+
this.projectLabels = attachProjectLabels(this.dpHttp);
|
|
130
|
+
this.events = new EventsApi(this.dpHttp);
|
|
102
131
|
sdkLogger.info(`IntrospectionClient initialized: api=${baseApiUrl}`);
|
|
103
132
|
}
|
|
104
133
|
/**
|
|
@@ -128,11 +157,15 @@ export class IntrospectionClient {
|
|
|
128
157
|
* re-mint (call this again) for long-lived processes once it lapses.
|
|
129
158
|
*/
|
|
130
159
|
static async fromServiceAccount(params) {
|
|
131
|
-
const { access_token } = await serviceAccountToken(params);
|
|
160
|
+
const { access_token, dp_url } = await serviceAccountToken(params);
|
|
132
161
|
return new IntrospectionClient({
|
|
133
162
|
token: access_token,
|
|
134
163
|
serviceName: params.serviceName,
|
|
135
|
-
advanced: {
|
|
164
|
+
advanced: {
|
|
165
|
+
baseApiUrl: params.baseApiUrl,
|
|
166
|
+
dpUrl: dp_url ?? undefined,
|
|
167
|
+
fetch: params.fetch,
|
|
168
|
+
},
|
|
136
169
|
});
|
|
137
170
|
}
|
|
138
171
|
/** Close the underlying HTTP client. */
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAkC,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,cAAc,GAG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AAC,MAAM,CAAC,CAAC;QACnE,OAAO,IAAI,mBAAmB,CAAC;YAC7B,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,QAAQ,EAAE;gBACR,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,IAAI,SAAS;gBAC1B,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IAED,wCAAwC;IACxC,KAAK,CAAC,QAAQ;QACZ,kEAAkE;QAClE,gDAAgD;QAChD,SAAS,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
package/dist/http.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface ResolvedApiConfig {
|
|
|
8
8
|
apiUrl: string;
|
|
9
9
|
/** Bearer token. Customer API key for CP, runner JWT for DP. */
|
|
10
10
|
token: string;
|
|
11
|
+
/** Encoded member session used instead of bearer auth on Control Plane calls. */
|
|
12
|
+
cpSession?: string;
|
|
11
13
|
additionalHeaders?: Record<string, string>;
|
|
12
14
|
fetch?: typeof fetch;
|
|
13
15
|
/**
|
|
@@ -20,10 +22,9 @@ export interface ResolvedApiConfig {
|
|
|
20
22
|
retryBaseMs?: number;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* `Authorization: Bearer <token>` on every request, no cookie credentials.
|
|
25
|
+
* Authenticated HTTP client used by the CP-bound IntrospectionClient and each
|
|
26
|
+
* DP-bound Runner. A member-authored Node workflow may supply the encoded
|
|
27
|
+
* `intro_cp_session` for CP-only operations; all other calls use bearer auth.
|
|
27
28
|
*/
|
|
28
29
|
export declare class HttpClient extends BaseHttpClient {
|
|
29
30
|
constructor(cfg: ResolvedApiConfig);
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc;gBAChC,GAAG,EAAE,iBAAiB;CAiBnC"}
|
package/dist/http.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { BaseHttpClient } from "@introspection-sdk/http";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `Authorization: Bearer <token>` on every request, no cookie credentials.
|
|
3
|
+
* Authenticated HTTP client used by the CP-bound IntrospectionClient and each
|
|
4
|
+
* DP-bound Runner. A member-authored Node workflow may supply the encoded
|
|
5
|
+
* `intro_cp_session` for CP-only operations; all other calls use bearer auth.
|
|
7
6
|
*/
|
|
8
7
|
export class HttpClient extends BaseHttpClient {
|
|
9
8
|
constructor(cfg) {
|
|
@@ -14,7 +13,12 @@ export class HttpClient extends BaseHttpClient {
|
|
|
14
13
|
maxRetries: cfg.maxRetries,
|
|
15
14
|
retryBaseMs: cfg.retryBaseMs,
|
|
16
15
|
transport: {
|
|
17
|
-
authHeaders: () =>
|
|
16
|
+
authHeaders: () => {
|
|
17
|
+
if (cfg.cpSession) {
|
|
18
|
+
return { Cookie: `intro_cp_session=${cfg.cpSession}` };
|
|
19
|
+
}
|
|
20
|
+
return { Authorization: `Bearer ${cfg.token}` };
|
|
21
|
+
},
|
|
18
22
|
},
|
|
19
23
|
});
|
|
20
24
|
}
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAyBzD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C,YAAY,GAAsB;QAChC,KAAK,CAAC;YACJ,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;YACxC,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,SAAS,EAAE;gBACT,WAAW,EAAE,GAA2B,EAAE;oBACxC,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;wBAClB,OAAO,EAAE,MAAM,EAAE,oBAAoB,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;oBACzD,CAAC;oBACD,OAAO,EAAE,aAAa,EAAE,UAAU,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC;gBAClD,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,9 @@ export type { RuntimeHandleFactory } from "./resources/runtimes.js";
|
|
|
27
27
|
export { ExperimentsApi, ExperimentHandle, attachExperiments, } from "./resources/experiments.js";
|
|
28
28
|
export type { ExperimentHandleFactory } from "./resources/experiments.js";
|
|
29
29
|
export { RecipesApi, attachRecipes } from "./resources/recipes.js";
|
|
30
|
-
export
|
|
30
|
+
export { ConnectorsApi, ConnectionsApi, attachConnectors, } from "./resources/connectors.js";
|
|
31
|
+
export { AnnotationsApi, ProjectLabelsApi, attachAnnotations, attachProjectLabels, } from "./resources/annotations.js";
|
|
32
|
+
export type { AGUIEvent, BaseEvent, Interrupt, Message, ResumeEntry, RunAgentInput, Paginated, ListParams, Task, TaskCreateParams, TaskUpdateParams, TaskListParams, TaskKind, TaskStatus, TaskRunKind, TaskPrompt, TaskRun, TaskRunCreateParams, TaskRunResumeParams, TaskRunResponse, TaskCreateResponse, TaskFileRef, TaskRepoRequest, TaskCancelResponse, TaskCancelOptions, AgentInfo, File, FileType, FileListParams, FileUpdateParams, FileCreateTextParams, Runtime, RuntimeListParams, Experiment, ExperimentListParams, ExperimentStatus, ExperimentGoal, ExperimentGoalComponent, ExperimentGoalDirection, ExperimentGoalGuard, JudgeGoalComponent, TelemetryGoalComponent, ExperimentArm, Recipe, RecipeListParams, Connector, ConnectorApp, ConnectorAppListParams, ConnectorAuthMode, ConnectorStatus, ConnectorPersonServerMode, ConnectorApprovalPolicy, ConnectorCreateParams, ConnectorUpdateParams, ConnectorListParams, ConnectorAuthorizeParams, ConnectorAuthorizeResponse, Connection, ConnectionStatus, ConnectionSubjectType, ConnectionCreateSubjectType, ConnectionBrokerSubjectType, ConnectionCreateParams, ConnectionMissionConstraints, ConnectionTokenParams, ConnectionToken, ConnectionAuthorizationPending, ConnectionTokenResult, AnnotationTarget, AnnotationState, AnnotationListParams, AnnotationMutation, AnnotationEventOptions, ProjectLabel, ProjectLabelListParams, ProjectLabelCreate, ProjectLabelUpdate, RunnerSpec, RunnerDeployment, RunnerContext, RunnerRecipeSummary, RunnerIdentity, RunRequest, RunCaller, RunCallerLibrary, RunCallerPage, RunIdentityInput, GenAiSpan, GenAiSpanList, GenAiSpanAttributes, GenAiSpanStatus, Conversation, ConversationAgent, ConversationUsage, ConversationCost, ConversationMetrics, IntrospectionSpanAttributes, IntrospectionConversation, SpanAttributes, SpanResource, ConversationItemInclude, ConversationSortField, ConversationListParams, ConversationItemListParams, ConversationExportParams, Trajectory, TrajectoryRecord, TrajectoryToolCall, ConversationsMethod, SpanEvent, SpanKind, SpanStatus, ReadFormat, ReadWindowParams, IntrospectionEventName, IntrospectionEventEnvelope, ObservationPayload, PatternPayload, PatternAssignmentPayload, ClusteringRunPayload, FeedbackPayload, JudgementPayload, ObservationEvent, PatternEvent, PatternAssignmentEvent, ClusteringRunEvent, FeedbackEvent, JudgementEvent, Event, UnknownEvent, EventForName, EventSortField, EventListParams, MetricView, MetricAggregation, MetricFilterOperator, MetricInterval, MetricSpec, MetricDimension, MetricFilter, MetricTimeDimension, MetricOrderBy, MetricHaving, MetricQueryConfig, MetricQueryRequest, MetricDimensionValue, MetricResultValue, MetricResultRow, MetricEffectiveWindow, MetricQueryMeta, MetricQueryResponse, } from "@introspection-sdk/types";
|
|
31
33
|
export { ConversationsMethods, IntrospectionEventNames, genAiConversationId, genAiInputMessages, genAiOutputMessages, isKnownEvent, } from "@introspection-sdk/types";
|
|
32
34
|
export { IntrospectionAPIError, AuthenticationError, InsufficientScopeError, RunnerExpiredError, NotFoundError, ConflictError, ValidationError, RateLimitError, SandboxUnavailableError, NetworkError, apiErrorFromResponse, } from "@introspection-sdk/types";
|
|
33
35
|
export type { GenAiAttributes, InputMessage, OutputMessage, SystemInstruction, ToolDefinition, TextPart, ToolCallRequestPart, ToolCallResponsePart, CompactionPart, MediaUrlPart, BinaryDataPart, MessagePart, } from "@introspection-sdk/types";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,GACX,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,eAAe,EACf,0BAA0B,EAC1B,eAAe,EACf,UAAU,GACX,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,GACX,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,eAAe,EACf,0BAA0B,EAC1B,eAAe,EACf,UAAU,GACX,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EA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V,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,YAAY,EACZ,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,8 @@ export { Runner } from "./runner.js";
|
|
|
25
25
|
export { RuntimesApi, RuntimeHandle, attachRuntimes, } from "./resources/runtimes.js";
|
|
26
26
|
export { ExperimentsApi, ExperimentHandle, attachExperiments, } from "./resources/experiments.js";
|
|
27
27
|
export { RecipesApi, attachRecipes } from "./resources/recipes.js";
|
|
28
|
+
export { ConnectorsApi, ConnectionsApi, attachConnectors, } from "./resources/connectors.js";
|
|
29
|
+
export { AnnotationsApi, ProjectLabelsApi, attachAnnotations, attachProjectLabels, } from "./resources/annotations.js";
|
|
28
30
|
export { ConversationsMethods, IntrospectionEventNames, genAiConversationId, genAiInputMessages, genAiOutputMessages, isKnownEvent, } from "@introspection-sdk/types";
|
|
29
31
|
export { IntrospectionAPIError, AuthenticationError, InsufficientScopeError, RunnerExpiredError, NotFoundError, ConflictError, ValidationError, RateLimitError, SandboxUnavailableError, NetworkError, apiErrorFromResponse, } from "@introspection-sdk/types";
|
|
30
32
|
export { toAttributes } from "@introspection-sdk/types";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAe;AACf,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,0DAA0D;AAC1D,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAiBnB,4DAA4D;AAC5D,gCAAgC;AAChC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQrD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,yBAAyB;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CA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kB,EAClB,mBAAmB,EACnB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,YAAY,EACZ,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ProjectLabel, type ProjectLabelCreate, type ProjectLabelListParams, type ProjectLabelUpdate, type AnnotationListParams, type AnnotationEventOptions, type AnnotationMutation, type AnnotationState, type AnnotationTarget } from "@introspection-sdk/types";
|
|
2
|
+
import type { HttpClient } from "../http.js";
|
|
3
|
+
import { Paginator } from "../pagination.js";
|
|
4
|
+
/** Managed project label catalog used by annotations. */
|
|
5
|
+
export declare class ProjectLabelsApi {
|
|
6
|
+
private readonly dpHttp;
|
|
7
|
+
constructor(dpHttp: HttpClient);
|
|
8
|
+
list(params?: ProjectLabelListParams): Paginator<ProjectLabel>;
|
|
9
|
+
create(body: ProjectLabelCreate): Promise<ProjectLabel>;
|
|
10
|
+
get(slug: string): Promise<ProjectLabel>;
|
|
11
|
+
update(slug: string, body: ProjectLabelUpdate): Promise<ProjectLabel>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Member-authored span annotations. Every create call appends exactly one
|
|
15
|
+
* event; labels and reviewers are complete snapshots.
|
|
16
|
+
*/
|
|
17
|
+
export declare class AnnotationsApi {
|
|
18
|
+
private readonly cpHttp;
|
|
19
|
+
private readonly dpHttp;
|
|
20
|
+
constructor(cpHttp: HttpClient, dpHttp: HttpClient);
|
|
21
|
+
list(params?: AnnotationListParams): Paginator<AnnotationState>;
|
|
22
|
+
/** Append exactly one annotation mutation. */
|
|
23
|
+
create(target: AnnotationTarget, mutation: AnnotationMutation, options?: AnnotationEventOptions): Promise<void>;
|
|
24
|
+
private resolveReviewerIds;
|
|
25
|
+
}
|
|
26
|
+
export declare function attachAnnotations(cpHttp: HttpClient, dpHttp: HttpClient): AnnotationsApi;
|
|
27
|
+
export declare function attachProjectLabels(dpHttp: HttpClient): ProjectLabelsApi;
|
|
28
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/resources/annotations.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAkB,MAAM,kBAAkB,CAAC;AAuD7D,yDAAyD;AACzD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C,IAAI,CAAC,MAAM,GAAE,sBAA2B,GAAG,SAAS,CAAC,YAAY,CAAC;IAYlE,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IA2BvD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAOxC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;CAatE;AAED;;;GAGG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU;IAGrC,IAAI,CAAC,MAAM,GAAE,oBAAyB,GAAG,SAAS,CAAC,eAAe,CAAC;IAkDnE,8CAA8C;IACxC,MAAM,CACV,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC;YAsBF,kBAAkB;CAyCjC;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GACjB,cAAc,CAEhB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,CAExE"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { ConflictError, NotFoundError, ValidationError, } from "@introspection-sdk/types";
|
|
3
|
+
import { cursorPaginate } from "../pagination.js";
|
|
4
|
+
function clientValidationError(message, code) {
|
|
5
|
+
return new ValidationError({
|
|
6
|
+
message,
|
|
7
|
+
status: 422,
|
|
8
|
+
code,
|
|
9
|
+
body: null,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** Mint a time-ordered UUIDv7 without adding a runtime dependency. */
|
|
13
|
+
function annotationEventId(now = Date.now()) {
|
|
14
|
+
const bytes = Buffer.allocUnsafe(16);
|
|
15
|
+
let timestamp = BigInt(now);
|
|
16
|
+
for (let index = 5; index >= 0; index--) {
|
|
17
|
+
bytes[index] = Number(timestamp & 0xffn);
|
|
18
|
+
timestamp >>= 8n;
|
|
19
|
+
}
|
|
20
|
+
randomBytes(10).copy(bytes, 6);
|
|
21
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x70;
|
|
22
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
23
|
+
const hex = bytes.toString("hex");
|
|
24
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
25
|
+
}
|
|
26
|
+
function normalizedEmails(emails) {
|
|
27
|
+
const values = typeof emails === "string" ? [emails] : emails;
|
|
28
|
+
const normalized = [
|
|
29
|
+
...new Set(values.map((email) => email.trim().toLowerCase())),
|
|
30
|
+
];
|
|
31
|
+
if (normalized.length === 0 ||
|
|
32
|
+
normalized.some((email) => email.length === 0)) {
|
|
33
|
+
throw clientValidationError("At least one non-empty reviewer email is required", "invalid_annotation_reviewer_email");
|
|
34
|
+
}
|
|
35
|
+
if (normalized.length > 64) {
|
|
36
|
+
throw clientValidationError("At most 64 reviewer emails are allowed", "too_many_annotation_reviewers");
|
|
37
|
+
}
|
|
38
|
+
return normalized;
|
|
39
|
+
}
|
|
40
|
+
/** Managed project label catalog used by annotations. */
|
|
41
|
+
export class ProjectLabelsApi {
|
|
42
|
+
dpHttp;
|
|
43
|
+
constructor(dpHttp) {
|
|
44
|
+
this.dpHttp = dpHttp;
|
|
45
|
+
}
|
|
46
|
+
list(params = {}) {
|
|
47
|
+
return cursorPaginate((next) => this.dpHttp.request({
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: "/v1/project-labels",
|
|
50
|
+
query: { ...params, next },
|
|
51
|
+
}), params.next);
|
|
52
|
+
}
|
|
53
|
+
create(body) {
|
|
54
|
+
const slug = body.slug.trim();
|
|
55
|
+
if (!slug || slug.length > 128) {
|
|
56
|
+
throw clientValidationError("Project label slug must contain 1 to 128 characters", "invalid_project_label_slug");
|
|
57
|
+
}
|
|
58
|
+
if (!/^#[0-9a-f]{6}$/i.test(body.color)) {
|
|
59
|
+
throw clientValidationError("Project label color must be a six-digit hex color such as #f97316", "invalid_project_label_color");
|
|
60
|
+
}
|
|
61
|
+
if (body.description != null && body.description.length > 2_000) {
|
|
62
|
+
throw clientValidationError("Project label description must not exceed 2000 characters", "invalid_project_label_description");
|
|
63
|
+
}
|
|
64
|
+
return this.dpHttp.request({
|
|
65
|
+
method: "POST",
|
|
66
|
+
path: "/v1/project-labels",
|
|
67
|
+
body: { ...body, slug, color: body.color.toLowerCase() },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
get(slug) {
|
|
71
|
+
return this.dpHttp.request({
|
|
72
|
+
method: "GET",
|
|
73
|
+
path: `/v1/project-labels/${encodeURIComponent(slug)}`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
update(slug, body) {
|
|
77
|
+
if (body.description != null && body.description.length > 2_000) {
|
|
78
|
+
throw clientValidationError("Project label description must not exceed 2000 characters", "invalid_project_label_description");
|
|
79
|
+
}
|
|
80
|
+
return this.dpHttp.request({
|
|
81
|
+
method: "PATCH",
|
|
82
|
+
path: `/v1/project-labels/${encodeURIComponent(slug)}`,
|
|
83
|
+
body,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Member-authored span annotations. Every create call appends exactly one
|
|
89
|
+
* event; labels and reviewers are complete snapshots.
|
|
90
|
+
*/
|
|
91
|
+
export class AnnotationsApi {
|
|
92
|
+
cpHttp;
|
|
93
|
+
dpHttp;
|
|
94
|
+
constructor(cpHttp, dpHttp) {
|
|
95
|
+
this.cpHttp = cpHttp;
|
|
96
|
+
this.dpHttp = dpHttp;
|
|
97
|
+
}
|
|
98
|
+
list(params = {}) {
|
|
99
|
+
if (params.annotated_by_member_id && params.annotated_by_email) {
|
|
100
|
+
throw clientValidationError("Use annotated_by_member_id or annotated_by_email, not both", "conflicting_annotation_annotator_filters");
|
|
101
|
+
}
|
|
102
|
+
if (params.assignee_member_id && params.assigned_to_email) {
|
|
103
|
+
throw clientValidationError("Use assignee_member_id or assigned_to_email, not both", "conflicting_annotation_assignee_filters");
|
|
104
|
+
}
|
|
105
|
+
const { annotated_by_email, assigned_to_email, ...wireParams } = params;
|
|
106
|
+
let resolvedFilters;
|
|
107
|
+
const resolveFilters = () => {
|
|
108
|
+
resolvedFilters ??= (async () => {
|
|
109
|
+
const emails = [annotated_by_email, assigned_to_email].filter((email) => Boolean(email));
|
|
110
|
+
const ids = emails.length ? await this.resolveReviewerIds(emails) : [];
|
|
111
|
+
const sameEmail = annotated_by_email !== undefined &&
|
|
112
|
+
assigned_to_email !== undefined &&
|
|
113
|
+
annotated_by_email.trim().toLowerCase() ===
|
|
114
|
+
assigned_to_email.trim().toLowerCase();
|
|
115
|
+
return {
|
|
116
|
+
...wireParams,
|
|
117
|
+
...(annotated_by_email ? { annotated_by_member_id: ids[0] } : {}),
|
|
118
|
+
...(assigned_to_email
|
|
119
|
+
? {
|
|
120
|
+
assignee_member_id: ids[annotated_by_email && !sameEmail ? 1 : 0],
|
|
121
|
+
}
|
|
122
|
+
: {}),
|
|
123
|
+
};
|
|
124
|
+
})();
|
|
125
|
+
return resolvedFilters;
|
|
126
|
+
};
|
|
127
|
+
return cursorPaginate(async (next) => this.dpHttp.request({
|
|
128
|
+
method: "GET",
|
|
129
|
+
path: "/v1/annotations",
|
|
130
|
+
query: { ...(await resolveFilters()), next },
|
|
131
|
+
}), params.next);
|
|
132
|
+
}
|
|
133
|
+
/** Append exactly one annotation mutation. */
|
|
134
|
+
async create(target, mutation, options = {}) {
|
|
135
|
+
const wireMutation = mutation.reviewerEmails !== undefined
|
|
136
|
+
? {
|
|
137
|
+
assignee_member_ids: mutation.reviewerEmails.length === 0
|
|
138
|
+
? []
|
|
139
|
+
: await this.resolveReviewerIds(mutation.reviewerEmails),
|
|
140
|
+
}
|
|
141
|
+
: mutation;
|
|
142
|
+
return this.dpHttp.request({
|
|
143
|
+
method: "POST",
|
|
144
|
+
path: "/v1/annotations",
|
|
145
|
+
body: {
|
|
146
|
+
...target,
|
|
147
|
+
event_id: options.event_id ?? annotationEventId(),
|
|
148
|
+
...wireMutation,
|
|
149
|
+
},
|
|
150
|
+
expect: "empty",
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async resolveReviewerIds(emails) {
|
|
154
|
+
const requested = normalizedEmails(emails);
|
|
155
|
+
const matches = new Map();
|
|
156
|
+
for (const email of requested)
|
|
157
|
+
matches.set(email, []);
|
|
158
|
+
const members = cursorPaginate((next) => this.cpHttp.request({
|
|
159
|
+
method: "GET",
|
|
160
|
+
path: "/v1/members",
|
|
161
|
+
query: { limit: 1000, member_type: "business", next },
|
|
162
|
+
}));
|
|
163
|
+
for await (const member of members) {
|
|
164
|
+
if (member.is_deactivated || !member.email)
|
|
165
|
+
continue;
|
|
166
|
+
matches.get(member.email.trim().toLowerCase())?.push(member);
|
|
167
|
+
}
|
|
168
|
+
const memberIds = [];
|
|
169
|
+
for (const email of requested) {
|
|
170
|
+
const candidates = matches.get(email) ?? [];
|
|
171
|
+
if (candidates.length === 0) {
|
|
172
|
+
throw new NotFoundError({
|
|
173
|
+
message: `No active domain expert found for '${email}'`,
|
|
174
|
+
status: 404,
|
|
175
|
+
code: "annotation_reviewer_not_found",
|
|
176
|
+
body: { email },
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (candidates.length > 1) {
|
|
180
|
+
throw new ConflictError({
|
|
181
|
+
message: `Multiple active domain experts found for '${email}'`,
|
|
182
|
+
status: 409,
|
|
183
|
+
code: "annotation_reviewer_ambiguous",
|
|
184
|
+
body: { email, member_ids: candidates.map((member) => member.id) },
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
memberIds.push(candidates[0].id);
|
|
188
|
+
}
|
|
189
|
+
return memberIds;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
export function attachAnnotations(cpHttp, dpHttp) {
|
|
193
|
+
return new AnnotationsApi(cpHttp, dpHttp);
|
|
194
|
+
}
|
|
195
|
+
export function attachProjectLabels(dpHttp) {
|
|
196
|
+
return new ProjectLabelsApi(dpHttp);
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../src/resources/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,GAYhB,MA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,IAAI,EAAE,EAAE,KAAK,EAAE;iBAChB,CAAC,CAAC;YACL,CAAC;YACD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,aAAa,CAAC;oBACtB,OAAO,EAAE,6CAA6C,KAAK,GAAG;oBAC9D,MAAM,EAAE,GAAG;oBACX,IAAI,EAAE,+BAA+B;oBACrC,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;iBACnE,CAAC,CAAC;YACL,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAAkB,EAClB,MAAkB;IAElB,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAkB;IACpD,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Connection, ConnectionCreateParams, ConnectionTokenParams, ConnectionTokenResult, Connector, ConnectorApp, ConnectorAppListParams, ConnectorAuthorizeParams, ConnectorAuthorizeResponse, ConnectorCreateParams, ConnectorListParams, ConnectorUpdateParams, CursorParams, Uuid } from "@introspection-sdk/types";
|
|
2
|
+
import type { HttpClient } from "../http.js";
|
|
3
|
+
import { Paginator } from "../pagination.js";
|
|
4
|
+
/**
|
|
5
|
+
* Connections nested under a connector
|
|
6
|
+
* (`/v1/connectors/{connector_id}/connections`) — one authorized subject
|
|
7
|
+
* each (a Slack workspace, a person, an app credential). Every method
|
|
8
|
+
* takes the connector id as its first argument; there is no PATCH on
|
|
9
|
+
* connections, and the platform never serializes access/refresh tokens.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ConnectionsApi {
|
|
12
|
+
private readonly http;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
/**
|
|
15
|
+
* List a connector's connections. `await` the result for the first
|
|
16
|
+
* page, or `for await` it to stream every connection across pages
|
|
17
|
+
* (fetched lazily; stop early to stop fetching).
|
|
18
|
+
*/
|
|
19
|
+
list(connectorId: Uuid, params?: CursorParams): Paginator<Connection>;
|
|
20
|
+
/**
|
|
21
|
+
* Register a connection from a token the caller already holds
|
|
22
|
+
* (registered mode). For the consent flow use
|
|
23
|
+
* {@link ConnectorsApi.authorize} instead — the callback creates the
|
|
24
|
+
* connection server-side.
|
|
25
|
+
*/
|
|
26
|
+
create(connectorId: Uuid, params: ConnectionCreateParams): Promise<Connection>;
|
|
27
|
+
get(connectorId: Uuid, connectionId: Uuid): Promise<Connection>;
|
|
28
|
+
/**
|
|
29
|
+
* Revoke a connection. Named `revoke` rather than `delete` because it
|
|
30
|
+
* destroys the provider token behind it — the subject must re-consent
|
|
31
|
+
* to connect again.
|
|
32
|
+
*/
|
|
33
|
+
revoke(connectorId: Uuid, connectionId: Uuid): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a connector credential for the authenticated subject. For a
|
|
36
|
+
* `person_authorized` connector this may return `authorization_pending`
|
|
37
|
+
* with the mission and approval URL instead of a token.
|
|
38
|
+
*/
|
|
39
|
+
getToken(connectorId: Uuid, params?: ConnectionTokenParams): Promise<ConnectionTokenResult>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* CRUD on `/v1/connectors` plus the consent-URL mint
|
|
43
|
+
* (`POST /v1/oauth/connections/authorize`), with connections nested as
|
|
44
|
+
* {@link ConnectionsApi} under `.connections`.
|
|
45
|
+
*
|
|
46
|
+
* Connector CRUD uses the project carried by the authenticated credential.
|
|
47
|
+
* `client_secret` / `signing_secret` are write-only — accepted on create
|
|
48
|
+
* and update, absent from every read.
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export declare class ConnectorsApi {
|
|
52
|
+
private readonly http;
|
|
53
|
+
readonly connections: ConnectionsApi;
|
|
54
|
+
constructor(http: HttpClient);
|
|
55
|
+
/**
|
|
56
|
+
* List connectors matching `params`. `await` the result for the first
|
|
57
|
+
* page, or `for await` it to stream every connector across pages
|
|
58
|
+
* (fetched lazily — `limit` sets the page size, `next` the starting
|
|
59
|
+
* cursor; stop early to stop fetching).
|
|
60
|
+
*/
|
|
61
|
+
list(params?: ConnectorListParams): Paginator<Connector>;
|
|
62
|
+
/** Create a connector. Idempotent on `slug` — a repeat POST returns the live row. */
|
|
63
|
+
create(params: ConnectorCreateParams): Promise<Connector>;
|
|
64
|
+
get(connectorId: Uuid): Promise<Connector>;
|
|
65
|
+
update(connectorId: Uuid, params: ConnectorUpdateParams): Promise<Connector>;
|
|
66
|
+
/** Soft-delete a connector; the server revokes its connections. */
|
|
67
|
+
delete(connectorId: Uuid): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Search the provider's application catalogue. Pipedream connectors use
|
|
70
|
+
* the returned slug when minting an application-specific Connect Link.
|
|
71
|
+
*/
|
|
72
|
+
listApps(connectorId: Uuid, params?: ConnectorAppListParams): Promise<ConnectorApp[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Mint a consent URL for a connector — the link a Business hands its
|
|
75
|
+
* customer to connect (e.g. install the Slack app into a workspace).
|
|
76
|
+
*
|
|
77
|
+
* The URL embeds a single-use `state`, so it must not be cached: two
|
|
78
|
+
* calls give two different URLs, and each is spent on first use. Raise
|
|
79
|
+
* `expires_in` when handing the link to someone else to open later. A
|
|
80
|
+
* chat-provider connector (`connector.requires_runtime === true`) 422s
|
|
81
|
+
* unless `runtime` names the agent that replies.
|
|
82
|
+
*
|
|
83
|
+
* Pipedream connectors additionally require `app`, selected from
|
|
84
|
+
* {@link listApps}. `allow_progressive_scopes` is optional and defaults to
|
|
85
|
+
* false, matching Pipedream's Connect API.
|
|
86
|
+
*
|
|
87
|
+
* Passing `params.identity` mints a `customer` member for the asserted
|
|
88
|
+
* end user, so it can raise a {@link ConflictError} (409) when the org has
|
|
89
|
+
* reached its member limit — a plan conflict, not back-pressure.
|
|
90
|
+
*/
|
|
91
|
+
authorize(connectorId: Uuid, params?: ConnectorAuthorizeParams): Promise<ConnectorAuthorizeResponse>;
|
|
92
|
+
}
|
|
93
|
+
export declare function attachConnectors(http: HttpClient): ConnectorsApi;
|
|
94
|
+
//# sourceMappingURL=connectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../src/resources/connectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EAEZ,IAAI,EACL,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAkB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;OAIG;IACH,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,GAAE,YAAiB,GAAG,SAAS,CAAC,UAAU,CAAC;IAYzE;;;;;OAKG;IACH,MAAM,CACJ,WAAW,EAAE,IAAI,EACjB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,UAAU,CAAC;IAQtB,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IAO/D;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D;;;;OAIG;IACH,QAAQ,CACN,WAAW,EAAE,IAAI,EACjB,MAAM,GAAE,qBAA0B,GACjC,OAAO,CAAC,qBAAqB,CAAC;CAOlC;AAED;;;;;;;;;GASG;AACH,qBAAa,aAAa;IAGZ,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;gBAER,IAAI,EAAE,UAAU;IAI7C;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,mBAAwB,GAAG,SAAS,CAAC,SAAS,CAAC;IAY5D,qFAAqF;IACrF,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAQzD,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC;IAO1C,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAQ5E,mEAAmE;IACnE,MAAM,CAAC,WAAW,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC;;;OAGG;IACG,QAAQ,CACZ,WAAW,EAAE,IAAI,EACjB,MAAM,GAAE,sBAA2B,GAClC,OAAO,CAAC,YAAY,EAAE,CAAC;IAS1B;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CACP,WAAW,EAAE,IAAI,EACjB,MAAM,GAAE,wBAA6B,GACpC,OAAO,CAAC,0BAA0B,CAAC;CAOvC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,aAAa,CAEhE"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { cursorPaginate } from "../pagination.js";
|
|
2
|
+
/**
|
|
3
|
+
* Connections nested under a connector
|
|
4
|
+
* (`/v1/connectors/{connector_id}/connections`) — one authorized subject
|
|
5
|
+
* each (a Slack workspace, a person, an app credential). Every method
|
|
6
|
+
* takes the connector id as its first argument; there is no PATCH on
|
|
7
|
+
* connections, and the platform never serializes access/refresh tokens.
|
|
8
|
+
*/
|
|
9
|
+
export class ConnectionsApi {
|
|
10
|
+
http;
|
|
11
|
+
constructor(http) {
|
|
12
|
+
this.http = http;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List a connector's connections. `await` the result for the first
|
|
16
|
+
* page, or `for await` it to stream every connection across pages
|
|
17
|
+
* (fetched lazily; stop early to stop fetching).
|
|
18
|
+
*/
|
|
19
|
+
list(connectorId, params = {}) {
|
|
20
|
+
return cursorPaginate((next) => this.http.request({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}/connections`,
|
|
23
|
+
query: { ...params, next },
|
|
24
|
+
}), params.next);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Register a connection from a token the caller already holds
|
|
28
|
+
* (registered mode). For the consent flow use
|
|
29
|
+
* {@link ConnectorsApi.authorize} instead — the callback creates the
|
|
30
|
+
* connection server-side.
|
|
31
|
+
*/
|
|
32
|
+
create(connectorId, params) {
|
|
33
|
+
return this.http.request({
|
|
34
|
+
method: "POST",
|
|
35
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}/connections`,
|
|
36
|
+
body: params,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
get(connectorId, connectionId) {
|
|
40
|
+
return this.http.request({
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}/connections/${encodeURIComponent(connectionId)}`,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Revoke a connection. Named `revoke` rather than `delete` because it
|
|
47
|
+
* destroys the provider token behind it — the subject must re-consent
|
|
48
|
+
* to connect again.
|
|
49
|
+
*/
|
|
50
|
+
revoke(connectorId, connectionId) {
|
|
51
|
+
return this.http.request({
|
|
52
|
+
method: "DELETE",
|
|
53
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}/connections/${encodeURIComponent(connectionId)}`,
|
|
54
|
+
expect: "empty",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a connector credential for the authenticated subject. For a
|
|
59
|
+
* `person_authorized` connector this may return `authorization_pending`
|
|
60
|
+
* with the mission and approval URL instead of a token.
|
|
61
|
+
*/
|
|
62
|
+
getToken(connectorId, params = {}) {
|
|
63
|
+
return this.http.request({
|
|
64
|
+
method: "POST",
|
|
65
|
+
path: "/v1/oauth/connections/token",
|
|
66
|
+
body: { connector_id: connectorId, ...params },
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* CRUD on `/v1/connectors` plus the consent-URL mint
|
|
72
|
+
* (`POST /v1/oauth/connections/authorize`), with connections nested as
|
|
73
|
+
* {@link ConnectionsApi} under `.connections`.
|
|
74
|
+
*
|
|
75
|
+
* Connector CRUD uses the project carried by the authenticated credential.
|
|
76
|
+
* `client_secret` / `signing_secret` are write-only — accepted on create
|
|
77
|
+
* and update, absent from every read.
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
export class ConnectorsApi {
|
|
81
|
+
http;
|
|
82
|
+
connections;
|
|
83
|
+
constructor(http) {
|
|
84
|
+
this.http = http;
|
|
85
|
+
this.connections = new ConnectionsApi(http);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* List connectors matching `params`. `await` the result for the first
|
|
89
|
+
* page, or `for await` it to stream every connector across pages
|
|
90
|
+
* (fetched lazily — `limit` sets the page size, `next` the starting
|
|
91
|
+
* cursor; stop early to stop fetching).
|
|
92
|
+
*/
|
|
93
|
+
list(params = {}) {
|
|
94
|
+
return cursorPaginate((next) => this.http.request({
|
|
95
|
+
method: "GET",
|
|
96
|
+
path: "/v1/connectors",
|
|
97
|
+
query: { ...params, next },
|
|
98
|
+
}), params.next);
|
|
99
|
+
}
|
|
100
|
+
/** Create a connector. Idempotent on `slug` — a repeat POST returns the live row. */
|
|
101
|
+
create(params) {
|
|
102
|
+
return this.http.request({
|
|
103
|
+
method: "POST",
|
|
104
|
+
path: "/v1/connectors",
|
|
105
|
+
body: params,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
get(connectorId) {
|
|
109
|
+
return this.http.request({
|
|
110
|
+
method: "GET",
|
|
111
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
update(connectorId, params) {
|
|
115
|
+
return this.http.request({
|
|
116
|
+
method: "PATCH",
|
|
117
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}`,
|
|
118
|
+
body: params,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** Soft-delete a connector; the server revokes its connections. */
|
|
122
|
+
delete(connectorId) {
|
|
123
|
+
return this.http.request({
|
|
124
|
+
method: "DELETE",
|
|
125
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}`,
|
|
126
|
+
expect: "empty",
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Search the provider's application catalogue. Pipedream connectors use
|
|
131
|
+
* the returned slug when minting an application-specific Connect Link.
|
|
132
|
+
*/
|
|
133
|
+
async listApps(connectorId, params = {}) {
|
|
134
|
+
const response = await this.http.request({
|
|
135
|
+
method: "GET",
|
|
136
|
+
path: `/v1/connectors/${encodeURIComponent(connectorId)}/apps`,
|
|
137
|
+
query: params,
|
|
138
|
+
});
|
|
139
|
+
return response.data;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Mint a consent URL for a connector — the link a Business hands its
|
|
143
|
+
* customer to connect (e.g. install the Slack app into a workspace).
|
|
144
|
+
*
|
|
145
|
+
* The URL embeds a single-use `state`, so it must not be cached: two
|
|
146
|
+
* calls give two different URLs, and each is spent on first use. Raise
|
|
147
|
+
* `expires_in` when handing the link to someone else to open later. A
|
|
148
|
+
* chat-provider connector (`connector.requires_runtime === true`) 422s
|
|
149
|
+
* unless `runtime` names the agent that replies.
|
|
150
|
+
*
|
|
151
|
+
* Pipedream connectors additionally require `app`, selected from
|
|
152
|
+
* {@link listApps}. `allow_progressive_scopes` is optional and defaults to
|
|
153
|
+
* false, matching Pipedream's Connect API.
|
|
154
|
+
*
|
|
155
|
+
* Passing `params.identity` mints a `customer` member for the asserted
|
|
156
|
+
* end user, so it can raise a {@link ConflictError} (409) when the org has
|
|
157
|
+
* reached its member limit — a plan conflict, not back-pressure.
|
|
158
|
+
*/
|
|
159
|
+
authorize(connectorId, params = {}) {
|
|
160
|
+
return this.http.request({
|
|
161
|
+
method: "POST",
|
|
162
|
+
path: "/v1/oauth/connections/authorize",
|
|
163
|
+
body: { connector_id: connectorId, ...params },
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export function attachConnectors(http) {
|
|
168
|
+
return new ConnectorsApi(http);
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=connectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.js","sourceRoot":"","sources":["../../src/resources/connectors.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAa,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;OAIG;IACH,IAAI,CAAC,WAAiB,EAAE,SAAuB,EAAE;QAC/C,OAAO,cAAc,CACnB,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwB;YACvC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,WAAW,CAAC,cAAc;YACrE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,IAAI,EAA6B;SACtD,CAA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G,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YACjE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,WAAW,CAAC,OAAO;YAC9D,KAAK,EAAE,MAAiC;SACzC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CACP,WAAiB,EACjB,SAAmC,EAAE;QAErC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6B;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,iCAAiC;YACvC,IAAI,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -4,12 +4,9 @@ import type { IntrospectionClient } from "../client.js";
|
|
|
4
4
|
import { Paginator } from "../pagination.js";
|
|
5
5
|
import { Runner } from "../runner.js";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* the experiment and then `start` / `end` / `cancel` around the work it is
|
|
11
|
-
* being measured on. Authoring an experiment is a project-authoring act and
|
|
12
|
-
* lives in the CLI.
|
|
7
|
+
* CRUD, lifecycle, and execution for `/v1/experiments` on the CP. Create and
|
|
8
|
+
* update accept the exact Control Plane request document so its schema remains
|
|
9
|
+
* the source of truth.
|
|
13
10
|
*/
|
|
14
11
|
export declare class ExperimentsApi {
|
|
15
12
|
private readonly http;
|
|
@@ -23,6 +20,9 @@ export declare class ExperimentsApi {
|
|
|
23
20
|
*/
|
|
24
21
|
list(params?: ExperimentListParams): Paginator<Experiment>;
|
|
25
22
|
get(id: Uuid): Promise<Experiment>;
|
|
23
|
+
create(document: Record<string, unknown>): Promise<Experiment>;
|
|
24
|
+
update(id: Uuid, document: Record<string, unknown>, project?: string): Promise<Experiment>;
|
|
25
|
+
delete(id: Uuid, project?: string): Promise<void>;
|
|
26
26
|
startById(id: Uuid): Promise<Experiment>;
|
|
27
27
|
endById(id: Uuid): Promise<Experiment>;
|
|
28
28
|
cancelById(id: Uuid): Promise<Experiment>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../src/resources/experiments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EAEpB,UAAU,EAEV,IAAI,EACL,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAkB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AAyBzD
|
|
1
|
+
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../src/resources/experiments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EAEpB,UAAU,EAEV,IAAI,EACL,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAkB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AAyBzD;;;;GAIG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,mBAAmB;IAG9C;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,oBA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mB,EAC3B,IAAI,EAAE,UAAU,GACf,cAAc,GAAG,uBAAuB,CAe1C"}
|
|
@@ -17,12 +17,9 @@ function toRunBody(opts) {
|
|
|
17
17
|
return out;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* the experiment and then `start` / `end` / `cancel` around the work it is
|
|
24
|
-
* being measured on. Authoring an experiment is a project-authoring act and
|
|
25
|
-
* lives in the CLI.
|
|
20
|
+
* CRUD, lifecycle, and execution for `/v1/experiments` on the CP. Create and
|
|
21
|
+
* update accept the exact Control Plane request document so its schema remains
|
|
22
|
+
* the source of truth.
|
|
26
23
|
*/
|
|
27
24
|
export class ExperimentsApi {
|
|
28
25
|
http;
|
|
@@ -50,6 +47,29 @@ export class ExperimentsApi {
|
|
|
50
47
|
path: `/v1/experiments/${encodeURIComponent(id)}`,
|
|
51
48
|
});
|
|
52
49
|
}
|
|
50
|
+
create(document) {
|
|
51
|
+
return this.http.request({
|
|
52
|
+
method: "POST",
|
|
53
|
+
path: "/v1/experiments",
|
|
54
|
+
body: document,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
update(id, document, project) {
|
|
58
|
+
return this.http.request({
|
|
59
|
+
method: "PATCH",
|
|
60
|
+
path: `/v1/experiments/${encodeURIComponent(id)}`,
|
|
61
|
+
query: project ? { project } : undefined,
|
|
62
|
+
body: document,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
delete(id, project) {
|
|
66
|
+
return this.http.request({
|
|
67
|
+
method: "DELETE",
|
|
68
|
+
path: `/v1/experiments/${encodeURIComponent(id)}`,
|
|
69
|
+
query: project ? { project } : undefined,
|
|
70
|
+
expect: "empty",
|
|
71
|
+
});
|
|
72
|
+
}
|
|
53
73
|
startById(id) {
|
|
54
74
|
return this.http.request({
|
|
55
75
|
method: "POST",
|
|
@@ -111,6 +131,9 @@ export function attachExperiments(client, http) {
|
|
|
111
131
|
const hybrid = factory;
|
|
112
132
|
hybrid.list = api.list.bind(api);
|
|
113
133
|
hybrid.get = api.get.bind(api);
|
|
134
|
+
hybrid.create = api.create.bind(api);
|
|
135
|
+
hybrid.update = api.update.bind(api);
|
|
136
|
+
hybrid.delete = api.delete.bind(api);
|
|
114
137
|
hybrid.startById = api.startById.bind(api);
|
|
115
138
|
hybrid.endById = api.endById.bind(api);
|
|
116
139
|
hybrid.cancelById = api.cancelById.bind(api);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/resources/experiments.ts"],"names":[],"mappings":"AAUA,OAAO,EAAa,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AAczD,SAAS,SAAS,CAAC,IAAiB;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,GAAG,GAA6B,EAAE,CAAC;IACzC,IAAI,IAAI,CAAC,QAAQ;QAAE,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChD,IAAI,IAAI,CAAC,MAAM;QAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpE,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACvE,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACrD,OAAO,GAAG,CAAC;AACb,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/resources/experiments.ts"],"names":[],"mappings":"AAUA,OAAO,EAAa,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,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22
|
*
|
|
23
23
|
* Caller headers are merged last so they can override either.
|
|
24
24
|
*/
|
|
25
|
-
export declare const USER_AGENT = "introspection-sdk/0.
|
|
25
|
+
export declare const USER_AGENT = "introspection-sdk/0.23.0";
|
|
26
26
|
/**
|
|
27
27
|
* The OTLP HTTP transport takes the client's user agent as a dedicated option
|
|
28
28
|
* rather than a header: it assigns `headers['User-Agent']` unconditionally
|
|
@@ -31,7 +31,7 @@ export declare const USER_AGENT = "introspection-sdk/0.21.1";
|
|
|
31
31
|
* token, and exports arrive attributable to a client and a release.
|
|
32
32
|
*/
|
|
33
33
|
export declare const otlpUserAgent: {
|
|
34
|
-
readonly userAgent: "introspection-sdk/0.
|
|
34
|
+
readonly userAgent: "introspection-sdk/0.23.0";
|
|
35
35
|
};
|
|
36
36
|
export declare function exporterHeaders(token: string | undefined, additionalHeaders?: Record<string, string>): Record<string, string>;
|
|
37
37
|
/**
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@introspection-sdk/introspection-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Introspection observability SDK for Node.js",
|
|
6
6
|
"engines": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dist/"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@earendil-works/pi-agent-core": "^0.84.
|
|
34
|
+
"@earendil-works/pi-agent-core": "^0.84.3",
|
|
35
35
|
"@opentelemetry/api-logs": "^0.221.0",
|
|
36
36
|
"@opentelemetry/context-async-hooks": "^2.10.0",
|
|
37
37
|
"@opentelemetry/core": "^2.10.0",
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"@opentelemetry/api": "^1.9.1",
|
|
101
101
|
"https-proxy-agent": "^7.0.6",
|
|
102
102
|
"proxy-from-env": "^2.1.0",
|
|
103
|
-
"@introspection-sdk/http": "0.
|
|
104
|
-
"@introspection-sdk/
|
|
105
|
-
"@introspection-sdk/introspection-proxy": "0.
|
|
106
|
-
"@introspection-sdk/
|
|
103
|
+
"@introspection-sdk/http": "0.23.0",
|
|
104
|
+
"@introspection-sdk/introspection-pi": "0.23.0",
|
|
105
|
+
"@introspection-sdk/introspection-proxy": "0.23.0",
|
|
106
|
+
"@introspection-sdk/types": "0.23.0"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"lint": "eslint . --max-warnings 0",
|