@introspection-sdk/introspection-browser 0.5.5 → 0.5.7
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/.turbo/turbo-build.log +1 -1
- package/README.md +39 -46
- package/dist/api/client.d.ts +15 -27
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +30 -73
- package/dist/api/client.js.map +1 -1
- package/dist/api/http.d.ts +0 -23
- package/dist/api/http.d.ts.map +1 -1
- package/dist/api/http.js +0 -38
- package/dist/api/http.js.map +1 -1
- package/dist/api/index.d.ts +18 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +17 -11
- package/dist/api/index.js.map +1 -1
- package/package.json +3 -3
- package/src/api/client.ts +34 -106
- package/src/api/http.ts +0 -56
- package/src/api/index.ts +17 -38
- package/dist/api/runner.d.ts +0 -45
- package/dist/api/runner.d.ts.map +0 -1
- package/dist/api/runner.js +0 -87
- package/dist/api/runner.js.map +0 -1
- package/dist/api/runtimes.d.ts +0 -12
- package/dist/api/runtimes.d.ts.map +0 -1
- package/dist/api/runtimes.js +0 -14
- package/dist/api/runtimes.js.map +0 -1
- package/src/api/runner.ts +0 -127
- package/src/api/runtimes.ts +0 -32
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @introspection-sdk/introspection-browser@0.5.
|
|
2
|
+
> @introspection-sdk/introspection-browser@0.5.7 build /home/runner/work/introspection-js-sdk/introspection-js-sdk/packages/introspection-browser
|
|
3
3
|
> tsc
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -38,30 +38,42 @@ single-page app **create and stream Introspection tasks directly from the
|
|
|
38
38
|
browser, with no API key in JavaScript**. Authentication is the standard B2B2C
|
|
39
39
|
flow (see the [`sample-auth`](../../examples/apps/sample-auth) example):
|
|
40
40
|
|
|
41
|
+
**The browser talks only to the Data Plane.** Runtime resolution is a Control
|
|
42
|
+
Plane call and stays on your backend, so the CP never has to serve CORS to
|
|
43
|
+
customer web origins.
|
|
44
|
+
|
|
41
45
|
1. The app's **own backend ("broker")** mints an Introspection access token —
|
|
42
46
|
via RFC 8693 token-exchange of the partner IdP token, a PKCE
|
|
43
47
|
`authorization_code`, or `client_credentials`. The IdP secret never leaves
|
|
44
|
-
the backend.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
the backend. The backend returns **`{ token, runtimeId, dpUrl }`**: it
|
|
49
|
+
resolves the runtime id server-side (e.g. with the Node SDK's
|
|
50
|
+
`client.runtimes.resolveByName("support-agent")`) and supplies the Data
|
|
51
|
+
Plane URL, so the SPA needs no Introspection config of its own.
|
|
52
|
+
2. `client.connect()` redeems the token at the **Data Plane**
|
|
53
|
+
`POST /v1/oauth/exchange` for the HttpOnly `intro_dp_session` cookie.
|
|
54
|
+
3. `client.tasks.start({ runtime_id })` and friends ride that cookie against
|
|
55
|
+
the Data Plane for tasks, files, conversations, and shares.
|
|
49
56
|
|
|
50
57
|
```typescript
|
|
51
58
|
import { IntrospectionApiClient } from "@introspection-sdk/introspection-browser/api";
|
|
52
59
|
|
|
60
|
+
// Your backend returns { token, runtimeId, dpUrl }: it mints the access token,
|
|
61
|
+
// resolves the runtime id, and supplies the DP URL — so the browser never
|
|
62
|
+
// calls the CP and carries no Introspection config of its own.
|
|
63
|
+
const { token, runtimeId, dpUrl } = await fetch(
|
|
64
|
+
"/api/introspection/session",
|
|
65
|
+
).then((r) => r.json());
|
|
66
|
+
|
|
53
67
|
const client = new IntrospectionApiClient({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
68
|
+
dpUrl,
|
|
69
|
+
getToken: () => token,
|
|
57
70
|
});
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
identity: { user_id: "u_42" },
|
|
61
|
-
});
|
|
72
|
+
await client.connect(); // -> intro_dp_session cookie
|
|
62
73
|
|
|
63
|
-
const run = await
|
|
74
|
+
const run = await client.tasks.start({
|
|
64
75
|
prompt: "Summarize my latest order",
|
|
76
|
+
runtime_id: runtimeId,
|
|
65
77
|
idle_timeout_seconds: 120, // idle window before the sandbox is torn down
|
|
66
78
|
});
|
|
67
79
|
|
|
@@ -70,62 +82,43 @@ for await (const ev of run.stream()) {
|
|
|
70
82
|
}
|
|
71
83
|
```
|
|
72
84
|
|
|
73
|
-
`
|
|
85
|
+
`client.tasks` exposes the full CRUD surface (`create` / `start` / `get` /
|
|
74
86
|
`list` / `update` / `delete` / `archive` / `unarchive`) plus per-run streaming
|
|
75
87
|
(`run.stream()`, `run.text()`, `run.cancel()`).
|
|
76
88
|
|
|
77
89
|
`create` and `start` accept **`idle_timeout_seconds`** (`number`) to override
|
|
78
90
|
the interactive idle window before the sandbox is torn down. `0` tears it down
|
|
79
91
|
as soon as it's provisioned; omit to use the deployment default. Clamped to the
|
|
80
|
-
task timeout.
|
|
81
|
-
|
|
82
|
-
The older cookie-session path is still available for apps that already know a
|
|
83
|
-
Data Plane URL:
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
const client = new IntrospectionApiClient({
|
|
87
|
-
dpUrl: "https://dp.us.introspection.dev",
|
|
88
|
-
getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
await client.connect(); // -> intro_dp_session cookie
|
|
92
|
-
await client.tasks.start({
|
|
93
|
-
prompt: "Summarize my latest order",
|
|
94
|
-
runtime_id: "019ed295-5d76-7432-863b-f9327af50221",
|
|
95
|
-
});
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
For new runtime-backed browser apps, prefer
|
|
99
|
-
`client.runtimes("support-agent").run()` so the browser follows the same
|
|
100
|
-
runtime resolution flow as the Node SDK and does not carry runtime ids.
|
|
92
|
+
task timeout. When no `runtime_id` is supplied, pass `agent_name` to select a
|
|
93
|
+
named recipe agent instead.
|
|
101
94
|
|
|
102
95
|
## Files and conversations
|
|
103
96
|
|
|
104
|
-
The same
|
|
105
|
-
`/v1/conversations`
|
|
97
|
+
The same cookie session also reaches `/v1/files` and (read-only)
|
|
98
|
+
`/v1/conversations` on the Data Plane:
|
|
106
99
|
|
|
107
100
|
```typescript
|
|
108
101
|
// Files — CRUD + upload/download, all identity-scoped
|
|
109
|
-
await
|
|
110
|
-
const page = await
|
|
111
|
-
const bytes = await
|
|
102
|
+
await client.files.upload({ file: new Blob(["hi"]), name: "hi.txt" });
|
|
103
|
+
const page = await client.files.list();
|
|
104
|
+
const bytes = await client.files.download(page.records[0].id);
|
|
112
105
|
|
|
113
106
|
// Conversations — read-only projection over the telemetry store
|
|
114
|
-
for await (const summary of
|
|
107
|
+
for await (const summary of client.conversations.list()) {
|
|
115
108
|
console.log(summary.conversation_id);
|
|
116
109
|
}
|
|
117
110
|
// Resolve the latest turn of a conversation (Responses-API shape)
|
|
118
|
-
const turn = await
|
|
111
|
+
const turn = await client.conversations.retrieve(conversationId);
|
|
119
112
|
console.log(turn?.output_messages);
|
|
120
113
|
```
|
|
121
114
|
|
|
122
|
-
`
|
|
115
|
+
`client.files` mirrors the Node SDK's `FilesApi` (`list` / `upload` /
|
|
123
116
|
`createText` / `get` / `update` / `delete` / `download` / `downloadStream`,
|
|
124
|
-
plus `files.versions`). `
|
|
117
|
+
plus `files.versions`). `client.conversations` mirrors `ConversationsApi`
|
|
125
118
|
(`list`, `retrieve`, and `conversations.items.list()` / `.get()`). Both `list`
|
|
126
119
|
helpers return a `Paginator` — `await` it for the first page or `for await` it
|
|
127
120
|
to auto-page.
|
|
128
121
|
|
|
129
|
-
> **CORS:** the
|
|
130
|
-
>
|
|
131
|
-
>
|
|
122
|
+
> **CORS:** the browser only calls the Data Plane, so just the selected Data
|
|
123
|
+
> Plane needs to allow the SPA origin. The Control Plane never receives browser
|
|
124
|
+
> requests — runtime resolution happens on your backend.
|
package/dist/api/client.d.ts
CHANGED
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
* Browser-side Introspection API client.
|
|
3
3
|
*
|
|
4
4
|
* Lets a single-page app create and stream Introspection tasks directly
|
|
5
|
-
* from the browser, with no API key in JavaScript. The
|
|
5
|
+
* from the browser, with no API key in JavaScript. The browser talks only
|
|
6
|
+
* to the Data Plane — runtime resolution and any other Control Plane work
|
|
7
|
+
* stays on the app's backend, so the CP never needs to serve CORS to
|
|
8
|
+
* customer web origins. The auth boundary:
|
|
6
9
|
*
|
|
7
|
-
* 1. The SPA's own backend ("broker") mints
|
|
8
|
-
* token — via RFC 8693 token-exchange of the partner IdP
|
|
9
|
-
* PKCE `authorization_code`, or `client_credentials
|
|
10
|
-
* secret never leaves the backend
|
|
11
|
-
*
|
|
10
|
+
* 1. The SPA's own backend ("broker") mints a short-lived Introspection
|
|
11
|
+
* access token — via RFC 8693 token-exchange of the partner IdP
|
|
12
|
+
* token, a PKCE `authorization_code`, or `client_credentials` (the
|
|
13
|
+
* IdP secret never leaves the backend) — and, when a specific runtime
|
|
14
|
+
* is needed, resolves its `runtime_id` server-side. The SPA fetches
|
|
15
|
+
* the token through the `getToken` callback.
|
|
12
16
|
* 2. `connect()` redeems the token at the DP `POST /v1/oauth/exchange`
|
|
13
17
|
* for the HttpOnly `intro_dp_session` cookie.
|
|
14
18
|
* 3. Every subsequent call rides that cookie (`credentials: "include"`)
|
|
15
|
-
* — `client.tasks.start(
|
|
19
|
+
* — `client.tasks.start({ runtime_id })`, `.get(...)`, run streaming,
|
|
20
|
+
* etc.
|
|
16
21
|
*
|
|
17
22
|
* When the session cookie expires, an in-flight request gets a 401, and
|
|
18
23
|
* the client transparently re-runs `getToken` + the DP exchange once
|
|
@@ -20,21 +25,13 @@
|
|
|
20
25
|
*/
|
|
21
26
|
import { ConversationsClient, FilesClient, SharesClient } from "@introspection-sdk/http";
|
|
22
27
|
import { TasksClient } from "./tasks.js";
|
|
23
|
-
import { type BrowserRuntimeHandleFactory, type BrowserRuntimesClient } from "./runtimes.js";
|
|
24
28
|
export interface IntrospectionApiClientOptions {
|
|
25
|
-
/**
|
|
26
|
-
* Control Plane REST base URL. Used by `client.runtimes(name).run()` to
|
|
27
|
-
* resolve runtimes and mint runner specs. Defaults to
|
|
28
|
-
* `https://api.introspection.dev`.
|
|
29
|
-
*/
|
|
30
|
-
cpUrl?: string;
|
|
31
29
|
/**
|
|
32
30
|
* Data Plane REST base URL for the cookie-session APIs (`connect()` and
|
|
33
|
-
*
|
|
34
|
-
* `client.shares`).
|
|
35
|
-
* not require this option.
|
|
31
|
+
* `client.tasks` / `client.files` / `client.conversations` /
|
|
32
|
+
* `client.shares`). Required — the browser only talks to the DP.
|
|
36
33
|
*/
|
|
37
|
-
dpUrl
|
|
34
|
+
dpUrl: string;
|
|
38
35
|
/**
|
|
39
36
|
* Returns a fresh Introspection access token from the app's broker
|
|
40
37
|
* (its own backend). Called on `connect()` and again whenever the DP
|
|
@@ -50,13 +47,7 @@ export interface IntrospectionApiClientOptions {
|
|
|
50
47
|
}
|
|
51
48
|
export declare class IntrospectionApiClient {
|
|
52
49
|
private readonly opts;
|
|
53
|
-
/**
|
|
54
|
-
* CRUD on CP `/v1/runtimes` and the `(idOrName) => RuntimeHandle` factory.
|
|
55
|
-
* Call as `client.runtimes("customer-agent").run()`.
|
|
56
|
-
*/
|
|
57
|
-
readonly runtimes: BrowserRuntimesClient & BrowserRuntimeHandleFactory;
|
|
58
50
|
private readonly fetchImpl;
|
|
59
|
-
private readonly cpHttp;
|
|
60
51
|
private readonly cookieClients;
|
|
61
52
|
constructor(opts: IntrospectionApiClientOptions);
|
|
62
53
|
/** `/v1/tasks` operations bound to the DP session cookie. */
|
|
@@ -75,8 +66,5 @@ export declare class IntrospectionApiClient {
|
|
|
75
66
|
private exchange;
|
|
76
67
|
/** 401 recovery: re-exchange, reporting success so the call can retry. */
|
|
77
68
|
private reexchange;
|
|
78
|
-
private requireCookieClient;
|
|
79
|
-
private requireDpUrl;
|
|
80
|
-
private requestFreshRunnerSpec;
|
|
81
69
|
}
|
|
82
70
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASzC,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED,qBAAa,sBAAsB;IAIrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;gBAEjB,IAAI,EAAE,6BAA6B;IAwBhE,6DAA6D;IAC7D,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED,6DAA6D;IAC7D,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED,4EAA4E;IAC5E,IAAI,aAAa,IAAI,mBAAmB,CAEvC;IAED,oEAAoE;IACpE,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAIhB,QAAQ;IAiBtB,0EAA0E;YAC5D,UAAU;CAQzB"}
|
package/dist/api/client.js
CHANGED
|
@@ -2,35 +2,33 @@
|
|
|
2
2
|
* Browser-side Introspection API client.
|
|
3
3
|
*
|
|
4
4
|
* Lets a single-page app create and stream Introspection tasks directly
|
|
5
|
-
* from the browser, with no API key in JavaScript. The
|
|
5
|
+
* from the browser, with no API key in JavaScript. The browser talks only
|
|
6
|
+
* to the Data Plane — runtime resolution and any other Control Plane work
|
|
7
|
+
* stays on the app's backend, so the CP never needs to serve CORS to
|
|
8
|
+
* customer web origins. The auth boundary:
|
|
6
9
|
*
|
|
7
|
-
* 1. The SPA's own backend ("broker") mints
|
|
8
|
-
* token — via RFC 8693 token-exchange of the partner IdP
|
|
9
|
-
* PKCE `authorization_code`, or `client_credentials
|
|
10
|
-
* secret never leaves the backend
|
|
11
|
-
*
|
|
10
|
+
* 1. The SPA's own backend ("broker") mints a short-lived Introspection
|
|
11
|
+
* access token — via RFC 8693 token-exchange of the partner IdP
|
|
12
|
+
* token, a PKCE `authorization_code`, or `client_credentials` (the
|
|
13
|
+
* IdP secret never leaves the backend) — and, when a specific runtime
|
|
14
|
+
* is needed, resolves its `runtime_id` server-side. The SPA fetches
|
|
15
|
+
* the token through the `getToken` callback.
|
|
12
16
|
* 2. `connect()` redeems the token at the DP `POST /v1/oauth/exchange`
|
|
13
17
|
* for the HttpOnly `intro_dp_session` cookie.
|
|
14
18
|
* 3. Every subsequent call rides that cookie (`credentials: "include"`)
|
|
15
|
-
* — `client.tasks.start(
|
|
19
|
+
* — `client.tasks.start({ runtime_id })`, `.get(...)`, run streaming,
|
|
20
|
+
* etc.
|
|
16
21
|
*
|
|
17
22
|
* When the session cookie expires, an in-flight request gets a 401, and
|
|
18
23
|
* the client transparently re-runs `getToken` + the DP exchange once
|
|
19
24
|
* before retrying.
|
|
20
25
|
*/
|
|
21
|
-
import {
|
|
26
|
+
import { BrowserHttpClient, stripTrailingSlash, toApiError } from "./http.js";
|
|
22
27
|
import { ConversationsClient, FilesClient, SharesClient, } from "@introspection-sdk/http";
|
|
23
28
|
import { TasksClient } from "./tasks.js";
|
|
24
|
-
import { attachBrowserRuntimes, } from "./runtimes.js";
|
|
25
29
|
export class IntrospectionApiClient {
|
|
26
30
|
opts;
|
|
27
|
-
/**
|
|
28
|
-
* CRUD on CP `/v1/runtimes` and the `(idOrName) => RuntimeHandle` factory.
|
|
29
|
-
* Call as `client.runtimes("customer-agent").run()`.
|
|
30
|
-
*/
|
|
31
|
-
runtimes;
|
|
32
31
|
fetchImpl;
|
|
33
|
-
cpHttp;
|
|
34
32
|
cookieClients;
|
|
35
33
|
constructor(opts) {
|
|
36
34
|
this.opts = opts;
|
|
@@ -38,63 +36,48 @@ export class IntrospectionApiClient {
|
|
|
38
36
|
if (!this.fetchImpl) {
|
|
39
37
|
throw new Error("global fetch is unavailable; pass `fetch` or run in a modern browser");
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
this.runtimes = attachBrowserRuntimes(this.cpHttp, {
|
|
39
|
+
if (!opts.dpUrl) {
|
|
40
|
+
throw new Error("IntrospectionApiClient requires a dpUrl");
|
|
41
|
+
}
|
|
42
|
+
const http = new BrowserHttpClient({
|
|
43
|
+
apiUrl: opts.dpUrl,
|
|
48
44
|
additionalHeaders: opts.additionalHeaders,
|
|
49
45
|
fetch: opts.fetch,
|
|
50
|
-
|
|
46
|
+
onUnauthorized: () => this.reexchange(),
|
|
51
47
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
this.cookieClients = {
|
|
60
|
-
tasks: new TasksClient(http),
|
|
61
|
-
files: new FilesClient(http),
|
|
62
|
-
conversations: new ConversationsClient(http),
|
|
63
|
-
shares: new SharesClient(http),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.cookieClients = null;
|
|
68
|
-
}
|
|
48
|
+
this.cookieClients = {
|
|
49
|
+
tasks: new TasksClient(http),
|
|
50
|
+
files: new FilesClient(http),
|
|
51
|
+
conversations: new ConversationsClient(http),
|
|
52
|
+
shares: new SharesClient(http),
|
|
53
|
+
};
|
|
69
54
|
}
|
|
70
55
|
/** `/v1/tasks` operations bound to the DP session cookie. */
|
|
71
56
|
get tasks() {
|
|
72
|
-
return this.
|
|
57
|
+
return this.cookieClients.tasks;
|
|
73
58
|
}
|
|
74
59
|
/** `/v1/files` operations bound to the DP session cookie. */
|
|
75
60
|
get files() {
|
|
76
|
-
return this.
|
|
61
|
+
return this.cookieClients.files;
|
|
77
62
|
}
|
|
78
63
|
/** Read-only `/v1/conversations` projection bound to the session cookie. */
|
|
79
64
|
get conversations() {
|
|
80
|
-
return this.
|
|
65
|
+
return this.cookieClients.conversations;
|
|
81
66
|
}
|
|
82
67
|
/** `/v1/shares` read-sharing grants bound to the session cookie. */
|
|
83
68
|
get shares() {
|
|
84
|
-
return this.
|
|
69
|
+
return this.cookieClients.shares;
|
|
85
70
|
}
|
|
86
71
|
/**
|
|
87
72
|
* Mint a token via `getToken` and redeem it at the DP for the
|
|
88
73
|
* `intro_dp_session` cookie. Call once before issuing task requests.
|
|
89
74
|
*/
|
|
90
75
|
async connect() {
|
|
91
|
-
this.requireDpUrl();
|
|
92
76
|
await this.exchange();
|
|
93
77
|
}
|
|
94
78
|
async exchange() {
|
|
95
|
-
const dpUrl = this.requireDpUrl();
|
|
96
79
|
const token = await this.opts.getToken();
|
|
97
|
-
const res = await this.fetchImpl(`${stripTrailingSlash(dpUrl)}/v1/oauth/exchange`, {
|
|
80
|
+
const res = await this.fetchImpl(`${stripTrailingSlash(this.opts.dpUrl)}/v1/oauth/exchange`, {
|
|
98
81
|
method: "POST",
|
|
99
82
|
headers: {
|
|
100
83
|
"Content-Type": "application/json",
|
|
@@ -116,31 +99,5 @@ export class IntrospectionApiClient {
|
|
|
116
99
|
return false;
|
|
117
100
|
}
|
|
118
101
|
}
|
|
119
|
-
requireCookieClient(key) {
|
|
120
|
-
if (!this.cookieClients) {
|
|
121
|
-
throw new Error(`IntrospectionApiClient.${key} requires dpUrl; use client.runtimes(...).run() for runner-bound APIs or pass dpUrl for cookie-session APIs`);
|
|
122
|
-
}
|
|
123
|
-
return this.cookieClients[key];
|
|
124
|
-
}
|
|
125
|
-
requireDpUrl() {
|
|
126
|
-
if (!this.opts.dpUrl) {
|
|
127
|
-
throw new Error("IntrospectionApiClient.connect() requires dpUrl; use client.runtimes(...).run() for runner-bound APIs or pass dpUrl for cookie-session APIs");
|
|
128
|
-
}
|
|
129
|
-
return this.opts.dpUrl;
|
|
130
|
-
}
|
|
131
|
-
async requestFreshRunnerSpec(source) {
|
|
132
|
-
if (source.kind === "runtime") {
|
|
133
|
-
return this.cpHttp.request({
|
|
134
|
-
method: "POST",
|
|
135
|
-
path: `/v1/runtimes/${encodeURIComponent(source.id)}/run`,
|
|
136
|
-
body: source.options ?? {},
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return this.cpHttp.request({
|
|
140
|
-
method: "POST",
|
|
141
|
-
path: `/v1/experiments/${encodeURIComponent(source.id)}/run`,
|
|
142
|
-
body: source.options ?? {},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
102
|
}
|
|
146
103
|
//# sourceMappingURL=client.js.map
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA8BzC,MAAM,OAAO,sBAAsB;IAIJ;IAHZ,SAAS,CAAe;IACxB,aAAa,CAAgB;IAE9C,YAA6B,IAAmC;QAAnC,SAAI,GAAJ,IAAI,CAA+B;QAC9D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,iBAAiB,CAAC;YACjC,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE;SACxC,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,GAAG;YACnB,KAAK,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC;YAC5B,KAAK,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC;YAC5B,aAAa,EAAE,IAAI,mBAAmB,CAAC,IAAI,CAAC;YAC5C,MAAM,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC;SAC/B,CAAC;IACJ,CAAC;IAED,6DAA6D;IAC7D,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IAClC,CAAC;IAED,6DAA6D;IAC7D,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IAClC,CAAC;IAED,4EAA4E;IAC5E,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;IAC1C,CAAC;IAED,oEAAoE;IACpE,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,QAAQ;QACpB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAC9B,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAC1D;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC;aACvC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;YAC/B,WAAW,EAAE,SAAS;SACvB,CACF,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAED,0EAA0E;IAClE,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
package/dist/api/http.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ export interface BrowserHttpConfig {
|
|
|
26
26
|
*/
|
|
27
27
|
onUnauthorized?: () => Promise<boolean>;
|
|
28
28
|
}
|
|
29
|
-
export type BrowserApiHttpClient = Pick<BaseHttpClient, "request" | "stream">;
|
|
30
29
|
/**
|
|
31
30
|
* Cookie-authenticated HTTP wrapper bound to one DP endpoint. Has no
|
|
32
31
|
* opinion about which resource it serves — the caller picks the path.
|
|
@@ -34,26 +33,4 @@ export type BrowserApiHttpClient = Pick<BaseHttpClient, "request" | "stream">;
|
|
|
34
33
|
export declare class BrowserHttpClient extends BaseHttpClient {
|
|
35
34
|
constructor(cfg: BrowserHttpConfig);
|
|
36
35
|
}
|
|
37
|
-
export interface BrowserBearerHttpConfig {
|
|
38
|
-
/** REST base URL every request is prefixed with. */
|
|
39
|
-
apiUrl: string;
|
|
40
|
-
/** Bearer token, or a provider returning the latest token before each request. */
|
|
41
|
-
token: string | (() => string | Promise<string>);
|
|
42
|
-
/** Extra headers merged into every request. */
|
|
43
|
-
additionalHeaders?: Record<string, string>;
|
|
44
|
-
/** Custom `fetch` (for tests or non-standard runtimes). */
|
|
45
|
-
fetch?: typeof fetch;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Bearer-authenticated browser HTTP wrapper. Used for CP runtime calls with
|
|
49
|
-
* brokered access tokens and for DP runner calls with CP-minted runner tokens.
|
|
50
|
-
*/
|
|
51
|
-
export declare class BrowserBearerHttpClient extends BaseHttpClient {
|
|
52
|
-
private readonly tokenBox;
|
|
53
|
-
private readonly getToken?;
|
|
54
|
-
constructor(cfg: BrowserBearerHttpConfig);
|
|
55
|
-
private refreshToken;
|
|
56
|
-
request<T>(opts: Parameters<BaseHttpClient["request"]>[0]): Promise<T>;
|
|
57
|
-
stream(opts: Parameters<BaseHttpClient["stream"]>[0]): Promise<Response>;
|
|
58
|
-
}
|
|
59
36
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/api/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAED
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;gBACvC,GAAG,EAAE,iBAAiB;CAYnC"}
|
package/dist/api/http.js
CHANGED
|
@@ -31,42 +31,4 @@ export class BrowserHttpClient extends BaseHttpClient {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Bearer-authenticated browser HTTP wrapper. Used for CP runtime calls with
|
|
36
|
-
* brokered access tokens and for DP runner calls with CP-minted runner tokens.
|
|
37
|
-
*/
|
|
38
|
-
export class BrowserBearerHttpClient extends BaseHttpClient {
|
|
39
|
-
tokenBox;
|
|
40
|
-
getToken;
|
|
41
|
-
constructor(cfg) {
|
|
42
|
-
const tokenBox = { value: typeof cfg.token === "string" ? cfg.token : "" };
|
|
43
|
-
super({
|
|
44
|
-
apiUrl: cfg.apiUrl,
|
|
45
|
-
additionalHeaders: cfg.additionalHeaders,
|
|
46
|
-
fetch: cfg.fetch,
|
|
47
|
-
transport: {
|
|
48
|
-
authHeaders: () => {
|
|
49
|
-
if (!tokenBox.value)
|
|
50
|
-
return {};
|
|
51
|
-
return { Authorization: `Bearer ${tokenBox.value}` };
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
this.tokenBox = tokenBox;
|
|
56
|
-
this.getToken = typeof cfg.token === "function" ? cfg.token : undefined;
|
|
57
|
-
}
|
|
58
|
-
async refreshToken() {
|
|
59
|
-
if (!this.getToken)
|
|
60
|
-
return;
|
|
61
|
-
this.tokenBox.value = await this.getToken();
|
|
62
|
-
}
|
|
63
|
-
async request(opts) {
|
|
64
|
-
await this.refreshToken();
|
|
65
|
-
return super.request(opts);
|
|
66
|
-
}
|
|
67
|
-
async stream(opts) {
|
|
68
|
-
await this.refreshToken();
|
|
69
|
-
return super.stream(opts);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
34
|
//# sourceMappingURL=http.js.map
|
package/dist/api/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,4EAA4E;AAC5E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,4EAA4E;AAC5E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC;AAiB1C;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACnD,YAAY,GAAsB;QAChC,KAAK,CAAC;YACJ,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;YACxC,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,SAAS,EAAE;gBACT,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;gBACvB,WAAW,EAAE,SAAS;gBACtB,cAAc,EAAE,GAAG,CAAC,cAAc;aACnC;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -6,34 +6,40 @@
|
|
|
6
6
|
* Separate from the package's default telemetry export so apps only pull
|
|
7
7
|
* in what they use.
|
|
8
8
|
*
|
|
9
|
+
* The browser talks only to the Data Plane. Resolving a runtime by name
|
|
10
|
+
* (a Control Plane call) stays on your backend, which hands the browser a
|
|
11
|
+
* short-lived access token plus the resolved `runtime_id`.
|
|
12
|
+
*
|
|
9
13
|
* @example
|
|
10
14
|
* ```typescript
|
|
11
15
|
* import { IntrospectionApiClient } from "@introspection-sdk/introspection-browser/api";
|
|
12
16
|
*
|
|
17
|
+
* // Your backend returns { token, runtimeId, dpUrl } — it mints the access
|
|
18
|
+
* // token, resolves the runtime id, and surfaces the DP URL (e.g. from the
|
|
19
|
+
* // Node SDK's serviceAccountToken response), so the browser never calls the CP.
|
|
20
|
+
* const { token, runtimeId, dpUrl } = await fetch(
|
|
21
|
+
* "/api/introspection/session",
|
|
22
|
+
* ).then((r) => r.json());
|
|
23
|
+
*
|
|
13
24
|
* const client = new IntrospectionApiClient({
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* // project is derived from its claims — no projectId option needed)
|
|
17
|
-
* getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
25
|
+
* dpUrl,
|
|
26
|
+
* getToken: () => token,
|
|
18
27
|
* });
|
|
19
28
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* });
|
|
23
|
-
* const run = await runner.tasks.start({
|
|
29
|
+
* await client.connect(); // -> intro_dp_session cookie
|
|
30
|
+
* const run = await client.tasks.start({
|
|
24
31
|
* prompt: "Summarize my latest order",
|
|
32
|
+
* runtime_id: runtimeId,
|
|
25
33
|
* });
|
|
26
34
|
* for await (const ev of run.stream()) console.log(ev.event, ev.data);
|
|
27
35
|
* ```
|
|
28
36
|
*/
|
|
29
37
|
export { IntrospectionApiClient, type IntrospectionApiClientOptions, } from "./client.js";
|
|
30
|
-
export { BrowserRunner, Runner, type BrowserRunnerOwner, type BrowserRunnerSource, } from "./runner.js";
|
|
31
|
-
export { BrowserRuntimesClient, BrowserRuntimeHandle, attachBrowserRuntimes, isUuid, type BrowserRuntimeHandleFactory, type BrowserRuntimeRunRequestBody, } from "./runtimes.js";
|
|
32
38
|
export { TasksClient, TaskRunsClient, RunHandle, type CreateTaskParams, type StartTaskParams, } from "./tasks.js";
|
|
33
39
|
export { ConversationItemsClient, ConversationsClient, FileVersionsClient, FilesClient, SharesClient, type FileUploadBody, } from "@introspection-sdk/http";
|
|
34
|
-
export {
|
|
40
|
+
export { BrowserHttpClient, type BrowserHttpConfig } from "./http.js";
|
|
35
41
|
export { parseSse } from "./sse.js";
|
|
36
42
|
export { Paginator, cursorPaginate, type PageSource, } from "@introspection-sdk/http";
|
|
37
|
-
export type { Task, TaskRun, TaskStatus, TaskCreateResponse, TaskListParams, TaskUpdateParams, TaskRunCreateParams, TaskCancelResponse, RunIdentityInput, Paginated, SseEvent, File, FileType, FileListParams, FileUpdateParams, FileCreateTextParams, ListParams, ConversationSummary, ConversationItem, ConversationItemList, ConversationListParams, ConversationItemListParams, ConversationItemInclude, ConversationResponse, ResourceShare, ShareResourceType, ShareCreateParams, ShareListParams,
|
|
43
|
+
export type { Task, TaskRun, TaskStatus, TaskCreateResponse, TaskListParams, TaskUpdateParams, TaskRunCreateParams, TaskCancelResponse, RunIdentityInput, Paginated, SseEvent, File, FileType, FileListParams, FileUpdateParams, FileCreateTextParams, ListParams, ConversationSummary, ConversationItem, ConversationItemList, ConversationListParams, ConversationItemListParams, ConversationItemInclude, ConversationResponse, ResourceShare, ShareResourceType, ShareCreateParams, ShareListParams, } from "@introspection-sdk/types";
|
|
38
44
|
export { IntrospectionAPIError, AuthenticationError, InsufficientScopeError, NotFoundError, NetworkError, RunnerExpiredError, } from "@introspection-sdk/types";
|
|
39
45
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,SAAS,EACT,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,kBAAkB,GACnB,MAAM,0BAA0B,CAAC"}
|
package/dist/api/index.js
CHANGED
|
@@ -6,32 +6,38 @@
|
|
|
6
6
|
* Separate from the package's default telemetry export so apps only pull
|
|
7
7
|
* in what they use.
|
|
8
8
|
*
|
|
9
|
+
* The browser talks only to the Data Plane. Resolving a runtime by name
|
|
10
|
+
* (a Control Plane call) stays on your backend, which hands the browser a
|
|
11
|
+
* short-lived access token plus the resolved `runtime_id`.
|
|
12
|
+
*
|
|
9
13
|
* @example
|
|
10
14
|
* ```typescript
|
|
11
15
|
* import { IntrospectionApiClient } from "@introspection-sdk/introspection-browser/api";
|
|
12
16
|
*
|
|
17
|
+
* // Your backend returns { token, runtimeId, dpUrl } — it mints the access
|
|
18
|
+
* // token, resolves the runtime id, and surfaces the DP URL (e.g. from the
|
|
19
|
+
* // Node SDK's serviceAccountToken response), so the browser never calls the CP.
|
|
20
|
+
* const { token, runtimeId, dpUrl } = await fetch(
|
|
21
|
+
* "/api/introspection/session",
|
|
22
|
+
* ).then((r) => r.json());
|
|
23
|
+
*
|
|
13
24
|
* const client = new IntrospectionApiClient({
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* // project is derived from its claims — no projectId option needed)
|
|
17
|
-
* getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
25
|
+
* dpUrl,
|
|
26
|
+
* getToken: () => token,
|
|
18
27
|
* });
|
|
19
28
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* });
|
|
23
|
-
* const run = await runner.tasks.start({
|
|
29
|
+
* await client.connect(); // -> intro_dp_session cookie
|
|
30
|
+
* const run = await client.tasks.start({
|
|
24
31
|
* prompt: "Summarize my latest order",
|
|
32
|
+
* runtime_id: runtimeId,
|
|
25
33
|
* });
|
|
26
34
|
* for await (const ev of run.stream()) console.log(ev.event, ev.data);
|
|
27
35
|
* ```
|
|
28
36
|
*/
|
|
29
37
|
export { IntrospectionApiClient, } from "./client.js";
|
|
30
|
-
export { BrowserRunner, Runner, } from "./runner.js";
|
|
31
|
-
export { BrowserRuntimesClient, BrowserRuntimeHandle, attachBrowserRuntimes, isUuid, } from "./runtimes.js";
|
|
32
38
|
export { TasksClient, TaskRunsClient, RunHandle, } from "./tasks.js";
|
|
33
39
|
export { ConversationItemsClient, ConversationsClient, FileVersionsClient, FilesClient, SharesClient, } from "@introspection-sdk/http";
|
|
34
|
-
export {
|
|
40
|
+
export { BrowserHttpClient } from "./http.js";
|
|
35
41
|
export { parseSse } from "./sse.js";
|
|
36
42
|
export { Paginator, cursorPaginate, } from "@introspection-sdk/http";
|
|
37
43
|
export { IntrospectionAPIError, AuthenticationError, InsufficientScopeError, NotFoundError, NetworkError, RunnerExpiredError, } from "@introspection-sdk/types";
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACL,sBAAsB,GAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,GAGV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,YAAY,GAEb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,SAAS,EACT,cAAc,GAEf,MAAM,yBAAyB,CAAC;AAiCjC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,kBAAkB,GACnB,MAAM,0BAA0B,CAAC"}
|