@introspection-sdk/introspection-browser 0.5.3 → 0.5.4
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/dist/api/client.d.ts +6 -3
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +5 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/files.d.ts +5 -5
- package/dist/api/files.d.ts.map +1 -1
- package/dist/api/files.js +8 -12
- package/dist/api/files.js.map +1 -1
- package/dist/api/index.d.ts +4 -3
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +3 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/shares.d.ts +29 -0
- package/dist/api/shares.d.ts.map +1 -0
- package/dist/api/shares.js +52 -0
- package/dist/api/shares.js.map +1 -0
- package/dist/api/tasks.d.ts +8 -2
- package/dist/api/tasks.d.ts.map +1 -1
- package/dist/api/tasks.js.map +1 -1
- package/package.json +3 -3
- package/src/api/client.ts +8 -4
- package/src/api/files.ts +8 -25
- package/src/api/index.ts +7 -4
- package/src/api/shares.ts +65 -0
- package/src/api/tasks.ts +7 -2
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.4 build /home/runner/work/introspection-js-sdk/introspection-js-sdk/packages/introspection-browser
|
|
3
3
|
> tsc
|
|
4
4
|
|
package/dist/api/client.d.ts
CHANGED
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
import { TasksClient } from "./tasks.js";
|
|
22
22
|
import { FilesClient } from "./files.js";
|
|
23
23
|
import { ConversationsClient } from "./conversations.js";
|
|
24
|
+
import { SharesClient } from "./shares.js";
|
|
24
25
|
export interface IntrospectionApiClientOptions {
|
|
25
26
|
/** Data Plane REST base URL (e.g. `https://dp.us.introspection.dev`). */
|
|
26
27
|
dpUrl: string;
|
|
27
|
-
/** Project the session is scoped to. */
|
|
28
|
-
projectId: string;
|
|
29
28
|
/**
|
|
30
29
|
* Returns a fresh Introspection access token from the app's broker
|
|
31
30
|
* (its own backend). Called on `connect()` and again whenever the DP
|
|
32
|
-
* session cookie needs re-minting after a 401.
|
|
31
|
+
* session cookie needs re-minting after a 401. The session's project is
|
|
32
|
+
* derived from this token's claims server-side — there is no separate
|
|
33
|
+
* project option.
|
|
33
34
|
*/
|
|
34
35
|
getToken: () => string | Promise<string>;
|
|
35
36
|
/** Custom `fetch` (for tests or non-standard runtimes). */
|
|
@@ -45,6 +46,8 @@ export declare class IntrospectionApiClient {
|
|
|
45
46
|
readonly files: FilesClient;
|
|
46
47
|
/** Read-only `/v1/conversations` projection bound to the session cookie. */
|
|
47
48
|
readonly conversations: ConversationsClient;
|
|
49
|
+
/** `/v1/shares` read-sharing grants bound to the session cookie. */
|
|
50
|
+
readonly shares: SharesClient;
|
|
48
51
|
private readonly fetchImpl;
|
|
49
52
|
constructor(opts: IntrospectionApiClientOptions);
|
|
50
53
|
/**
|
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;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,6BAA6B;IAC5C,yEAAyE;IACzE,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;IAYrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAXjC,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAC5C,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAEZ,IAAI,EAAE,6BAA6B;IAmBhE;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAIhB,QAAQ;IAiBtB,0EAA0E;YAC5D,UAAU;CAQzB"}
|
package/dist/api/client.js
CHANGED
|
@@ -22,6 +22,7 @@ import { BrowserHttpClient, stripTrailingSlash, toApiError } from "./http.js";
|
|
|
22
22
|
import { TasksClient } from "./tasks.js";
|
|
23
23
|
import { FilesClient } from "./files.js";
|
|
24
24
|
import { ConversationsClient } from "./conversations.js";
|
|
25
|
+
import { SharesClient } from "./shares.js";
|
|
25
26
|
export class IntrospectionApiClient {
|
|
26
27
|
opts;
|
|
27
28
|
/** `/v1/tasks` operations bound to the DP session cookie. */
|
|
@@ -30,6 +31,8 @@ export class IntrospectionApiClient {
|
|
|
30
31
|
files;
|
|
31
32
|
/** Read-only `/v1/conversations` projection bound to the session cookie. */
|
|
32
33
|
conversations;
|
|
34
|
+
/** `/v1/shares` read-sharing grants bound to the session cookie. */
|
|
35
|
+
shares;
|
|
33
36
|
fetchImpl;
|
|
34
37
|
constructor(opts) {
|
|
35
38
|
this.opts = opts;
|
|
@@ -46,6 +49,7 @@ export class IntrospectionApiClient {
|
|
|
46
49
|
this.tasks = new TasksClient(http);
|
|
47
50
|
this.files = new FilesClient(http);
|
|
48
51
|
this.conversations = new ConversationsClient(http);
|
|
52
|
+
this.shares = new SharesClient(http);
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* Mint a token via `getToken` and redeem it at the DP for the
|
|
@@ -62,7 +66,7 @@ export class IntrospectionApiClient {
|
|
|
62
66
|
"Content-Type": "application/json",
|
|
63
67
|
...(this.opts.additionalHeaders ?? {}),
|
|
64
68
|
},
|
|
65
|
-
body: JSON.stringify({ token
|
|
69
|
+
body: JSON.stringify({ token }),
|
|
66
70
|
credentials: "include",
|
|
67
71
|
});
|
|
68
72
|
if (!res.ok)
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAA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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/files.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* bearer token — so a single-page app reads and writes files with the
|
|
7
7
|
* same identity session it uses for tasks and conversations. The DP
|
|
8
8
|
* derives the owning `identity_key` from the session JWT; per-identity
|
|
9
|
-
* file
|
|
9
|
+
* file ownership and access are enforced server-side.
|
|
10
10
|
*/
|
|
11
|
-
import type { File as FileResource,
|
|
11
|
+
import type { File as FileResource, FileCreateTextParams, FileListParams, FileType, FileUpdateParams, ListParams } from "@introspection-sdk/types";
|
|
12
12
|
import { Paginator } from "@introspection-sdk/http";
|
|
13
13
|
import { BrowserHttpClient } from "./http.js";
|
|
14
14
|
export type FileUploadBody = {
|
|
@@ -32,7 +32,7 @@ export declare class FileVersionsClient {
|
|
|
32
32
|
*/
|
|
33
33
|
list(fileId: string, params?: ListParams): Paginator<FileResource>;
|
|
34
34
|
get(fileId: string, versionId: string): Promise<FileResource>;
|
|
35
|
-
create(fileId: string, body: FileUploadBody
|
|
35
|
+
create(fileId: string, body: FileUploadBody): Promise<FileResource>;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Cookie-authenticated `/v1/files` client. Mirrors the Node SDK's
|
|
@@ -50,8 +50,8 @@ export declare class FilesClient {
|
|
|
50
50
|
* stop fetching).
|
|
51
51
|
*/
|
|
52
52
|
list(params?: FileListParams): Paginator<FileResource>;
|
|
53
|
-
upload(body: FileUploadBody
|
|
54
|
-
createText(body: FileCreateTextParams
|
|
53
|
+
upload(body: FileUploadBody): Promise<FileResource>;
|
|
54
|
+
createText(body: FileCreateTextParams): Promise<FileResource>;
|
|
55
55
|
get(fileId: string): Promise<FileResource>;
|
|
56
56
|
update(fileId: string, body: FileUpdateParams): Promise<FileResource>;
|
|
57
57
|
delete(fileId: string): Promise<void>;
|
package/dist/api/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/api/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,IAAI,IAAI,YAAY,EACpB,
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/api/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,IAAI,IAAI,YAAY,EACpB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,IAAI,CAAC;I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AQrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQ7C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;CAOpE"}
|
package/dist/api/files.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* bearer token — so a single-page app reads and writes files with the
|
|
7
7
|
* same identity session it uses for tasks and conversations. The DP
|
|
8
8
|
* derives the owning `identity_key` from the session JWT; per-identity
|
|
9
|
-
* file
|
|
9
|
+
* file ownership and access are enforced server-side.
|
|
10
10
|
*/
|
|
11
11
|
import { cursorPaginate } from "@introspection-sdk/http";
|
|
12
12
|
/** Versions of a file (`/v1/files/{id}/versions`). */
|
|
@@ -33,8 +33,8 @@ export class FileVersionsClient {
|
|
|
33
33
|
path: `/v1/files/${encodeURIComponent(fileId)}/versions/${encodeURIComponent(versionId)}`,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
create(fileId, body
|
|
37
|
-
const form = toFormData(body
|
|
36
|
+
create(fileId, body) {
|
|
37
|
+
const form = toFormData(body);
|
|
38
38
|
return this.http.request({
|
|
39
39
|
method: "POST",
|
|
40
40
|
path: `/v1/files/${encodeURIComponent(fileId)}/versions`,
|
|
@@ -67,21 +67,19 @@ export class FilesClient {
|
|
|
67
67
|
query: { ...params, next },
|
|
68
68
|
}), params?.next);
|
|
69
69
|
}
|
|
70
|
-
upload(body
|
|
71
|
-
const form = toFormData(body
|
|
70
|
+
upload(body) {
|
|
71
|
+
const form = toFormData(body);
|
|
72
72
|
return this.http.request({
|
|
73
73
|
method: "POST",
|
|
74
74
|
path: "/v1/files",
|
|
75
75
|
body: form,
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
createText(body
|
|
78
|
+
createText(body) {
|
|
79
79
|
return this.http.request({
|
|
80
80
|
method: "POST",
|
|
81
81
|
path: "/v1/files",
|
|
82
|
-
body
|
|
83
|
-
? { ...body, visibility: options.visibility }
|
|
84
|
-
: body,
|
|
82
|
+
body,
|
|
85
83
|
});
|
|
86
84
|
}
|
|
87
85
|
get(fileId) {
|
|
@@ -119,7 +117,7 @@ export class FilesClient {
|
|
|
119
117
|
});
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
|
-
function toFormData(body
|
|
120
|
+
function toFormData(body) {
|
|
123
121
|
const fd = new FormData();
|
|
124
122
|
if ("file" in body && body.file instanceof Blob) {
|
|
125
123
|
fd.append("file", body.file, body.name);
|
|
@@ -138,8 +136,6 @@ function toFormData(body, options) {
|
|
|
138
136
|
fd.append("name", body.name);
|
|
139
137
|
if (body.file_type)
|
|
140
138
|
fd.append("file_type", body.file_type);
|
|
141
|
-
if (options?.visibility)
|
|
142
|
-
fd.append("visibility", options.visibility);
|
|
143
139
|
return fd;
|
|
144
140
|
}
|
|
145
141
|
//# sourceMappingURL=files.js.map
|
package/dist/api/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/api/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/api/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,OAAO,EAAa,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAYpE,sDAAsD;AACtD,MAAM,OAAO,kBAAkB;IACA;IAA7B,YAA6B,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAExD;;;;OAIG;IACH,IAAI,CAAC,MAAc,EAAE,MAAmB;QACtC,OAAO,cAAc,CACnB,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0B;YACzC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa,kBAAkB,CAAC,MAAM,CAAC,WAAW;YACxD,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,IAAI,EAA6B;SAC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,CAAC,IAAoB;IACtC,MAAM,EAAE,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC1B,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,YAAY,IAAI,EAAE,CAAC;QAChD,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,gEAAgE;QAChE,gEAAgE;QAChE,wCAAwC;QACxC,MAAM,EAAE,GAAI,IAA6B,CAAC,IAAI,CAAC;QAC/C,MAAM,EAAE,GACL,IAAiC,CAAC,WAAW;YAC9C,0BAA0B,CAAC;QAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CACxB,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CACf,CAAC;QACjB,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,IAAI,CAAC,IAAI;QAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,IAAI,CAAC,SAAS;QAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* const client = new IntrospectionApiClient({
|
|
14
14
|
* dpUrl: "https://dp.us.introspection.dev",
|
|
15
|
-
*
|
|
16
|
-
* //
|
|
15
|
+
* // your backend mints the Introspection access token (the session's
|
|
16
|
+
* // project is derived from its claims — no projectId option needed)
|
|
17
17
|
* getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
18
18
|
* });
|
|
19
19
|
*
|
|
@@ -30,9 +30,10 @@ export { IntrospectionApiClient, type IntrospectionApiClientOptions, } from "./c
|
|
|
30
30
|
export { TasksClient, TaskRunsClient, RunHandle, type CreateTaskParams, type StartTaskParams, } from "./tasks.js";
|
|
31
31
|
export { FilesClient, FileVersionsClient, type FileUploadBody, } from "./files.js";
|
|
32
32
|
export { ConversationsClient, ConversationItemsClient, } from "./conversations.js";
|
|
33
|
+
export { SharesClient } from "./shares.js";
|
|
33
34
|
export { BrowserHttpClient, type BrowserHttpConfig } from "./http.js";
|
|
34
35
|
export { parseSse } from "./sse.js";
|
|
35
36
|
export { Paginator, cursorPaginate, type PageSource, } from "@introspection-sdk/http";
|
|
36
|
-
export type { Task, TaskRun, TaskStatus,
|
|
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, } from "@introspection-sdk/types";
|
|
37
38
|
export { IntrospectionAPIError, AuthenticationError, InsufficientScopeError, NotFoundError, NetworkError, } from "@introspection-sdk/types";
|
|
38
39
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;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,WAAW,EACX,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;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,WAAW,EACX,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,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,GACb,MAAM,0BAA0B,CAAC"}
|
package/dist/api/index.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* const client = new IntrospectionApiClient({
|
|
14
14
|
* dpUrl: "https://dp.us.introspection.dev",
|
|
15
|
-
*
|
|
16
|
-
* //
|
|
15
|
+
* // your backend mints the Introspection access token (the session's
|
|
16
|
+
* // project is derived from its claims — no projectId option needed)
|
|
17
17
|
* getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
18
18
|
* });
|
|
19
19
|
*
|
|
@@ -30,6 +30,7 @@ export { IntrospectionApiClient, } from "./client.js";
|
|
|
30
30
|
export { TasksClient, TaskRunsClient, RunHandle, } from "./tasks.js";
|
|
31
31
|
export { FilesClient, FileVersionsClient, } from "./files.js";
|
|
32
32
|
export { ConversationsClient, ConversationItemsClient, } from "./conversations.js";
|
|
33
|
+
export { SharesClient } from "./shares.js";
|
|
33
34
|
export { BrowserHttpClient } from "./http.js";
|
|
34
35
|
export { parseSse } from "./sse.js";
|
|
35
36
|
export { Paginator, cursorPaginate, } from "@introspection-sdk/http";
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,sBAAsB,GAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,GAGV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,kBAAkB,GAEnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,sBAAsB,GAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,GAGV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,kBAAkB,GAEnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,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,GACb,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie-authenticated Resource Shares client for the browser (`/v1/shares`).
|
|
3
|
+
*
|
|
4
|
+
* Read-sharing grants for files and conversations: `create` / `list` / `get` /
|
|
5
|
+
* `delete` (revoke). A grant carries a `url` (with the `?share_id` capability) —
|
|
6
|
+
* read the shared resource via `client.files.get(id, { shareId })` or
|
|
7
|
+
* `client.conversations.items(id, { shareId })`. To fork a new task from a
|
|
8
|
+
* shared conversation, pass `fork_share_id` to `client.tasks.create(...)`.
|
|
9
|
+
*/
|
|
10
|
+
import type { ResourceShare, ShareCreateParams, ShareListParams } from "@introspection-sdk/types";
|
|
11
|
+
import { Paginator } from "@introspection-sdk/http";
|
|
12
|
+
import { BrowserHttpClient } from "./http.js";
|
|
13
|
+
/** Cookie-authenticated `/v1/shares` client. */
|
|
14
|
+
export declare class SharesClient {
|
|
15
|
+
private readonly http;
|
|
16
|
+
constructor(http: BrowserHttpClient);
|
|
17
|
+
/**
|
|
18
|
+
* List grants the caller created or that target them. `await` for the first
|
|
19
|
+
* page, or `for await` to stream every grant across pages.
|
|
20
|
+
*/
|
|
21
|
+
list(params?: ShareListParams): Paginator<ResourceShare>;
|
|
22
|
+
/** Create a read-sharing grant. The caller must own the target resource. */
|
|
23
|
+
create(body: ShareCreateParams): Promise<ResourceShare>;
|
|
24
|
+
/** Read a single grant (carries the `url` to the shared resource). */
|
|
25
|
+
get(shareId: string): Promise<ResourceShare>;
|
|
26
|
+
/** Revoke a grant. Only the grantor (or an admin/owner) may revoke. */
|
|
27
|
+
delete(shareId: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=shares.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shares.d.ts","sourceRoot":"","sources":["../../src/api/shares.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAEV,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,gDAAgD;AAChD,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,iBAAiB;IAEpD;;;OAGG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,aAAa,CAAC;IAYxD,4EAA4E;IAC5E,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAQvD,sEAAsE;IACtE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAO5C,uEAAuE;IACvE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie-authenticated Resource Shares client for the browser (`/v1/shares`).
|
|
3
|
+
*
|
|
4
|
+
* Read-sharing grants for files and conversations: `create` / `list` / `get` /
|
|
5
|
+
* `delete` (revoke). A grant carries a `url` (with the `?share_id` capability) —
|
|
6
|
+
* read the shared resource via `client.files.get(id, { shareId })` or
|
|
7
|
+
* `client.conversations.items(id, { shareId })`. To fork a new task from a
|
|
8
|
+
* shared conversation, pass `fork_share_id` to `client.tasks.create(...)`.
|
|
9
|
+
*/
|
|
10
|
+
import { cursorPaginate } from "@introspection-sdk/http";
|
|
11
|
+
/** Cookie-authenticated `/v1/shares` client. */
|
|
12
|
+
export class SharesClient {
|
|
13
|
+
http;
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* List grants the caller created or that target them. `await` for the first
|
|
19
|
+
* page, or `for await` to stream every grant across pages.
|
|
20
|
+
*/
|
|
21
|
+
list(params) {
|
|
22
|
+
return cursorPaginate((next) => this.http.request({
|
|
23
|
+
method: "GET",
|
|
24
|
+
path: "/v1/shares",
|
|
25
|
+
query: { ...params, next },
|
|
26
|
+
}), params?.next);
|
|
27
|
+
}
|
|
28
|
+
/** Create a read-sharing grant. The caller must own the target resource. */
|
|
29
|
+
create(body) {
|
|
30
|
+
return this.http.request({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/v1/shares",
|
|
33
|
+
body,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Read a single grant (carries the `url` to the shared resource). */
|
|
37
|
+
get(shareId) {
|
|
38
|
+
return this.http.request({
|
|
39
|
+
method: "GET",
|
|
40
|
+
path: `/v1/shares/${encodeURIComponent(shareId)}`,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Revoke a grant. Only the grantor (or an admin/owner) may revoke. */
|
|
44
|
+
delete(shareId) {
|
|
45
|
+
return this.http.request({
|
|
46
|
+
method: "DELETE",
|
|
47
|
+
path: `/v1/shares/${encodeURIComponent(shareId)}`,
|
|
48
|
+
expect: "empty",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=shares.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shares.js","sourceRoot":"","sources":["../../src/api/shares.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAa,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGpE,gDAAgD;AAChD,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAExD;;;OAGG;IACH,IAAI,CAAC,MAAwB;QAC3B,OAAO,cAAc,CACnB,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,IAAI,EAA6B;SACtD,CAAC,EACJ,MAAM,EAAE,IAAI,CACb,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,MAAM,CAAC,IAAuB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB;YACtC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;YAClB,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,sEAAsE;IACtE,GAAG,CAAC,OAAe;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB;YACtC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc,kBAAkB,CAAC,OAAO,CAAC,EAAE;SAClD,CAAC,CAAC;IACL,CAAC;IAED,uEAAuE;IACvE,MAAM,CAAC,OAAe;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO;YAC7B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,cAAc,kBAAkB,CAAC,OAAO,CAAC,EAAE;YACjD,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/api/tasks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RunIdentityInput, SseEvent, Task, TaskCancelResponse, TaskCreateResponse, TaskListParams, TaskRun, TaskRunCreateParams, TaskUpdateParams
|
|
1
|
+
import type { RunIdentityInput, SseEvent, Task, TaskCancelResponse, TaskCreateResponse, TaskListParams, TaskRun, TaskRunCreateParams, TaskUpdateParams } from "@introspection-sdk/types";
|
|
2
2
|
import { Paginator } from "@introspection-sdk/http";
|
|
3
3
|
import { BrowserHttpClient } from "./http.js";
|
|
4
4
|
/**
|
|
@@ -19,7 +19,6 @@ export interface CreateTaskParams {
|
|
|
19
19
|
agent_name?: string;
|
|
20
20
|
title?: string;
|
|
21
21
|
metadata?: Record<string, unknown>;
|
|
22
|
-
visibility?: TaskVisibility;
|
|
23
22
|
/**
|
|
24
23
|
* Override the interactive idle window (seconds) before the sandbox is
|
|
25
24
|
* torn down. `0` tears down as soon as it's provisioned; omit to use the
|
|
@@ -28,6 +27,13 @@ export interface CreateTaskParams {
|
|
|
28
27
|
idle_timeout_seconds?: number;
|
|
29
28
|
/** Caller identity for attribution; merged into `metadata.identity`. */
|
|
30
29
|
identity?: RunIdentityInput;
|
|
30
|
+
/**
|
|
31
|
+
* Fork from a shared conversation: the `/v1/shares` grant id for the source
|
|
32
|
+
* conversation. Its presence makes this create a fork — the server seeds the
|
|
33
|
+
* new task with that conversation's history, read via the share (the
|
|
34
|
+
* permissions boundary).
|
|
35
|
+
*/
|
|
36
|
+
fork_share_id?: string;
|
|
31
37
|
}
|
|
32
38
|
export interface StartTaskParams extends CreateTaskParams {
|
|
33
39
|
/** Required for the `start()` sugar that returns a run handle. */
|
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,EAEV,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EAEnB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/api/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EAEnB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C;;;;;;;;;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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gBAED,IAAI,EAAE,iBAAiB;IAIpD;;;;;;;;OAQG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC;IAY9C,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQ3D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC,iEAAiE;IAC3D,KAAK,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;CAIzD"}
|
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":"AAaA,OAAO,EAAa,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AA0CpC,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,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C7B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,aAAa,kBAAkB,CAAC,MAAM,CAAC,YAAY;YACzD,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;IACL,CAAC;IAED,iEAAiE;IACjE,KAAK,CAAC,KAAK,CAAC,MAAuB;QACjC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;CACF"}
|
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.4",
|
|
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/http": "0.5.4",
|
|
35
|
+
"@introspection-sdk/types": "0.5.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"lint": "eslint . --max-warnings 0",
|
package/src/api/client.ts
CHANGED
|
@@ -23,16 +23,17 @@ import { BrowserHttpClient, stripTrailingSlash, toApiError } from "./http.js";
|
|
|
23
23
|
import { TasksClient } from "./tasks.js";
|
|
24
24
|
import { FilesClient } from "./files.js";
|
|
25
25
|
import { ConversationsClient } from "./conversations.js";
|
|
26
|
+
import { SharesClient } from "./shares.js";
|
|
26
27
|
|
|
27
28
|
export interface IntrospectionApiClientOptions {
|
|
28
29
|
/** Data Plane REST base URL (e.g. `https://dp.us.introspection.dev`). */
|
|
29
30
|
dpUrl: string;
|
|
30
|
-
/** Project the session is scoped to. */
|
|
31
|
-
projectId: string;
|
|
32
31
|
/**
|
|
33
32
|
* Returns a fresh Introspection access token from the app's broker
|
|
34
33
|
* (its own backend). Called on `connect()` and again whenever the DP
|
|
35
|
-
* session cookie needs re-minting after a 401.
|
|
34
|
+
* session cookie needs re-minting after a 401. The session's project is
|
|
35
|
+
* derived from this token's claims server-side — there is no separate
|
|
36
|
+
* project option.
|
|
36
37
|
*/
|
|
37
38
|
getToken: () => string | Promise<string>;
|
|
38
39
|
/** Custom `fetch` (for tests or non-standard runtimes). */
|
|
@@ -48,6 +49,8 @@ export class IntrospectionApiClient {
|
|
|
48
49
|
readonly files: FilesClient;
|
|
49
50
|
/** Read-only `/v1/conversations` projection bound to the session cookie. */
|
|
50
51
|
readonly conversations: ConversationsClient;
|
|
52
|
+
/** `/v1/shares` read-sharing grants bound to the session cookie. */
|
|
53
|
+
readonly shares: SharesClient;
|
|
51
54
|
|
|
52
55
|
private readonly fetchImpl: typeof fetch;
|
|
53
56
|
|
|
@@ -67,6 +70,7 @@ export class IntrospectionApiClient {
|
|
|
67
70
|
this.tasks = new TasksClient(http);
|
|
68
71
|
this.files = new FilesClient(http);
|
|
69
72
|
this.conversations = new ConversationsClient(http);
|
|
73
|
+
this.shares = new SharesClient(http);
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
/**
|
|
@@ -87,7 +91,7 @@ export class IntrospectionApiClient {
|
|
|
87
91
|
"Content-Type": "application/json",
|
|
88
92
|
...(this.opts.additionalHeaders ?? {}),
|
|
89
93
|
},
|
|
90
|
-
body: JSON.stringify({ token
|
|
94
|
+
body: JSON.stringify({ token }),
|
|
91
95
|
credentials: "include",
|
|
92
96
|
},
|
|
93
97
|
);
|
package/src/api/files.ts
CHANGED
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
* bearer token — so a single-page app reads and writes files with the
|
|
7
7
|
* same identity session it uses for tasks and conversations. The DP
|
|
8
8
|
* derives the owning `identity_key` from the session JWT; per-identity
|
|
9
|
-
* file
|
|
9
|
+
* file ownership and access are enforced server-side.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type {
|
|
13
13
|
File as FileResource,
|
|
14
|
-
FileCreateOptions,
|
|
15
14
|
FileCreateTextParams,
|
|
16
15
|
FileListParams,
|
|
17
16
|
FileType,
|
|
@@ -59,12 +58,8 @@ export class FileVersionsClient {
|
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
create(
|
|
63
|
-
|
|
64
|
-
body: FileUploadBody,
|
|
65
|
-
options?: FileCreateOptions,
|
|
66
|
-
): Promise<FileResource> {
|
|
67
|
-
const form = toFormData(body, options);
|
|
61
|
+
create(fileId: string, body: FileUploadBody): Promise<FileResource> {
|
|
62
|
+
const form = toFormData(body);
|
|
68
63
|
return this.http.request<FileResource>({
|
|
69
64
|
method: "POST",
|
|
70
65
|
path: `/v1/files/${encodeURIComponent(fileId)}/versions`,
|
|
@@ -103,11 +98,8 @@ export class FilesClient {
|
|
|
103
98
|
);
|
|
104
99
|
}
|
|
105
100
|
|
|
106
|
-
upload(
|
|
107
|
-
body
|
|
108
|
-
options?: FileCreateOptions,
|
|
109
|
-
): Promise<FileResource> {
|
|
110
|
-
const form = toFormData(body, options);
|
|
101
|
+
upload(body: FileUploadBody): Promise<FileResource> {
|
|
102
|
+
const form = toFormData(body);
|
|
111
103
|
return this.http.request<FileResource>({
|
|
112
104
|
method: "POST",
|
|
113
105
|
path: "/v1/files",
|
|
@@ -115,16 +107,11 @@ export class FilesClient {
|
|
|
115
107
|
});
|
|
116
108
|
}
|
|
117
109
|
|
|
118
|
-
createText(
|
|
119
|
-
body: FileCreateTextParams,
|
|
120
|
-
options?: FileCreateOptions,
|
|
121
|
-
): Promise<FileResource> {
|
|
110
|
+
createText(body: FileCreateTextParams): Promise<FileResource> {
|
|
122
111
|
return this.http.request<FileResource>({
|
|
123
112
|
method: "POST",
|
|
124
113
|
path: "/v1/files",
|
|
125
|
-
body
|
|
126
|
-
? { ...body, visibility: options.visibility }
|
|
127
|
-
: body,
|
|
114
|
+
body,
|
|
128
115
|
});
|
|
129
116
|
}
|
|
130
117
|
|
|
@@ -168,10 +155,7 @@ export class FilesClient {
|
|
|
168
155
|
}
|
|
169
156
|
}
|
|
170
157
|
|
|
171
|
-
function toFormData(
|
|
172
|
-
body: FileUploadBody,
|
|
173
|
-
options?: FileCreateOptions,
|
|
174
|
-
): FormData {
|
|
158
|
+
function toFormData(body: FileUploadBody): FormData {
|
|
175
159
|
const fd = new FormData();
|
|
176
160
|
if ("file" in body && body.file instanceof Blob) {
|
|
177
161
|
fd.append("file", body.file, body.name);
|
|
@@ -191,6 +175,5 @@ function toFormData(
|
|
|
191
175
|
}
|
|
192
176
|
if (body.name) fd.append("name", body.name);
|
|
193
177
|
if (body.file_type) fd.append("file_type", body.file_type);
|
|
194
|
-
if (options?.visibility) fd.append("visibility", options.visibility);
|
|
195
178
|
return fd;
|
|
196
179
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* const client = new IntrospectionApiClient({
|
|
14
14
|
* dpUrl: "https://dp.us.introspection.dev",
|
|
15
|
-
*
|
|
16
|
-
* //
|
|
15
|
+
* // your backend mints the Introspection access token (the session's
|
|
16
|
+
* // project is derived from its claims — no projectId option needed)
|
|
17
17
|
* getToken: () => fetch("/api/introspection/token").then((r) => r.text()),
|
|
18
18
|
* });
|
|
19
19
|
*
|
|
@@ -47,6 +47,7 @@ export {
|
|
|
47
47
|
ConversationsClient,
|
|
48
48
|
ConversationItemsClient,
|
|
49
49
|
} from "./conversations.js";
|
|
50
|
+
export { SharesClient } from "./shares.js";
|
|
50
51
|
export { BrowserHttpClient, type BrowserHttpConfig } from "./http.js";
|
|
51
52
|
export { parseSse } from "./sse.js";
|
|
52
53
|
export {
|
|
@@ -60,7 +61,6 @@ export type {
|
|
|
60
61
|
Task,
|
|
61
62
|
TaskRun,
|
|
62
63
|
TaskStatus,
|
|
63
|
-
TaskVisibility,
|
|
64
64
|
TaskCreateResponse,
|
|
65
65
|
TaskListParams,
|
|
66
66
|
TaskUpdateParams,
|
|
@@ -74,7 +74,6 @@ export type {
|
|
|
74
74
|
FileListParams,
|
|
75
75
|
FileUpdateParams,
|
|
76
76
|
FileCreateTextParams,
|
|
77
|
-
FileCreateOptions,
|
|
78
77
|
ListParams,
|
|
79
78
|
ConversationSummary,
|
|
80
79
|
ConversationItem,
|
|
@@ -83,6 +82,10 @@ export type {
|
|
|
83
82
|
ConversationItemListParams,
|
|
84
83
|
ConversationItemInclude,
|
|
85
84
|
ConversationResponse,
|
|
85
|
+
ResourceShare,
|
|
86
|
+
ShareResourceType,
|
|
87
|
+
ShareCreateParams,
|
|
88
|
+
ShareListParams,
|
|
86
89
|
} from "@introspection-sdk/types";
|
|
87
90
|
export {
|
|
88
91
|
IntrospectionAPIError,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie-authenticated Resource Shares client for the browser (`/v1/shares`).
|
|
3
|
+
*
|
|
4
|
+
* Read-sharing grants for files and conversations: `create` / `list` / `get` /
|
|
5
|
+
* `delete` (revoke). A grant carries a `url` (with the `?share_id` capability) —
|
|
6
|
+
* read the shared resource via `client.files.get(id, { shareId })` or
|
|
7
|
+
* `client.conversations.items(id, { shareId })`. To fork a new task from a
|
|
8
|
+
* shared conversation, pass `fork_share_id` to `client.tasks.create(...)`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
Paginated,
|
|
13
|
+
ResourceShare,
|
|
14
|
+
ShareCreateParams,
|
|
15
|
+
ShareListParams,
|
|
16
|
+
} from "@introspection-sdk/types";
|
|
17
|
+
import { Paginator, cursorPaginate } from "@introspection-sdk/http";
|
|
18
|
+
import { BrowserHttpClient } from "./http.js";
|
|
19
|
+
|
|
20
|
+
/** Cookie-authenticated `/v1/shares` client. */
|
|
21
|
+
export class SharesClient {
|
|
22
|
+
constructor(private readonly http: BrowserHttpClient) {}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* List grants the caller created or that target them. `await` for the first
|
|
26
|
+
* page, or `for await` to stream every grant across pages.
|
|
27
|
+
*/
|
|
28
|
+
list(params?: ShareListParams): Paginator<ResourceShare> {
|
|
29
|
+
return cursorPaginate(
|
|
30
|
+
(next) =>
|
|
31
|
+
this.http.request<Paginated<ResourceShare>>({
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/v1/shares",
|
|
34
|
+
query: { ...params, next } as Record<string, unknown>,
|
|
35
|
+
}),
|
|
36
|
+
params?.next,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Create a read-sharing grant. The caller must own the target resource. */
|
|
41
|
+
create(body: ShareCreateParams): Promise<ResourceShare> {
|
|
42
|
+
return this.http.request<ResourceShare>({
|
|
43
|
+
method: "POST",
|
|
44
|
+
path: "/v1/shares",
|
|
45
|
+
body,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Read a single grant (carries the `url` to the shared resource). */
|
|
50
|
+
get(shareId: string): Promise<ResourceShare> {
|
|
51
|
+
return this.http.request<ResourceShare>({
|
|
52
|
+
method: "GET",
|
|
53
|
+
path: `/v1/shares/${encodeURIComponent(shareId)}`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Revoke a grant. Only the grantor (or an admin/owner) may revoke. */
|
|
58
|
+
delete(shareId: string): Promise<void> {
|
|
59
|
+
return this.http.request<void>({
|
|
60
|
+
method: "DELETE",
|
|
61
|
+
path: `/v1/shares/${encodeURIComponent(shareId)}`,
|
|
62
|
+
expect: "empty",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
package/src/api/tasks.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type {
|
|
|
10
10
|
TaskRunCreateParams,
|
|
11
11
|
TaskRunResponse,
|
|
12
12
|
TaskUpdateParams,
|
|
13
|
-
TaskVisibility,
|
|
14
13
|
} from "@introspection-sdk/types";
|
|
15
14
|
import { Paginator, cursorPaginate } from "@introspection-sdk/http";
|
|
16
15
|
import { BrowserHttpClient } from "./http.js";
|
|
@@ -34,7 +33,6 @@ export interface CreateTaskParams {
|
|
|
34
33
|
agent_name?: string;
|
|
35
34
|
title?: string;
|
|
36
35
|
metadata?: Record<string, unknown>;
|
|
37
|
-
visibility?: TaskVisibility;
|
|
38
36
|
/**
|
|
39
37
|
* Override the interactive idle window (seconds) before the sandbox is
|
|
40
38
|
* torn down. `0` tears down as soon as it's provisioned; omit to use the
|
|
@@ -43,6 +41,13 @@ export interface CreateTaskParams {
|
|
|
43
41
|
idle_timeout_seconds?: number;
|
|
44
42
|
/** Caller identity for attribution; merged into `metadata.identity`. */
|
|
45
43
|
identity?: RunIdentityInput;
|
|
44
|
+
/**
|
|
45
|
+
* Fork from a shared conversation: the `/v1/shares` grant id for the source
|
|
46
|
+
* conversation. Its presence makes this create a fork — the server seeds the
|
|
47
|
+
* new task with that conversation's history, read via the share (the
|
|
48
|
+
* permissions boundary).
|
|
49
|
+
*/
|
|
50
|
+
fork_share_id?: string;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
export interface StartTaskParams extends CreateTaskParams {
|