@introspection-sdk/introspection-browser 0.5.4 → 0.5.5
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 +45 -33
- package/dist/api/client.d.ts +31 -11
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +80 -20
- package/dist/api/client.js.map +1 -1
- package/dist/api/http.d.ts +23 -0
- package/dist/api/http.d.ts.map +1 -1
- package/dist/api/http.js +38 -0
- package/dist/api/http.js.map +1 -1
- package/dist/api/index.d.ts +11 -11
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +10 -10
- package/dist/api/index.js.map +1 -1
- package/dist/api/runner.d.ts +45 -0
- package/dist/api/runner.d.ts.map +1 -0
- package/dist/api/runner.js +87 -0
- package/dist/api/runner.js.map +1 -0
- package/dist/api/runtimes.d.ts +12 -0
- package/dist/api/runtimes.d.ts.map +1 -0
- package/dist/api/runtimes.js +14 -0
- package/dist/api/runtimes.js.map +1 -0
- package/dist/api/tasks.d.ts +8 -47
- package/dist/api/tasks.d.ts.map +1 -1
- package/dist/api/tasks.js +7 -130
- package/dist/api/tasks.js.map +1 -1
- package/package.json +3 -3
- package/src/api/client.ts +129 -22
- package/src/api/http.ts +56 -0
- package/src/api/index.ts +40 -12
- package/src/api/runner.ts +127 -0
- package/src/api/runtimes.ts +32 -0
- package/src/api/tasks.ts +18 -158
- package/dist/api/conversations.d.ts +0 -84
- package/dist/api/conversations.d.ts.map +0 -1
- package/dist/api/conversations.js +0 -172
- package/dist/api/conversations.js.map +0 -1
- package/dist/api/files.d.ts +0 -61
- package/dist/api/files.d.ts.map +0 -1
- package/dist/api/files.js +0 -141
- package/dist/api/files.js.map +0 -1
- package/dist/api/shares.d.ts +0 -29
- package/dist/api/shares.d.ts.map +0 -1
- package/dist/api/shares.js +0 -52
- package/dist/api/shares.js.map +0 -1
- package/src/api/conversations.ts +0 -214
- package/src/api/files.ts +0 -179
- package/src/api/shares.ts +0 -65
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { RunnerExpiredError, } from "@introspection-sdk/types";
|
|
2
|
+
import { ConversationsClient, FilesClient, SharesClient, TasksClient, } from "@introspection-sdk/http";
|
|
3
|
+
import { BrowserBearerHttpClient } from "./http.js";
|
|
4
|
+
/**
|
|
5
|
+
* Browser-side live handle to a Data Plane runner. Mirrors the Node Runner
|
|
6
|
+
* shape but uses browser-safe fetch transport and CP-minted bearer tokens.
|
|
7
|
+
*/
|
|
8
|
+
export class BrowserRunner {
|
|
9
|
+
owner;
|
|
10
|
+
source;
|
|
11
|
+
spec;
|
|
12
|
+
http;
|
|
13
|
+
closed = false;
|
|
14
|
+
tasks;
|
|
15
|
+
files;
|
|
16
|
+
conversations;
|
|
17
|
+
shares;
|
|
18
|
+
constructor(owner, source, spec) {
|
|
19
|
+
this.owner = owner;
|
|
20
|
+
this.source = source;
|
|
21
|
+
this.spec = spec;
|
|
22
|
+
this.http = this.buildHttp(spec);
|
|
23
|
+
const guarded = this.guardedHttp();
|
|
24
|
+
this.tasks = new TasksClient(guarded);
|
|
25
|
+
this.files = new FilesClient(guarded);
|
|
26
|
+
this.conversations = new ConversationsClient(guarded);
|
|
27
|
+
this.shares = new SharesClient(guarded);
|
|
28
|
+
}
|
|
29
|
+
get dpEndpoint() {
|
|
30
|
+
return this.spec.deployment.endpoint;
|
|
31
|
+
}
|
|
32
|
+
get deployment() {
|
|
33
|
+
return Object.freeze({ ...this.spec.deployment });
|
|
34
|
+
}
|
|
35
|
+
get expires_at() {
|
|
36
|
+
return this.spec.expires_at;
|
|
37
|
+
}
|
|
38
|
+
get session_id() {
|
|
39
|
+
return this.spec.session_id;
|
|
40
|
+
}
|
|
41
|
+
get context() {
|
|
42
|
+
return Object.freeze({ ...this.spec.runtime_context });
|
|
43
|
+
}
|
|
44
|
+
get isClosed() {
|
|
45
|
+
return this.closed;
|
|
46
|
+
}
|
|
47
|
+
async refresh() {
|
|
48
|
+
this.assertOpen();
|
|
49
|
+
const fresh = await this.owner.requestFreshRunnerSpec(this.source);
|
|
50
|
+
this.spec = fresh;
|
|
51
|
+
this.http = this.buildHttp(fresh);
|
|
52
|
+
}
|
|
53
|
+
async close() {
|
|
54
|
+
this.closed = true;
|
|
55
|
+
}
|
|
56
|
+
buildHttp(spec) {
|
|
57
|
+
return new BrowserBearerHttpClient({
|
|
58
|
+
apiUrl: spec.deployment.endpoint,
|
|
59
|
+
token: spec.session_token,
|
|
60
|
+
additionalHeaders: this.owner.additionalHeaders,
|
|
61
|
+
fetch: this.owner.fetch,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
guardedHttp() {
|
|
65
|
+
const proxy = Object.create(this.http);
|
|
66
|
+
proxy.request = async (opts) => {
|
|
67
|
+
this.assertOpen();
|
|
68
|
+
return this.http.request(opts);
|
|
69
|
+
};
|
|
70
|
+
proxy.stream = async (opts) => {
|
|
71
|
+
this.assertOpen();
|
|
72
|
+
return this.http.stream(opts);
|
|
73
|
+
};
|
|
74
|
+
return proxy;
|
|
75
|
+
}
|
|
76
|
+
assertOpen() {
|
|
77
|
+
if (this.closed) {
|
|
78
|
+
throw new RunnerExpiredError({
|
|
79
|
+
message: "Runner has been closed",
|
|
80
|
+
status: 401,
|
|
81
|
+
code: "runner_expired",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export { BrowserRunner as Runner };
|
|
87
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/api/runner.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RuntimeHandle, RuntimesClient, isUuid, type RuntimeHandleFactory, type RuntimeRunRequestBody } from "@introspection-sdk/http";
|
|
2
|
+
import type { BrowserApiHttpClient } from "./http.js";
|
|
3
|
+
import { BrowserRunner, type BrowserRunnerOwner } from "./runner.js";
|
|
4
|
+
export { isUuid };
|
|
5
|
+
export type { RuntimeRunRequestBody as BrowserRuntimeRunRequestBody };
|
|
6
|
+
export declare class BrowserRuntimesClient extends RuntimesClient<BrowserRunner> {
|
|
7
|
+
constructor(http: BrowserApiHttpClient, owner: BrowserRunnerOwner);
|
|
8
|
+
}
|
|
9
|
+
export { RuntimeHandle as BrowserRuntimeHandle };
|
|
10
|
+
export type BrowserRuntimeHandleFactory = RuntimeHandleFactory<BrowserRunner>;
|
|
11
|
+
export declare function attachBrowserRuntimes(http: BrowserApiHttpClient, owner: BrowserRunnerOwner): BrowserRuntimesClient & BrowserRuntimeHandleFactory;
|
|
12
|
+
//# sourceMappingURL=runtimes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimes.d.ts","sourceRoot":"","sources":["../../src/api/runtimes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EAEd,MAAM,EACN,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,qBAAqB,IAAI,4BAA4B,EAAE,CAAC;AAEtE,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,aAAa,CAAC;gBAC1D,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,kBAAkB;CAGlE;AAED,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,CAAC;AAEjD,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;AAE9E,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,oBAAoB,EAC1B,KAAK,EAAE,kBAAkB,GACxB,qBAAqB,GAAG,2BAA2B,CAIrD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RuntimeHandle, RuntimesClient, attachRuntimes, isUuid, } from "@introspection-sdk/http";
|
|
2
|
+
import { BrowserRunner } from "./runner.js";
|
|
3
|
+
export { isUuid };
|
|
4
|
+
export class BrowserRuntimesClient extends RuntimesClient {
|
|
5
|
+
constructor(http, owner) {
|
|
6
|
+
super(http, (source, spec) => new BrowserRunner(owner, source, spec));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { RuntimeHandle as BrowserRuntimeHandle };
|
|
10
|
+
export function attachBrowserRuntimes(http, owner) {
|
|
11
|
+
const api = new BrowserRuntimesClient(http, owner);
|
|
12
|
+
return attachRuntimes(api);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=runtimes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimes.js","sourceRoot":"","sources":["../../src/api/runtimes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,MAAM,GAGP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAA2B,MAAM,aAAa,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,CAAC;AAGlB,MAAM,OAAO,qBAAsB,SAAQ,cAA6B;IACtE,YAAY,IAA0B,EAAE,KAAyB;QAC/D,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IACxE,CAAC;CACF;AAED,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,CAAC;AAIjD,MAAM,UAAU,qBAAqB,CACnC,IAA0B,EAC1B,KAAyB;IAEzB,MAAM,GAAG,GAAG,IAAI,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnD,OAAO,cAAc,CAAC,GAAG,CACI,CAAC;AAChC,CAAC"}
|
package/dist/api/tasks.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { RunIdentityInput
|
|
2
|
-
import {
|
|
3
|
-
import { BrowserHttpClient } from "./http.js";
|
|
1
|
+
import type { RunIdentityInput } from "@introspection-sdk/types";
|
|
2
|
+
import { RunHandle, TaskRunsClient, TasksClient as SharedTasksClient, type ResourceHttpClient } from "@introspection-sdk/http";
|
|
4
3
|
/**
|
|
5
4
|
* Body for creating a task directly against the DP from the browser.
|
|
6
5
|
*
|
|
@@ -39,51 +38,13 @@ export interface StartTaskParams extends CreateTaskParams {
|
|
|
39
38
|
/** Required for the `start()` sugar that returns a run handle. */
|
|
40
39
|
prompt: string;
|
|
41
40
|
}
|
|
42
|
-
/** Live handle on a task's run: stream its events, collect text, cancel. */
|
|
43
|
-
export declare class RunHandle {
|
|
44
|
-
readonly task: Task | null;
|
|
45
|
-
readonly run: TaskRun;
|
|
46
|
-
private readonly runs;
|
|
47
|
-
constructor(task: Task | null, run: TaskRun, runs: TaskRunsClient);
|
|
48
|
-
stream(): AsyncIterable<SseEvent>;
|
|
49
|
-
cancel(): Promise<TaskCancelResponse>;
|
|
50
|
-
/** Convenience: concatenate `data` from `text`/`message` SSE frames. */
|
|
51
|
-
text(): Promise<string>;
|
|
52
|
-
}
|
|
53
|
-
export declare class TaskRunsClient {
|
|
54
|
-
private readonly http;
|
|
55
|
-
constructor(http: BrowserHttpClient);
|
|
56
|
-
create(taskId: string, body: TaskRunCreateParams): Promise<RunHandle>;
|
|
57
|
-
get(taskId: string, runId: string): Promise<TaskRun>;
|
|
58
|
-
cancel(taskId: string, runId: string): Promise<TaskCancelResponse>;
|
|
59
|
-
stream(taskId: string, runId: string): AsyncIterable<SseEvent>;
|
|
60
|
-
}
|
|
61
41
|
/**
|
|
62
|
-
* Cookie-authenticated `/v1/tasks` client.
|
|
63
|
-
*
|
|
64
|
-
*
|
|
42
|
+
* Cookie-authenticated `/v1/tasks` client. The implementation is shared with
|
|
43
|
+
* Node's runner-bound task client; this browser subclass only adds the
|
|
44
|
+
* `identity -> metadata.identity` body mapping used by cookie-session calls.
|
|
65
45
|
*/
|
|
66
|
-
export declare class TasksClient {
|
|
67
|
-
|
|
68
|
-
readonly runs: TaskRunsClient;
|
|
69
|
-
constructor(http: BrowserHttpClient);
|
|
70
|
-
/**
|
|
71
|
-
* Tasks matching `params`. `await` it for the first page (preserving
|
|
72
|
-
* the wire envelope's counts + `next` cursor), or `for await` it to
|
|
73
|
-
* stream every task across pages (fetched lazily — `limit` sets the
|
|
74
|
-
* page size, `next` the starting cursor; stop early to stop fetching).
|
|
75
|
-
*
|
|
76
|
-
* Mirrors the Node SDK's `TasksApi.list`, which is the source of truth
|
|
77
|
-
* for the `/v1/tasks` shape.
|
|
78
|
-
*/
|
|
79
|
-
list(params?: TaskListParams): Paginator<Task>;
|
|
80
|
-
create(body: CreateTaskParams): Promise<TaskCreateResponse>;
|
|
81
|
-
get(taskId: string): Promise<Task>;
|
|
82
|
-
update(taskId: string, body: TaskUpdateParams): Promise<Task>;
|
|
83
|
-
delete(taskId: string): Promise<void>;
|
|
84
|
-
archive(taskId: string): Promise<void>;
|
|
85
|
-
unarchive(taskId: string): Promise<void>;
|
|
86
|
-
/** Sugar: create a task + return a handle on its initial run. */
|
|
87
|
-
start(params: StartTaskParams): Promise<RunHandle>;
|
|
46
|
+
export declare class TasksClient extends SharedTasksClient<CreateTaskParams, StartTaskParams> {
|
|
47
|
+
constructor(http: ResourceHttpClient);
|
|
88
48
|
}
|
|
49
|
+
export { RunHandle, TaskRunsClient };
|
|
89
50
|
//# sourceMappingURL=tasks.d.ts.map
|
package/dist/api/tasks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/api/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/api/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,IAAI,iBAAiB,EAChC,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,iBAAiB,CAChD,gBAAgB,EAChB,eAAe,CAChB;gBACa,IAAI,EAAE,kBAAkB;CAGrC;AAED,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/api/tasks.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { parseSse } from "./sse.js";
|
|
1
|
+
import { RunHandle, TaskRunsClient, TasksClient as SharedTasksClient, } from "@introspection-sdk/http";
|
|
3
2
|
function toTaskBody(params) {
|
|
4
3
|
const { identity, metadata, ...rest } = params;
|
|
5
4
|
const body = { ...rest };
|
|
@@ -10,137 +9,15 @@ function toTaskBody(params) {
|
|
|
10
9
|
body.metadata = mergedMetadata;
|
|
11
10
|
return body;
|
|
12
11
|
}
|
|
13
|
-
/** Live handle on a task's run: stream its events, collect text, cancel. */
|
|
14
|
-
export class RunHandle {
|
|
15
|
-
task;
|
|
16
|
-
run;
|
|
17
|
-
runs;
|
|
18
|
-
constructor(task, run, runs) {
|
|
19
|
-
this.task = task;
|
|
20
|
-
this.run = run;
|
|
21
|
-
this.runs = runs;
|
|
22
|
-
}
|
|
23
|
-
stream() {
|
|
24
|
-
return this.runs.stream(this.run.task_id, this.run.id);
|
|
25
|
-
}
|
|
26
|
-
cancel() {
|
|
27
|
-
return this.runs.cancel(this.run.task_id, this.run.id);
|
|
28
|
-
}
|
|
29
|
-
/** Convenience: concatenate `data` from `text`/`message` SSE frames. */
|
|
30
|
-
async text() {
|
|
31
|
-
let out = "";
|
|
32
|
-
for await (const ev of this.stream()) {
|
|
33
|
-
if (ev.event === "text" || ev.event === "message")
|
|
34
|
-
out += ev.data;
|
|
35
|
-
}
|
|
36
|
-
return out;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export class TaskRunsClient {
|
|
40
|
-
http;
|
|
41
|
-
constructor(http) {
|
|
42
|
-
this.http = http;
|
|
43
|
-
}
|
|
44
|
-
async create(taskId, body) {
|
|
45
|
-
const res = await this.http.request({
|
|
46
|
-
method: "POST",
|
|
47
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}/runs`,
|
|
48
|
-
body,
|
|
49
|
-
});
|
|
50
|
-
return new RunHandle(null, res.run, this);
|
|
51
|
-
}
|
|
52
|
-
get(taskId, runId) {
|
|
53
|
-
return this.http.request({
|
|
54
|
-
method: "GET",
|
|
55
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}/runs/${encodeURIComponent(runId)}`,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
cancel(taskId, runId) {
|
|
59
|
-
return this.http.request({
|
|
60
|
-
method: "POST",
|
|
61
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}/runs/${encodeURIComponent(runId)}/cancel`,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
async *stream(taskId, runId) {
|
|
65
|
-
const res = await this.http.stream({
|
|
66
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}/runs/${encodeURIComponent(runId)}/stream`,
|
|
67
|
-
});
|
|
68
|
-
yield* parseSse(res);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
12
|
/**
|
|
72
|
-
* Cookie-authenticated `/v1/tasks` client.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
13
|
+
* Cookie-authenticated `/v1/tasks` client. The implementation is shared with
|
|
14
|
+
* Node's runner-bound task client; this browser subclass only adds the
|
|
15
|
+
* `identity -> metadata.identity` body mapping used by cookie-session calls.
|
|
75
16
|
*/
|
|
76
|
-
export class TasksClient {
|
|
77
|
-
http;
|
|
78
|
-
runs;
|
|
17
|
+
export class TasksClient extends SharedTasksClient {
|
|
79
18
|
constructor(http) {
|
|
80
|
-
|
|
81
|
-
this.runs = new TaskRunsClient(http);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Tasks matching `params`. `await` it for the first page (preserving
|
|
85
|
-
* the wire envelope's counts + `next` cursor), or `for await` it to
|
|
86
|
-
* stream every task across pages (fetched lazily — `limit` sets the
|
|
87
|
-
* page size, `next` the starting cursor; stop early to stop fetching).
|
|
88
|
-
*
|
|
89
|
-
* Mirrors the Node SDK's `TasksApi.list`, which is the source of truth
|
|
90
|
-
* for the `/v1/tasks` shape.
|
|
91
|
-
*/
|
|
92
|
-
list(params) {
|
|
93
|
-
return cursorPaginate((next) => this.http.request({
|
|
94
|
-
method: "GET",
|
|
95
|
-
path: "/v1/tasks",
|
|
96
|
-
query: { ...params, next },
|
|
97
|
-
}), params?.next);
|
|
98
|
-
}
|
|
99
|
-
create(body) {
|
|
100
|
-
return this.http.request({
|
|
101
|
-
method: "POST",
|
|
102
|
-
path: "/v1/tasks",
|
|
103
|
-
body: toTaskBody(body),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
get(taskId) {
|
|
107
|
-
return this.http.request({
|
|
108
|
-
method: "GET",
|
|
109
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}`,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
update(taskId, body) {
|
|
113
|
-
return this.http.request({
|
|
114
|
-
method: "PATCH",
|
|
115
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}`,
|
|
116
|
-
body,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
delete(taskId) {
|
|
120
|
-
return this.http.request({
|
|
121
|
-
method: "DELETE",
|
|
122
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}`,
|
|
123
|
-
expect: "empty",
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
archive(taskId) {
|
|
127
|
-
return this.http.request({
|
|
128
|
-
method: "POST",
|
|
129
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}/archive`,
|
|
130
|
-
expect: "empty",
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
unarchive(taskId) {
|
|
134
|
-
return this.http.request({
|
|
135
|
-
method: "POST",
|
|
136
|
-
path: `/v1/tasks/${encodeURIComponent(taskId)}/unarchive`,
|
|
137
|
-
expect: "empty",
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/** Sugar: create a task + return a handle on its initial run. */
|
|
141
|
-
async start(params) {
|
|
142
|
-
const res = await this.create(params);
|
|
143
|
-
return new RunHandle(res.task, res.run, this.runs);
|
|
19
|
+
super(http, toTaskBody);
|
|
144
20
|
}
|
|
145
21
|
}
|
|
22
|
+
export { RunHandle, TaskRunsClient };
|
|
146
23
|
//# sourceMappingURL=tasks.js.map
|
package/dist/api/tasks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/api/tasks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/api/tasks.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,IAAI,iBAAiB,GAEjC,MAAM,yBAAyB,CAAC;AA0CjC,SAAS,UAAU,CAAC,MAAwB;IAC1C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,IAAI,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;IAClD,MAAM,cAAc,GAAG,QAAQ;QAC7B,CAAC,CAAC,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE;QACnC,CAAC,CAAC,QAAQ,CAAC;IACb,IAAI,cAAc,KAAK,SAAS;QAAE,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;IACjE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAGhC;IACC,YAAY,IAAwB;QAClC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@introspection-sdk/introspection-browser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Introspection observability SDK for the browser",
|
|
6
6
|
"engines": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@opentelemetry/api-logs": "^0.219.0",
|
|
32
32
|
"@opentelemetry/sdk-logs": "^0.219.0",
|
|
33
33
|
"@opentelemetry/exporter-logs-otlp-http": "^0.219.0",
|
|
34
|
-
"@introspection-sdk/
|
|
35
|
-
"@introspection-sdk/
|
|
34
|
+
"@introspection-sdk/types": "0.5.5",
|
|
35
|
+
"@introspection-sdk/http": "0.5.5"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"lint": "eslint . --max-warnings 0",
|
package/src/api/client.ts
CHANGED
|
@@ -19,15 +19,47 @@
|
|
|
19
19
|
* before retrying.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
BrowserBearerHttpClient,
|
|
24
|
+
BrowserHttpClient,
|
|
25
|
+
stripTrailingSlash,
|
|
26
|
+
toApiError,
|
|
27
|
+
} from "./http.js";
|
|
28
|
+
import {
|
|
29
|
+
ConversationsClient,
|
|
30
|
+
FilesClient,
|
|
31
|
+
SharesClient,
|
|
32
|
+
} from "@introspection-sdk/http";
|
|
23
33
|
import { TasksClient } from "./tasks.js";
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
import {
|
|
35
|
+
attachBrowserRuntimes,
|
|
36
|
+
type BrowserRuntimeHandleFactory,
|
|
37
|
+
type BrowserRuntimesClient,
|
|
38
|
+
} from "./runtimes.js";
|
|
39
|
+
import type { BrowserRunnerSource } from "./runner.js";
|
|
40
|
+
import type { RunnerSpec } from "@introspection-sdk/types";
|
|
41
|
+
|
|
42
|
+
type CookieClients = {
|
|
43
|
+
tasks: TasksClient;
|
|
44
|
+
files: FilesClient;
|
|
45
|
+
conversations: ConversationsClient;
|
|
46
|
+
shares: SharesClient;
|
|
47
|
+
};
|
|
27
48
|
|
|
28
49
|
export interface IntrospectionApiClientOptions {
|
|
29
|
-
/**
|
|
30
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Control Plane REST base URL. Used by `client.runtimes(name).run()` to
|
|
52
|
+
* resolve runtimes and mint runner specs. Defaults to
|
|
53
|
+
* `https://api.introspection.dev`.
|
|
54
|
+
*/
|
|
55
|
+
cpUrl?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Data Plane REST base URL for the cookie-session APIs (`connect()` and
|
|
58
|
+
* top-level `client.tasks` / `client.files` / `client.conversations` /
|
|
59
|
+
* `client.shares`). Runner APIs use the DP endpoint returned by CP and do
|
|
60
|
+
* not require this option.
|
|
61
|
+
*/
|
|
62
|
+
dpUrl?: string;
|
|
31
63
|
/**
|
|
32
64
|
* Returns a fresh Introspection access token from the app's broker
|
|
33
65
|
* (its own backend). Called on `connect()` and again whenever the DP
|
|
@@ -43,16 +75,15 @@ export interface IntrospectionApiClientOptions {
|
|
|
43
75
|
}
|
|
44
76
|
|
|
45
77
|
export class IntrospectionApiClient {
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
readonly conversations: ConversationsClient;
|
|
52
|
-
/** `/v1/shares` read-sharing grants bound to the session cookie. */
|
|
53
|
-
readonly shares: SharesClient;
|
|
78
|
+
/**
|
|
79
|
+
* CRUD on CP `/v1/runtimes` and the `(idOrName) => RuntimeHandle` factory.
|
|
80
|
+
* Call as `client.runtimes("customer-agent").run()`.
|
|
81
|
+
*/
|
|
82
|
+
readonly runtimes: BrowserRuntimesClient & BrowserRuntimeHandleFactory;
|
|
54
83
|
|
|
55
84
|
private readonly fetchImpl: typeof fetch;
|
|
85
|
+
private readonly cpHttp: BrowserBearerHttpClient;
|
|
86
|
+
private readonly cookieClients: CookieClients | null;
|
|
56
87
|
|
|
57
88
|
constructor(private readonly opts: IntrospectionApiClientOptions) {
|
|
58
89
|
this.fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
@@ -61,16 +92,53 @@ export class IntrospectionApiClient {
|
|
|
61
92
|
"global fetch is unavailable; pass `fetch` or run in a modern browser",
|
|
62
93
|
);
|
|
63
94
|
}
|
|
64
|
-
|
|
65
|
-
apiUrl: opts.
|
|
95
|
+
this.cpHttp = new BrowserBearerHttpClient({
|
|
96
|
+
apiUrl: opts.cpUrl ?? "https://api.introspection.dev",
|
|
97
|
+
token: opts.getToken,
|
|
66
98
|
additionalHeaders: opts.additionalHeaders,
|
|
67
99
|
fetch: opts.fetch,
|
|
68
|
-
onUnauthorized: () => this.reexchange(),
|
|
69
100
|
});
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
101
|
+
this.runtimes = attachBrowserRuntimes(this.cpHttp, {
|
|
102
|
+
additionalHeaders: opts.additionalHeaders,
|
|
103
|
+
fetch: opts.fetch,
|
|
104
|
+
requestFreshRunnerSpec: (source) => this.requestFreshRunnerSpec(source),
|
|
105
|
+
});
|
|
106
|
+
if (opts.dpUrl) {
|
|
107
|
+
const http = new BrowserHttpClient({
|
|
108
|
+
apiUrl: opts.dpUrl,
|
|
109
|
+
additionalHeaders: opts.additionalHeaders,
|
|
110
|
+
fetch: opts.fetch,
|
|
111
|
+
onUnauthorized: () => this.reexchange(),
|
|
112
|
+
});
|
|
113
|
+
this.cookieClients = {
|
|
114
|
+
tasks: new TasksClient(http),
|
|
115
|
+
files: new FilesClient(http),
|
|
116
|
+
conversations: new ConversationsClient(http),
|
|
117
|
+
shares: new SharesClient(http),
|
|
118
|
+
};
|
|
119
|
+
} else {
|
|
120
|
+
this.cookieClients = null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** `/v1/tasks` operations bound to the DP session cookie. */
|
|
125
|
+
get tasks(): TasksClient {
|
|
126
|
+
return this.requireCookieClient("tasks");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** `/v1/files` operations bound to the DP session cookie. */
|
|
130
|
+
get files(): FilesClient {
|
|
131
|
+
return this.requireCookieClient("files");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Read-only `/v1/conversations` projection bound to the session cookie. */
|
|
135
|
+
get conversations(): ConversationsClient {
|
|
136
|
+
return this.requireCookieClient("conversations");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** `/v1/shares` read-sharing grants bound to the session cookie. */
|
|
140
|
+
get shares(): SharesClient {
|
|
141
|
+
return this.requireCookieClient("shares");
|
|
74
142
|
}
|
|
75
143
|
|
|
76
144
|
/**
|
|
@@ -78,13 +146,15 @@ export class IntrospectionApiClient {
|
|
|
78
146
|
* `intro_dp_session` cookie. Call once before issuing task requests.
|
|
79
147
|
*/
|
|
80
148
|
async connect(): Promise<void> {
|
|
149
|
+
this.requireDpUrl();
|
|
81
150
|
await this.exchange();
|
|
82
151
|
}
|
|
83
152
|
|
|
84
153
|
private async exchange(): Promise<void> {
|
|
154
|
+
const dpUrl = this.requireDpUrl();
|
|
85
155
|
const token = await this.opts.getToken();
|
|
86
156
|
const res = await this.fetchImpl(
|
|
87
|
-
`${stripTrailingSlash(
|
|
157
|
+
`${stripTrailingSlash(dpUrl)}/v1/oauth/exchange`,
|
|
88
158
|
{
|
|
89
159
|
method: "POST",
|
|
90
160
|
headers: {
|
|
@@ -107,4 +177,41 @@ export class IntrospectionApiClient {
|
|
|
107
177
|
return false;
|
|
108
178
|
}
|
|
109
179
|
}
|
|
180
|
+
|
|
181
|
+
private requireCookieClient<K extends keyof CookieClients>(
|
|
182
|
+
key: K,
|
|
183
|
+
): CookieClients[K] {
|
|
184
|
+
if (!this.cookieClients) {
|
|
185
|
+
throw new Error(
|
|
186
|
+
`IntrospectionApiClient.${key} requires dpUrl; use client.runtimes(...).run() for runner-bound APIs or pass dpUrl for cookie-session APIs`,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return this.cookieClients[key];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private requireDpUrl(): string {
|
|
193
|
+
if (!this.opts.dpUrl) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
"IntrospectionApiClient.connect() requires dpUrl; use client.runtimes(...).run() for runner-bound APIs or pass dpUrl for cookie-session APIs",
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
return this.opts.dpUrl;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private async requestFreshRunnerSpec(
|
|
202
|
+
source: BrowserRunnerSource,
|
|
203
|
+
): Promise<RunnerSpec> {
|
|
204
|
+
if (source.kind === "runtime") {
|
|
205
|
+
return this.cpHttp.request<RunnerSpec>({
|
|
206
|
+
method: "POST",
|
|
207
|
+
path: `/v1/runtimes/${encodeURIComponent(source.id)}/run`,
|
|
208
|
+
body: source.options ?? {},
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return this.cpHttp.request<RunnerSpec>({
|
|
212
|
+
method: "POST",
|
|
213
|
+
path: `/v1/experiments/${encodeURIComponent(source.id)}/run`,
|
|
214
|
+
body: source.options ?? {},
|
|
215
|
+
});
|
|
216
|
+
}
|
|
110
217
|
}
|
package/src/api/http.ts
CHANGED
|
@@ -35,6 +35,8 @@ export interface BrowserHttpConfig {
|
|
|
35
35
|
onUnauthorized?: () => Promise<boolean>;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export type BrowserApiHttpClient = Pick<BaseHttpClient, "request" | "stream">;
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
* Cookie-authenticated HTTP wrapper bound to one DP endpoint. Has no
|
|
40
42
|
* opinion about which resource it serves — the caller picks the path.
|
|
@@ -53,3 +55,57 @@ export class BrowserHttpClient extends BaseHttpClient {
|
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
}
|
|
58
|
+
|
|
59
|
+
export interface BrowserBearerHttpConfig {
|
|
60
|
+
/** REST base URL every request is prefixed with. */
|
|
61
|
+
apiUrl: string;
|
|
62
|
+
/** Bearer token, or a provider returning the latest token before each request. */
|
|
63
|
+
token: string | (() => string | Promise<string>);
|
|
64
|
+
/** Extra headers merged into every request. */
|
|
65
|
+
additionalHeaders?: Record<string, string>;
|
|
66
|
+
/** Custom `fetch` (for tests or non-standard runtimes). */
|
|
67
|
+
fetch?: typeof fetch;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Bearer-authenticated browser HTTP wrapper. Used for CP runtime calls with
|
|
72
|
+
* brokered access tokens and for DP runner calls with CP-minted runner tokens.
|
|
73
|
+
*/
|
|
74
|
+
export class BrowserBearerHttpClient extends BaseHttpClient {
|
|
75
|
+
private readonly tokenBox: { value: string };
|
|
76
|
+
private readonly getToken?: () => string | Promise<string>;
|
|
77
|
+
|
|
78
|
+
constructor(cfg: BrowserBearerHttpConfig) {
|
|
79
|
+
const tokenBox = { value: typeof cfg.token === "string" ? cfg.token : "" };
|
|
80
|
+
super({
|
|
81
|
+
apiUrl: cfg.apiUrl,
|
|
82
|
+
additionalHeaders: cfg.additionalHeaders,
|
|
83
|
+
fetch: cfg.fetch,
|
|
84
|
+
transport: {
|
|
85
|
+
authHeaders: (): Record<string, string> => {
|
|
86
|
+
if (!tokenBox.value) return {};
|
|
87
|
+
return { Authorization: `Bearer ${tokenBox.value}` };
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
this.tokenBox = tokenBox;
|
|
92
|
+
this.getToken = typeof cfg.token === "function" ? cfg.token : undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private async refreshToken(): Promise<void> {
|
|
96
|
+
if (!this.getToken) return;
|
|
97
|
+
this.tokenBox.value = await this.getToken();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async request<T>(opts: Parameters<BaseHttpClient["request"]>[0]): Promise<T> {
|
|
101
|
+
await this.refreshToken();
|
|
102
|
+
return super.request<T>(opts);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async stream(
|
|
106
|
+
opts: Parameters<BaseHttpClient["stream"]>[0],
|
|
107
|
+
): Promise<Response> {
|
|
108
|
+
await this.refreshToken();
|
|
109
|
+
return super.stream(opts);
|
|
110
|
+
}
|
|
111
|
+
}
|