usemycontext 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # usemycontext
2
+
3
+ The user's context, in any AI app you ship. One `npm i`, one hook, and the
4
+ user's compiled personal context drops straight into your prompts - while
5
+ UseMyContext stays structurally blind to the content.
6
+
7
+ ```bash
8
+ npm i usemycontext
9
+ ```
10
+
11
+ ```jsx
12
+ import { useMyContextReact } from "usemycontext/react";
13
+
14
+ // The user pasted their UseMyContext token (grab one at usemycontext.ai/#/connect).
15
+ // This component connects, then drops their compiled context into a prompt.
16
+ function Assistant({ token }) {
17
+ const { state, connected, connect, client } = useMyContextReact();
18
+
19
+ async function run() {
20
+ await connect({ token });
21
+ const { composite } = await client.profile(); // the user's compiled context
22
+ const { passages } = await client.ask("what should I keep in mind?");
23
+ const systemPrompt =
24
+ `You are helping a specific person. Their context:\n${composite}\n\n` +
25
+ `Relevant notes:\n${passages.map((p) => p.text).join("\n")}`;
26
+ console.log(systemPrompt); // -> hand this to your LLM
27
+ }
28
+
29
+ return (
30
+ <button onClick={run} disabled={state === "connecting"}>
31
+ {connected ? "Connected" : "Use my context"}
32
+ </button>
33
+ );
34
+ }
35
+ ```
36
+
37
+ That is the whole integration. The hook holds the user's *own* token and calls
38
+ the membrane exactly like Claude does - same trust model, new client shape.
39
+
40
+ ## Without React
41
+
42
+ The core entry is framework-free:
43
+
44
+ ```js
45
+ import { useMyContext } from "usemycontext";
46
+
47
+ const ctx = useMyContext();
48
+ await ctx.connect({ token }); // v1 is TOKEN-IN
49
+ const { composite } = await ctx.profile();
50
+ ```
51
+
52
+ ## The drop-in button
53
+
54
+ ```jsx
55
+ import { ConnectMyContext } from "usemycontext/react";
56
+
57
+ <ConnectMyContext token={token} onConnect={(s) => console.log(s)} />;
58
+ ```
59
+
60
+ It renders one `<button class="umc-connect-button" data-umc-state="...">` whose
61
+ label tracks the connect state. Style it however you like - the markup is yours.
62
+
63
+ ## The 7 tools
64
+
65
+ Once `connected`, the client exposes one ergonomic wrapper per MCP tool:
66
+
67
+ | Method | Returns | What it is |
68
+ |---|---|---|
69
+ | `client.profile()` | `{ composite, facts? }` | the compiled personal context - drop into a system prompt |
70
+ | `client.ask(query, { k? })` | `{ passages, text }` | `ask_docs` - cited passages to ground the LLM |
71
+ | `client.listFiles()` | `FileMeta[]` | the user's files (metadata only) |
72
+ | `client.searchFiles(query)` | `FileMeta[]` | search files by name |
73
+ | `client.getFile(fileId)` | `{ text, downloadUrl? }` | the file's full extracted text |
74
+ | `client.suggestUpdate(text)` | `{ id?, text }` | the one write - a PENDING suggestion the user reviews |
75
+ | `client.sharedContext(from?)` | `{ mode, shares, composite }` | read contexts others shared with the user |
76
+
77
+ ## The connect state machine
78
+
79
+ `ctx.state` is one of:
80
+
81
+ ```
82
+ idle -> connecting -> connected
83
+ \-> declined (user/host refused)
84
+ \-> error (network / transport failure)
85
+ connected -> expired (token rejected mid-session - re-connect)
86
+ <any> -> disconnected (disconnect() was called)
87
+ ```
88
+
89
+ A 401 from the membrane (an expired or revoked token) moves the client to
90
+ `expired` and throws `TokenExpiredError`; re-run `connect({ token })` with a
91
+ fresh token to recover.
92
+
93
+ ## Errors
94
+
95
+ Every failure is a typed subclass of `UseMyContextError`:
96
+
97
+ - `NotConnectedError` - a wrapper was called before `connect()`.
98
+ - `TokenExpiredError` - the membrane rejected the token (carries the
99
+ `WWW-Authenticate` header).
100
+ - `ScopeDeniedError` - this connection is not authorized for that tool.
101
+ - `ToolCallError` - the tool returned an error result.
102
+ - `TransportError` - the network/transport failed.
103
+
104
+ ## Token model (v1)
105
+
106
+ v1 is **token-in only**: you supply the user's UseMyContext session token to
107
+ `connect({ token })`. The full browser-OAuth-in-the-SDK flow (a hosted popup on
108
+ `connect.usemycontext.ai`) is v2.
109
+
110
+ ## Persistence
111
+
112
+ The token is persisted to `localStorage` by default (a returning page starts
113
+ `connected`). Pass `storage: null` to disable, or a custom `StorageAdapter`:
114
+
115
+ ```js
116
+ useMyContext({ storage: null });
117
+ ```
118
+
119
+ ## License
120
+
121
+ MIT
@@ -0,0 +1,217 @@
1
+ /** Base class for every error the SDK throws, so callers can `catch (e)`. */
2
+ declare class UseMyContextError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /** Thrown when a tool wrapper is called before a successful `connect()`. */
6
+ declare class NotConnectedError extends UseMyContextError {
7
+ constructor(message?: string);
8
+ }
9
+ /**
10
+ * Thrown when the membrane rejects the token (HTTP 401 + WWW-Authenticate).
11
+ * The client also transitions to `expired` so the host can re-connect.
12
+ */
13
+ declare class TokenExpiredError extends UseMyContextError {
14
+ /** The raw `WWW-Authenticate` header, when the server sent one. */
15
+ readonly wwwAuthenticate?: string;
16
+ constructor(message?: string, wwwAuthenticate?: string);
17
+ }
18
+ /** Thrown when a tool call is refused for lack of scope (membrane -32604). */
19
+ declare class ScopeDeniedError extends UseMyContextError {
20
+ readonly code = -32604;
21
+ constructor(message: string);
22
+ }
23
+ /** Thrown for a JSON-RPC protocol error or a tool-level `isError` result. */
24
+ declare class ToolCallError extends UseMyContextError {
25
+ /** The JSON-RPC error code, when the failure was a protocol error. */
26
+ readonly code?: number;
27
+ constructor(message: string, code?: number);
28
+ }
29
+ /** Thrown for transport/parse failures (network down, non-JSON body, ...). */
30
+ declare class TransportError extends UseMyContextError {
31
+ constructor(message: string);
32
+ }
33
+
34
+ /**
35
+ * The connect state machine the hook/client exposes.
36
+ *
37
+ * - `idle` nothing attempted yet (the fresh client).
38
+ * - `connecting` `connect({token})` is validating the token against the
39
+ * membrane (an `initialize` round-trip).
40
+ * - `connected` a valid token is held; the 7 tool wrappers are callable.
41
+ * - `declined` the user/host explicitly refused the connection (reserved
42
+ * for the v2 OAuth popup path; a v1 token-in connect never
43
+ * enters it on its own, but the reducer models it).
44
+ * - `expired` a previously-`connected` token was rejected by the membrane
45
+ * (a 401 + WWW-Authenticate); the host should re-connect.
46
+ * - `error` a non-auth failure (network/transport/parse) ended a connect
47
+ * or a wrapper call.
48
+ * - `disconnected` `disconnect()` was called; the token is cleared.
49
+ */
50
+ type ConnectState = "idle" | "connecting" | "connected" | "declined" | "expired" | "error" | "disconnected";
51
+ /** One file's metadata as returned by `list_files` / `search_files`. */
52
+ interface FileMeta {
53
+ id: string;
54
+ name: string;
55
+ size: number;
56
+ contentType: string;
57
+ modified: string;
58
+ /** Owner-side processing status; may be absent on legacy shapes. */
59
+ status?: "not-processed" | "processing" | "available" | "error";
60
+ }
61
+ /** The compiled personal context the `profile` tool serves. */
62
+ interface ProfileResult {
63
+ /**
64
+ * The compiled composite text, ready to drop into a system prompt. When the
65
+ * user has no compiled context yet, the membrane falls back to raw facts and
66
+ * this is the JSON of `{ facts: [...] }` rendered as text - in that case
67
+ * `facts` is populated and `composite` is the same string.
68
+ */
69
+ composite: string;
70
+ /** Raw facts, present only when the membrane fell back (no compile yet). */
71
+ facts?: string[];
72
+ }
73
+ /** One cited passage returned by `ask_docs`. */
74
+ interface AskPassage {
75
+ /** 1-based citation index as rendered by the membrane. */
76
+ index: number;
77
+ /** The passage text the LLM should reason over and quote. */
78
+ text: string;
79
+ /** The source file the passage was cited from (when present). */
80
+ file?: string;
81
+ /** The access scope (the owning user id) as cited. */
82
+ scope?: string;
83
+ /** The retrieval score (higher = more relevant), when present. */
84
+ score?: number;
85
+ }
86
+ /** The result of an `ask_docs` call. */
87
+ interface AskResult {
88
+ /** The cited passages, in rank order. Empty when nothing matched. */
89
+ passages: AskPassage[];
90
+ /** The raw rendered text the membrane returned (citations + passages). */
91
+ text: string;
92
+ }
93
+ /** The result of a `get_file` call. */
94
+ interface GetFileResult {
95
+ /** The full rendered text the membrane returned for the file. */
96
+ text: string;
97
+ /** A short-lived download link, parsed out of the rendered text when present. */
98
+ downloadUrl?: string;
99
+ }
100
+ /** The result of a `suggest_update` call (the one write tool). */
101
+ interface SuggestUpdateResult {
102
+ /** The candidate id the membrane assigned, when it could be parsed. */
103
+ id?: string;
104
+ /** The full rendered acknowledgement text. */
105
+ text: string;
106
+ }
107
+ /** One share listed by `shared_context` (LIST mode). */
108
+ interface SharedContextEntry {
109
+ /** Who shared it (a display label). */
110
+ ownerLabel: string;
111
+ /** The grantId - pass it back as `from` to READ that share. */
112
+ grantId: string;
113
+ }
114
+ /** The result of a `shared_context` call. */
115
+ interface SharedContextResult {
116
+ /** `"list"` when called with no `from`, `"read"` when a `from` was given. */
117
+ mode: "list" | "read";
118
+ /** LIST mode: the available shares (metadata only). */
119
+ shares: SharedContextEntry[];
120
+ /** READ mode: the selected composite text, or null when not available. */
121
+ composite: string | null;
122
+ /** The full rendered text the membrane returned. */
123
+ text: string;
124
+ }
125
+ /** Options accepted by `ask`. */
126
+ interface AskOptions {
127
+ /** How many passages to return (default 12, max 50). */
128
+ k?: number;
129
+ /** Bound an `"all"`-token call to one of your projects (server-validated). */
130
+ projectId?: string;
131
+ }
132
+ /** A pluggable transport so the client is testable with zero real network. */
133
+ interface Transport {
134
+ /**
135
+ * POST one JSON-RPC request to the membrane `/mcp` endpoint with the given
136
+ * bearer token. Returns the parsed HTTP status + JSON body. The default
137
+ * transport is `fetch`-based; tests inject a mock.
138
+ */
139
+ (req: {
140
+ url: string;
141
+ token: string;
142
+ body: unknown;
143
+ }): Promise<TransportResponse>;
144
+ }
145
+ /** What a transport hands back: the HTTP status, parsed body, and 401 header. */
146
+ interface TransportResponse {
147
+ status: number;
148
+ /** The parsed JSON body (or null on a non-JSON / empty body). */
149
+ body: unknown;
150
+ /** The `WWW-Authenticate` header value, when the server sent one (401s). */
151
+ wwwAuthenticate?: string | null;
152
+ }
153
+ /** Pluggable storage so token persistence is testable + SSR-safe. */
154
+ interface StorageAdapter {
155
+ get(key: string): string | null;
156
+ set(key: string, value: string): void;
157
+ remove(key: string): void;
158
+ }
159
+ /** Options for `useMyContext()` / `createClient()`. */
160
+ interface ClientOptions {
161
+ /** The membrane MCP endpoint. Defaults to the production URL. */
162
+ endpoint?: string;
163
+ /** A custom transport (tests inject a mock; defaults to `fetch`). */
164
+ transport?: Transport;
165
+ /**
166
+ * Where to persist the token across reloads. Defaults to `localStorage` when
167
+ * available, else an in-memory store (SSR-safe). Pass `null` to disable
168
+ * persistence entirely.
169
+ */
170
+ storage?: StorageAdapter | null;
171
+ /** The storage key under which the token is persisted. */
172
+ storageKey?: string;
173
+ /** Called whenever the connect state changes (the React hook uses this). */
174
+ onStateChange?: (state: ConnectState) => void;
175
+ }
176
+ /** The arguments to `connect()` - v1 is TOKEN-IN ONLY. */
177
+ interface ConnectArgs {
178
+ /** A UseMyContext session token (the user's own bearer, as Claude holds). */
179
+ token: string;
180
+ }
181
+
182
+ /** The production membrane MCP endpoint. */
183
+ declare const DEFAULT_ENDPOINT = "https://mcp.usemycontext.ai/mcp";
184
+ /** The shape `useMyContext()` returns - the client handle. */
185
+ interface UseMyContextClient {
186
+ /** The current connect state. */
187
+ readonly state: ConnectState;
188
+ /** Convenience: true iff `state === "connected"`. */
189
+ readonly connected: boolean;
190
+ /** The held token, when connected (else null). */
191
+ readonly token: string | null;
192
+ /** Subscribe to state changes. Returns an unsubscribe fn. */
193
+ subscribe(listener: (state: ConnectState) => void): () => void;
194
+ /** v1 TOKEN-IN connect: validate the token against the membrane. */
195
+ connect(args: ConnectArgs): Promise<ConnectState>;
196
+ /** Clear the token + persisted storage; -> `disconnected`. */
197
+ disconnect(): void;
198
+ profile(): Promise<ProfileResult>;
199
+ listFiles(): Promise<FileMeta[]>;
200
+ searchFiles(query: string): Promise<FileMeta[]>;
201
+ getFile(fileId: string): Promise<GetFileResult>;
202
+ ask(query: string, opts?: AskOptions): Promise<AskResult>;
203
+ suggestUpdate(suggestion: string): Promise<SuggestUpdateResult>;
204
+ sharedContext(from?: string): Promise<SharedContextResult>;
205
+ }
206
+ /**
207
+ * Create a UseMyContext client. Framework-free: the React hook wraps this.
208
+ * Restores a persisted token (without revalidating) so a returning host page
209
+ * starts `connected`; a stale token surfaces as `expired` on the first call.
210
+ */
211
+ declare function useMyContext(options?: ClientOptions): UseMyContextClient;
212
+ /** Thrown for a bad SDK call argument (a developer error, not a state event). */
213
+ declare class UseMyContextConnectArgError extends UseMyContextError {
214
+ constructor(message?: string);
215
+ }
216
+
217
+ export { type AskOptions as A, type ClientOptions as C, DEFAULT_ENDPOINT as D, type FileMeta as F, type GetFileResult as G, NotConnectedError as N, type ProfileResult as P, ScopeDeniedError as S, TokenExpiredError as T, type UseMyContextClient as U, type AskPassage as a, type AskResult as b, type ConnectArgs as c, type ConnectState as d, type SharedContextEntry as e, type SharedContextResult as f, type StorageAdapter as g, type SuggestUpdateResult as h, ToolCallError as i, type Transport as j, TransportError as k, type TransportResponse as l, UseMyContextConnectArgError as m, UseMyContextError as n, useMyContext as u };
@@ -0,0 +1,217 @@
1
+ /** Base class for every error the SDK throws, so callers can `catch (e)`. */
2
+ declare class UseMyContextError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /** Thrown when a tool wrapper is called before a successful `connect()`. */
6
+ declare class NotConnectedError extends UseMyContextError {
7
+ constructor(message?: string);
8
+ }
9
+ /**
10
+ * Thrown when the membrane rejects the token (HTTP 401 + WWW-Authenticate).
11
+ * The client also transitions to `expired` so the host can re-connect.
12
+ */
13
+ declare class TokenExpiredError extends UseMyContextError {
14
+ /** The raw `WWW-Authenticate` header, when the server sent one. */
15
+ readonly wwwAuthenticate?: string;
16
+ constructor(message?: string, wwwAuthenticate?: string);
17
+ }
18
+ /** Thrown when a tool call is refused for lack of scope (membrane -32604). */
19
+ declare class ScopeDeniedError extends UseMyContextError {
20
+ readonly code = -32604;
21
+ constructor(message: string);
22
+ }
23
+ /** Thrown for a JSON-RPC protocol error or a tool-level `isError` result. */
24
+ declare class ToolCallError extends UseMyContextError {
25
+ /** The JSON-RPC error code, when the failure was a protocol error. */
26
+ readonly code?: number;
27
+ constructor(message: string, code?: number);
28
+ }
29
+ /** Thrown for transport/parse failures (network down, non-JSON body, ...). */
30
+ declare class TransportError extends UseMyContextError {
31
+ constructor(message: string);
32
+ }
33
+
34
+ /**
35
+ * The connect state machine the hook/client exposes.
36
+ *
37
+ * - `idle` nothing attempted yet (the fresh client).
38
+ * - `connecting` `connect({token})` is validating the token against the
39
+ * membrane (an `initialize` round-trip).
40
+ * - `connected` a valid token is held; the 7 tool wrappers are callable.
41
+ * - `declined` the user/host explicitly refused the connection (reserved
42
+ * for the v2 OAuth popup path; a v1 token-in connect never
43
+ * enters it on its own, but the reducer models it).
44
+ * - `expired` a previously-`connected` token was rejected by the membrane
45
+ * (a 401 + WWW-Authenticate); the host should re-connect.
46
+ * - `error` a non-auth failure (network/transport/parse) ended a connect
47
+ * or a wrapper call.
48
+ * - `disconnected` `disconnect()` was called; the token is cleared.
49
+ */
50
+ type ConnectState = "idle" | "connecting" | "connected" | "declined" | "expired" | "error" | "disconnected";
51
+ /** One file's metadata as returned by `list_files` / `search_files`. */
52
+ interface FileMeta {
53
+ id: string;
54
+ name: string;
55
+ size: number;
56
+ contentType: string;
57
+ modified: string;
58
+ /** Owner-side processing status; may be absent on legacy shapes. */
59
+ status?: "not-processed" | "processing" | "available" | "error";
60
+ }
61
+ /** The compiled personal context the `profile` tool serves. */
62
+ interface ProfileResult {
63
+ /**
64
+ * The compiled composite text, ready to drop into a system prompt. When the
65
+ * user has no compiled context yet, the membrane falls back to raw facts and
66
+ * this is the JSON of `{ facts: [...] }` rendered as text - in that case
67
+ * `facts` is populated and `composite` is the same string.
68
+ */
69
+ composite: string;
70
+ /** Raw facts, present only when the membrane fell back (no compile yet). */
71
+ facts?: string[];
72
+ }
73
+ /** One cited passage returned by `ask_docs`. */
74
+ interface AskPassage {
75
+ /** 1-based citation index as rendered by the membrane. */
76
+ index: number;
77
+ /** The passage text the LLM should reason over and quote. */
78
+ text: string;
79
+ /** The source file the passage was cited from (when present). */
80
+ file?: string;
81
+ /** The access scope (the owning user id) as cited. */
82
+ scope?: string;
83
+ /** The retrieval score (higher = more relevant), when present. */
84
+ score?: number;
85
+ }
86
+ /** The result of an `ask_docs` call. */
87
+ interface AskResult {
88
+ /** The cited passages, in rank order. Empty when nothing matched. */
89
+ passages: AskPassage[];
90
+ /** The raw rendered text the membrane returned (citations + passages). */
91
+ text: string;
92
+ }
93
+ /** The result of a `get_file` call. */
94
+ interface GetFileResult {
95
+ /** The full rendered text the membrane returned for the file. */
96
+ text: string;
97
+ /** A short-lived download link, parsed out of the rendered text when present. */
98
+ downloadUrl?: string;
99
+ }
100
+ /** The result of a `suggest_update` call (the one write tool). */
101
+ interface SuggestUpdateResult {
102
+ /** The candidate id the membrane assigned, when it could be parsed. */
103
+ id?: string;
104
+ /** The full rendered acknowledgement text. */
105
+ text: string;
106
+ }
107
+ /** One share listed by `shared_context` (LIST mode). */
108
+ interface SharedContextEntry {
109
+ /** Who shared it (a display label). */
110
+ ownerLabel: string;
111
+ /** The grantId - pass it back as `from` to READ that share. */
112
+ grantId: string;
113
+ }
114
+ /** The result of a `shared_context` call. */
115
+ interface SharedContextResult {
116
+ /** `"list"` when called with no `from`, `"read"` when a `from` was given. */
117
+ mode: "list" | "read";
118
+ /** LIST mode: the available shares (metadata only). */
119
+ shares: SharedContextEntry[];
120
+ /** READ mode: the selected composite text, or null when not available. */
121
+ composite: string | null;
122
+ /** The full rendered text the membrane returned. */
123
+ text: string;
124
+ }
125
+ /** Options accepted by `ask`. */
126
+ interface AskOptions {
127
+ /** How many passages to return (default 12, max 50). */
128
+ k?: number;
129
+ /** Bound an `"all"`-token call to one of your projects (server-validated). */
130
+ projectId?: string;
131
+ }
132
+ /** A pluggable transport so the client is testable with zero real network. */
133
+ interface Transport {
134
+ /**
135
+ * POST one JSON-RPC request to the membrane `/mcp` endpoint with the given
136
+ * bearer token. Returns the parsed HTTP status + JSON body. The default
137
+ * transport is `fetch`-based; tests inject a mock.
138
+ */
139
+ (req: {
140
+ url: string;
141
+ token: string;
142
+ body: unknown;
143
+ }): Promise<TransportResponse>;
144
+ }
145
+ /** What a transport hands back: the HTTP status, parsed body, and 401 header. */
146
+ interface TransportResponse {
147
+ status: number;
148
+ /** The parsed JSON body (or null on a non-JSON / empty body). */
149
+ body: unknown;
150
+ /** The `WWW-Authenticate` header value, when the server sent one (401s). */
151
+ wwwAuthenticate?: string | null;
152
+ }
153
+ /** Pluggable storage so token persistence is testable + SSR-safe. */
154
+ interface StorageAdapter {
155
+ get(key: string): string | null;
156
+ set(key: string, value: string): void;
157
+ remove(key: string): void;
158
+ }
159
+ /** Options for `useMyContext()` / `createClient()`. */
160
+ interface ClientOptions {
161
+ /** The membrane MCP endpoint. Defaults to the production URL. */
162
+ endpoint?: string;
163
+ /** A custom transport (tests inject a mock; defaults to `fetch`). */
164
+ transport?: Transport;
165
+ /**
166
+ * Where to persist the token across reloads. Defaults to `localStorage` when
167
+ * available, else an in-memory store (SSR-safe). Pass `null` to disable
168
+ * persistence entirely.
169
+ */
170
+ storage?: StorageAdapter | null;
171
+ /** The storage key under which the token is persisted. */
172
+ storageKey?: string;
173
+ /** Called whenever the connect state changes (the React hook uses this). */
174
+ onStateChange?: (state: ConnectState) => void;
175
+ }
176
+ /** The arguments to `connect()` - v1 is TOKEN-IN ONLY. */
177
+ interface ConnectArgs {
178
+ /** A UseMyContext session token (the user's own bearer, as Claude holds). */
179
+ token: string;
180
+ }
181
+
182
+ /** The production membrane MCP endpoint. */
183
+ declare const DEFAULT_ENDPOINT = "https://mcp.usemycontext.ai/mcp";
184
+ /** The shape `useMyContext()` returns - the client handle. */
185
+ interface UseMyContextClient {
186
+ /** The current connect state. */
187
+ readonly state: ConnectState;
188
+ /** Convenience: true iff `state === "connected"`. */
189
+ readonly connected: boolean;
190
+ /** The held token, when connected (else null). */
191
+ readonly token: string | null;
192
+ /** Subscribe to state changes. Returns an unsubscribe fn. */
193
+ subscribe(listener: (state: ConnectState) => void): () => void;
194
+ /** v1 TOKEN-IN connect: validate the token against the membrane. */
195
+ connect(args: ConnectArgs): Promise<ConnectState>;
196
+ /** Clear the token + persisted storage; -> `disconnected`. */
197
+ disconnect(): void;
198
+ profile(): Promise<ProfileResult>;
199
+ listFiles(): Promise<FileMeta[]>;
200
+ searchFiles(query: string): Promise<FileMeta[]>;
201
+ getFile(fileId: string): Promise<GetFileResult>;
202
+ ask(query: string, opts?: AskOptions): Promise<AskResult>;
203
+ suggestUpdate(suggestion: string): Promise<SuggestUpdateResult>;
204
+ sharedContext(from?: string): Promise<SharedContextResult>;
205
+ }
206
+ /**
207
+ * Create a UseMyContext client. Framework-free: the React hook wraps this.
208
+ * Restores a persisted token (without revalidating) so a returning host page
209
+ * starts `connected`; a stale token surfaces as `expired` on the first call.
210
+ */
211
+ declare function useMyContext(options?: ClientOptions): UseMyContextClient;
212
+ /** Thrown for a bad SDK call argument (a developer error, not a state event). */
213
+ declare class UseMyContextConnectArgError extends UseMyContextError {
214
+ constructor(message?: string);
215
+ }
216
+
217
+ export { type AskOptions as A, type ClientOptions as C, DEFAULT_ENDPOINT as D, type FileMeta as F, type GetFileResult as G, NotConnectedError as N, type ProfileResult as P, ScopeDeniedError as S, TokenExpiredError as T, type UseMyContextClient as U, type AskPassage as a, type AskResult as b, type ConnectArgs as c, type ConnectState as d, type SharedContextEntry as e, type SharedContextResult as f, type StorageAdapter as g, type SuggestUpdateResult as h, ToolCallError as i, type Transport as j, TransportError as k, type TransportResponse as l, UseMyContextConnectArgError as m, UseMyContextError as n, useMyContext as u };