@introspection-sdk/introspection-browser 0.5.2 → 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/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
- * projectId: "proj_…",
16
- * // your backend mints the Introspection access token
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
  *
@@ -38,6 +38,16 @@ export {
38
38
  type CreateTaskParams,
39
39
  type StartTaskParams,
40
40
  } from "./tasks.js";
41
+ export {
42
+ FilesClient,
43
+ FileVersionsClient,
44
+ type FileUploadBody,
45
+ } from "./files.js";
46
+ export {
47
+ ConversationsClient,
48
+ ConversationItemsClient,
49
+ } from "./conversations.js";
50
+ export { SharesClient } from "./shares.js";
41
51
  export { BrowserHttpClient, type BrowserHttpConfig } from "./http.js";
42
52
  export { parseSse } from "./sse.js";
43
53
  export {
@@ -51,7 +61,6 @@ export type {
51
61
  Task,
52
62
  TaskRun,
53
63
  TaskStatus,
54
- TaskVisibility,
55
64
  TaskCreateResponse,
56
65
  TaskListParams,
57
66
  TaskUpdateParams,
@@ -60,6 +69,23 @@ export type {
60
69
  RunIdentityInput,
61
70
  Paginated,
62
71
  SseEvent,
72
+ File,
73
+ FileType,
74
+ FileListParams,
75
+ FileUpdateParams,
76
+ FileCreateTextParams,
77
+ ListParams,
78
+ ConversationSummary,
79
+ ConversationItem,
80
+ ConversationItemList,
81
+ ConversationListParams,
82
+ ConversationItemListParams,
83
+ ConversationItemInclude,
84
+ ConversationResponse,
85
+ ResourceShare,
86
+ ShareResourceType,
87
+ ShareCreateParams,
88
+ ShareListParams,
63
89
  } from "@introspection-sdk/types";
64
90
  export {
65
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 {