@rool-dev/sdk 0.12.5 → 2.0.0-dev.36748aa
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 +436 -784
- package/dist/agents.d.ts +138 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +563 -0
- package/dist/agents.js.map +1 -0
- package/dist/auth-base.d.ts +43 -88
- package/dist/auth-base.d.ts.map +1 -1
- package/dist/auth-base.js +178 -302
- package/dist/auth-base.js.map +1 -1
- package/dist/auth-browser.d.ts +7 -25
- package/dist/auth-browser.d.ts.map +1 -1
- package/dist/auth-browser.js +45 -82
- package/dist/auth-browser.js.map +1 -1
- package/dist/auth-native.d.ts +9 -56
- package/dist/auth-native.d.ts.map +1 -1
- package/dist/auth-native.js +88 -177
- package/dist/auth-native.js.map +1 -1
- package/dist/auth-node.d.ts +32 -36
- package/dist/auth-node.d.ts.map +1 -1
- package/dist/auth-node.js +338 -265
- package/dist/auth-node.js.map +1 -1
- package/dist/auth-url.d.ts +6 -0
- package/dist/auth-url.d.ts.map +1 -0
- package/dist/auth-url.js +30 -0
- package/dist/auth-url.js.map +1 -0
- package/dist/client.d.ts +35 -290
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +323 -635
- package/dist/client.js.map +1 -1
- package/dist/events.d.ts +40 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +175 -0
- package/dist/events.js.map +1 -0
- package/dist/files.d.ts +174 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +846 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +16 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -20
- package/dist/index.js.map +1 -1
- package/dist/machine.d.ts +51 -0
- package/dist/machine.d.ts.map +1 -0
- package/dist/machine.js +142 -0
- package/dist/machine.js.map +1 -0
- package/dist/problem.d.ts +11 -0
- package/dist/problem.d.ts.map +1 -0
- package/dist/problem.js +20 -0
- package/dist/problem.js.map +1 -0
- package/dist/structured.d.ts +84 -0
- package/dist/structured.d.ts.map +1 -0
- package/dist/structured.js +405 -0
- package/dist/structured.js.map +1 -0
- package/dist/types.d.ts +119 -520
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -16
- package/dist/auth.d.ts +0 -99
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -217
- package/dist/auth.js.map +0 -1
- package/dist/client-info.d.ts +0 -18
- package/dist/client-info.d.ts.map +0 -1
- package/dist/client-info.js +0 -25
- package/dist/client-info.js.map +0 -1
- package/dist/event-emitter.d.ts +0 -45
- package/dist/event-emitter.d.ts.map +0 -1
- package/dist/event-emitter.js +0 -86
- package/dist/event-emitter.js.map +0 -1
- package/dist/graphql.d.ts +0 -90
- package/dist/graphql.d.ts.map +0 -1
- package/dist/graphql.js +0 -471
- package/dist/graphql.js.map +0 -1
- package/dist/logger.d.ts +0 -13
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -17
- package/dist/logger.js.map +0 -1
- package/dist/path.d.ts +0 -6
- package/dist/path.d.ts.map +0 -1
- package/dist/path.js +0 -47
- package/dist/path.js.map +0 -1
- package/dist/reroute.d.ts +0 -22
- package/dist/reroute.d.ts.map +0 -1
- package/dist/reroute.js +0 -70
- package/dist/reroute.js.map +0 -1
- package/dist/rest.d.ts +0 -54
- package/dist/rest.d.ts.map +0 -1
- package/dist/rest.js +0 -171
- package/dist/rest.js.map +0 -1
- package/dist/router.d.ts +0 -20
- package/dist/router.d.ts.map +0 -1
- package/dist/router.js +0 -54
- package/dist/router.js.map +0 -1
- package/dist/space-session.d.ts +0 -30
- package/dist/space-session.d.ts.map +0 -1
- package/dist/space-session.js +0 -83
- package/dist/space-session.js.map +0 -1
- package/dist/space.d.ts +0 -161
- package/dist/space.d.ts.map +0 -1
- package/dist/space.js +0 -618
- package/dist/space.js.map +0 -1
- package/dist/subscription.d.ts +0 -36
- package/dist/subscription.d.ts.map +0 -1
- package/dist/subscription.js +0 -419
- package/dist/subscription.js.map +0 -1
- package/dist/webdav.d.ts +0 -171
- package/dist/webdav.d.ts.map +0 -1
- package/dist/webdav.js +0 -481
- package/dist/webdav.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,208 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export type FieldType = {
|
|
6
|
-
kind: 'string';
|
|
7
|
-
} | {
|
|
8
|
-
kind: 'number';
|
|
9
|
-
} | {
|
|
10
|
-
kind: 'boolean';
|
|
11
|
-
} | {
|
|
12
|
-
kind: 'array';
|
|
13
|
-
inner?: FieldType;
|
|
14
|
-
} | {
|
|
15
|
-
kind: 'maybe';
|
|
16
|
-
inner: FieldType;
|
|
17
|
-
} | {
|
|
18
|
-
kind: 'enum';
|
|
19
|
-
values: string[];
|
|
20
|
-
} | {
|
|
21
|
-
kind: 'literal';
|
|
22
|
-
value: string | number | boolean;
|
|
23
|
-
} | {
|
|
24
|
-
kind: 'ref';
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* A named field definition within a collection.
|
|
28
|
-
*/
|
|
29
|
-
export interface FieldDef {
|
|
30
|
-
name: string;
|
|
31
|
-
type: FieldType;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* A collection definition — a named set of typed fields.
|
|
35
|
-
*/
|
|
36
|
-
export interface CollectionDef {
|
|
37
|
-
fields: FieldDef[];
|
|
38
|
-
/** Optional schema.org type name for this collection (e.g. "Person", "MusicAlbum"). */
|
|
39
|
-
schemaOrgType?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The full schema for a space — a map of collection names to definitions.
|
|
43
|
-
*/
|
|
44
|
-
export type SpaceSchema = Record<string, CollectionDef>;
|
|
45
|
-
/**
|
|
46
|
-
* An object in a space. Objects are JSON files addressed by machine path.
|
|
47
|
-
* References between objects are body fields whose values are paths.
|
|
48
|
-
*/
|
|
49
|
-
export interface RoolObject {
|
|
50
|
-
/** Canonical machine path, e.g. `/space/article/welcome.json`. */
|
|
51
|
-
path: string;
|
|
52
|
-
/** User-defined fields. */
|
|
53
|
-
body: Record<string, unknown>;
|
|
54
|
-
}
|
|
55
|
-
/** Result of fetching object bodies in bulk. */
|
|
56
|
-
export interface GetObjectsResult {
|
|
57
|
-
objects: RoolObject[];
|
|
58
|
-
missing: string[];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* A tool call record is keyed by id; running calls have no result, finished calls have a string result.
|
|
62
|
-
*/
|
|
63
|
-
export type ToolCall = RunningToolCall | FinishedToolCall;
|
|
64
|
-
export interface RunningToolCall {
|
|
1
|
+
export type RoolPlan = "standard" | "plus" | "pro" | "max" | "admin";
|
|
2
|
+
export type ClientCompatibility = "ok" | "unsupported";
|
|
3
|
+
export interface UserAccount {
|
|
65
4
|
id: string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
result: string;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Interaction lifecycle status.
|
|
79
|
-
* - `pending` — Created, work not started yet
|
|
80
|
-
* - `streaming` — Final text response being generated (`output` contains partial text)
|
|
81
|
-
* - `done` — Finished successfully
|
|
82
|
-
* - `error` — Finished with an error
|
|
83
|
-
*/
|
|
84
|
-
export type InteractionStatus = 'pending' | 'streaming' | 'done' | 'error';
|
|
85
|
-
/**
|
|
86
|
-
* An interaction entry - combines request and response in a single record.
|
|
87
|
-
*/
|
|
88
|
-
export interface Interaction {
|
|
89
|
-
id: string;
|
|
90
|
-
/** Parent interaction in the conversation tree. null = root message. */
|
|
91
|
-
parentId: string | null;
|
|
92
|
-
timestamp: number;
|
|
93
|
-
userId: string;
|
|
94
|
-
userName?: string | null;
|
|
95
|
-
operation: 'prompt' | 'putObject' | 'patchObject' | 'moveObject' | 'deleteObjects' | 'deletePaths' | string;
|
|
96
|
-
input: string;
|
|
97
|
-
output: string | null;
|
|
98
|
-
status: InteractionStatus;
|
|
99
|
-
ai: boolean;
|
|
100
|
-
/** Paths of objects affected by this interaction. */
|
|
101
|
-
modifiedObjectPaths: string[];
|
|
102
|
-
toolCalls: ToolCall[];
|
|
103
|
-
/** Canonical rool-machine:/... resource refs attached by the user. */
|
|
104
|
-
attachments?: string[];
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* A conversation in a space — holds interaction history and optional system instruction.
|
|
108
|
-
*/
|
|
109
|
-
export interface Conversation {
|
|
110
|
-
name?: string;
|
|
111
|
-
/** Owning agent's folder name; absent from servers that predate the field. */
|
|
112
|
-
agent?: string;
|
|
113
|
-
visibility?: ConversationVisibility;
|
|
114
|
-
systemInstruction?: string;
|
|
115
|
-
createdAt: number;
|
|
116
|
-
createdBy: string;
|
|
117
|
-
interactions: Record<string, Interaction>;
|
|
5
|
+
email: string;
|
|
6
|
+
photoUrl: string | null;
|
|
7
|
+
plan: RoolPlan;
|
|
8
|
+
creditsBalance: number;
|
|
9
|
+
totalCreditsUsed: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
lastActivity: string | null;
|
|
12
|
+
processedAt: string;
|
|
13
|
+
stripeStatus: string | null;
|
|
118
14
|
}
|
|
119
|
-
|
|
120
|
-
* Who may see a conversation: 'shared' is every space member; 'private' is
|
|
121
|
-
* owner-only; 'temporary' is private plus auto-delete once it sits idle.
|
|
122
|
-
*/
|
|
123
|
-
export type ConversationVisibility = 'shared' | 'private' | 'temporary';
|
|
124
|
-
/**
|
|
125
|
-
* Lightweight conversation metadata — no interaction bodies. Returned by
|
|
126
|
-
* `openSpace` (as `conversationMeta`) and maintained from SSE events. The
|
|
127
|
-
* `updatedAt` field drives last-activity display without loading any contents.
|
|
128
|
-
*/
|
|
129
|
-
export interface ConversationMeta {
|
|
130
|
-
id: string;
|
|
131
|
-
/** Owning agent's folder name under /agents ("rool" is the stock agent). */
|
|
132
|
-
agent: string;
|
|
133
|
-
visibility: ConversationVisibility;
|
|
15
|
+
export interface UserProfile {
|
|
134
16
|
name: string | null;
|
|
135
|
-
|
|
136
|
-
createdAt: number;
|
|
137
|
-
createdBy: string;
|
|
138
|
-
interactionCount: number;
|
|
139
|
-
updatedAt: number;
|
|
17
|
+
marketingOptIn: boolean;
|
|
140
18
|
}
|
|
141
|
-
export type
|
|
142
|
-
|
|
143
|
-
export type
|
|
144
|
-
export
|
|
19
|
+
export type UserAppData = Record<string, unknown>;
|
|
20
|
+
export type MachineRole = "owner" | "admin" | "editor" | "viewer";
|
|
21
|
+
export type MachineLifecycleState = "active" | "locked";
|
|
22
|
+
export type MachineMeta = Record<string, unknown>;
|
|
23
|
+
export interface MachineSummary {
|
|
145
24
|
id: string;
|
|
146
25
|
name: string;
|
|
147
26
|
inboundEmailAddress: string;
|
|
148
|
-
|
|
27
|
+
meta: MachineMeta;
|
|
28
|
+
role: MachineRole;
|
|
149
29
|
ownerId: string;
|
|
150
30
|
size: number;
|
|
151
31
|
createdAt: string;
|
|
152
32
|
updatedAt: string;
|
|
153
33
|
memberCount: number;
|
|
34
|
+
state: MachineLifecycleState;
|
|
35
|
+
}
|
|
36
|
+
export interface MachineSettings {
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
export interface MachineCheckpoint {
|
|
40
|
+
id: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
}
|
|
43
|
+
export interface MachineCheckpointCollection {
|
|
44
|
+
checkpoints: MachineCheckpoint[];
|
|
45
|
+
baseCheckpointId: string | null;
|
|
154
46
|
}
|
|
155
|
-
export interface
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
47
|
+
export interface MachineMember {
|
|
48
|
+
userId: string;
|
|
49
|
+
email: string;
|
|
50
|
+
name: string | null;
|
|
51
|
+
role: MachineRole;
|
|
52
|
+
photoUrl: string | null;
|
|
53
|
+
}
|
|
54
|
+
export interface MachineMemberRoleConfiguration {
|
|
55
|
+
role: MachineRole;
|
|
56
|
+
}
|
|
57
|
+
export type MachineInviteRole = Exclude<MachineRole, "owner">;
|
|
58
|
+
export type MachineInviteEmailStatus = "sent" | "not_configured" | "failed" | "cooldown" | "rate_limited";
|
|
59
|
+
export interface MachineInvite {
|
|
60
|
+
id: string;
|
|
61
|
+
role: MachineInviteRole;
|
|
160
62
|
email: string | null;
|
|
161
|
-
|
|
63
|
+
createdById: string;
|
|
162
64
|
createdAt: string;
|
|
163
65
|
expiresAt: string;
|
|
164
66
|
maxUses: number | null;
|
|
165
67
|
useCount: number;
|
|
166
68
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
* - 'cooldown': a recent invite to this same address was already emailed
|
|
175
|
-
* - 'rate_limited': the inviter hit their daily email-invite cap
|
|
176
|
-
* Treat unknown values as not sent.
|
|
177
|
-
*/
|
|
178
|
-
export type InviteEmailStatus = 'sent' | 'not_configured' | 'failed' | 'cooldown' | 'rate_limited' | (string & {});
|
|
179
|
-
export interface SpaceInviteCreated {
|
|
180
|
-
inviteId: string;
|
|
181
|
-
spaceId: string;
|
|
182
|
-
role: InviteRole;
|
|
183
|
-
email: string | null;
|
|
184
|
-
expiresAt: string;
|
|
185
|
-
maxUses: number | null;
|
|
186
|
-
/** Join URL containing the secret token; only available at mint time */
|
|
69
|
+
export interface CreateMachineInvite {
|
|
70
|
+
role: MachineInviteRole;
|
|
71
|
+
email?: string | null;
|
|
72
|
+
expiresInDays?: number | null;
|
|
73
|
+
maxUses?: number | null;
|
|
74
|
+
}
|
|
75
|
+
export interface CreatedMachineInvite extends MachineInvite {
|
|
187
76
|
url: string;
|
|
188
|
-
emailStatus:
|
|
77
|
+
emailStatus: MachineInviteEmailStatus | null;
|
|
189
78
|
}
|
|
190
|
-
export interface
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
role:
|
|
79
|
+
export interface MachineInvitePreview {
|
|
80
|
+
machineId: string;
|
|
81
|
+
machineName: string;
|
|
82
|
+
role: MachineInviteRole;
|
|
194
83
|
email: string | null;
|
|
195
84
|
inviterName: string | null;
|
|
196
85
|
}
|
|
197
|
-
export
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
86
|
+
export type InviteRedemptionStatus = "joined" | "upgraded" | "already_member";
|
|
87
|
+
export interface InviteRedemption {
|
|
88
|
+
machineId: string;
|
|
89
|
+
role: MachineRole;
|
|
90
|
+
status: InviteRedemptionStatus;
|
|
201
91
|
}
|
|
202
|
-
/** What a gift grants. Kinds are added over time, so
|
|
203
|
-
*
|
|
92
|
+
/** What a gift grants. Kinds are added over time, so clients should prefer the
|
|
93
|
+
* server-rendered description unless they need a kind's structured value. */
|
|
204
94
|
export type GiftPayload = {
|
|
205
|
-
kind:
|
|
95
|
+
kind: "credits";
|
|
206
96
|
credits: number;
|
|
207
97
|
};
|
|
208
98
|
export interface Gift {
|
|
@@ -214,7 +104,7 @@ export interface Gift {
|
|
|
214
104
|
gift: GiftPayload;
|
|
215
105
|
/** The promise as a noun phrase, e.g. "10,000 AI credits" */
|
|
216
106
|
description: string;
|
|
217
|
-
/** Null while
|
|
107
|
+
/** Null while unclaimed */
|
|
218
108
|
claimedAt: string | null;
|
|
219
109
|
/** Claimer's display name, when claimed and they have one */
|
|
220
110
|
claimedByName: string | null;
|
|
@@ -228,7 +118,7 @@ export interface GiftList {
|
|
|
228
118
|
gifts: Gift[];
|
|
229
119
|
}
|
|
230
120
|
/** Changes to a gift's bookkeeping. Undefined leaves a field as it is;
|
|
231
|
-
*
|
|
121
|
+
* note: null clears it. */
|
|
232
122
|
export interface GiftUpdate {
|
|
233
123
|
note?: string | null;
|
|
234
124
|
archived?: boolean;
|
|
@@ -244,362 +134,71 @@ export interface GiftClaimResult {
|
|
|
244
134
|
gift: GiftPayload;
|
|
245
135
|
description: string;
|
|
246
136
|
}
|
|
247
|
-
export interface
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
photoUrl: string | null;
|
|
252
|
-
}
|
|
253
|
-
export interface CurrentUser {
|
|
254
|
-
id: string;
|
|
255
|
-
email: string;
|
|
256
|
-
name: string | null;
|
|
257
|
-
photoUrl: string | null;
|
|
258
|
-
slug: string;
|
|
259
|
-
plan: string;
|
|
260
|
-
creditsBalance: number;
|
|
261
|
-
totalCreditsUsed: number;
|
|
262
|
-
createdAt: string;
|
|
263
|
-
lastActivity: string;
|
|
264
|
-
processedAt: string;
|
|
265
|
-
storage: Record<string, unknown>;
|
|
266
|
-
stripeStatus: string | null;
|
|
267
|
-
marketingOptIn: boolean;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Effort level for AI operations.
|
|
271
|
-
* - 'QUICK': Fast responses, read-only (no object mutations)
|
|
272
|
-
* - 'STANDARD': Default behavior with full capabilities
|
|
273
|
-
* - 'REASONING': Extended reasoning for complex tasks
|
|
274
|
-
* - 'RESEARCH': Pre-analysis and context gathering (reserved for future use)
|
|
275
|
-
*/
|
|
276
|
-
export type PromptEffort = 'QUICK' | 'STANDARD' | 'REASONING' | 'RESEARCH';
|
|
277
|
-
export type PromptAttachment = File | Blob | {
|
|
278
|
-
data: string;
|
|
279
|
-
contentType: string;
|
|
280
|
-
filename?: string;
|
|
281
|
-
} | string;
|
|
282
|
-
export interface PromptOptions {
|
|
283
|
-
responseSchema?: Record<string, unknown>;
|
|
284
|
-
/** Effort level for the AI operation. Defaults to 'STANDARD'. */
|
|
285
|
-
effort?: PromptEffort;
|
|
286
|
-
/** Parent interaction in the conversation tree. Omit to auto-continue from the active leaf. Pass null to start a new root-level branch. */
|
|
287
|
-
parentInteractionId?: string | null;
|
|
288
|
-
/**
|
|
289
|
-
* Client-supplied interaction id. The server echoes this id back on the
|
|
290
|
-
* resulting interaction, so a caller can render an optimistic message keyed by
|
|
291
|
-
* it and reconcile the server's copy in place (no unmount/remount). Defaults to
|
|
292
|
-
* an internally-generated id. Use {@link generateEntityId} to mint one.
|
|
293
|
-
*/
|
|
294
|
-
interactionId?: string;
|
|
295
|
-
/** If true, the prompt won't be recorded in interaction history. Useful for transient operations like tab completion. */
|
|
296
|
-
ephemeral?: boolean;
|
|
297
|
-
/** If true, mutation tools (create, update, delete) are disabled. Defaults to false. */
|
|
298
|
-
readOnly?: boolean;
|
|
299
|
-
/**
|
|
300
|
-
* Resources to attach to the prompt.
|
|
301
|
-
*
|
|
302
|
-
* Pass existing machine paths for objects (`/space/...`) or files
|
|
303
|
-
* (`/rool-drive/...`). Local File, Blob, or base64 inputs are uploaded to
|
|
304
|
-
* authenticated space file storage first; the resulting file paths are sent
|
|
305
|
-
* to the server as canonical `rool-machine:/...` refs.
|
|
306
|
-
*
|
|
307
|
-
* Supported file types for AI viewing:
|
|
308
|
-
* - **Images** (JPEG, PNG, GIF, WebP, SVG) — viewed natively by the AI
|
|
309
|
-
* - **PDFs** — viewed natively by the AI
|
|
310
|
-
* - **Text files** (TXT, Markdown, CSV, JSON, XML, HTML) — read as text
|
|
311
|
-
* - **DOCX** — text extracted and read by the AI
|
|
312
|
-
*/
|
|
313
|
-
attachments?: PromptAttachment[];
|
|
314
|
-
/**
|
|
315
|
-
* Abort signal to stop the in-flight prompt. When aborted, the server stops
|
|
316
|
-
* the agent loop and closes the stream; note that any LLM turn already in
|
|
317
|
-
* flight on Vertex keeps generating server-side and is billed.
|
|
318
|
-
*/
|
|
137
|
+
export interface MachineFetchInit {
|
|
138
|
+
method?: "GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
139
|
+
headers?: Record<string, string>;
|
|
140
|
+
body?: unknown;
|
|
319
141
|
signal?: AbortSignal;
|
|
320
|
-
/** Telemetry event for this prompt. Default `'prompt_user'`; override for
|
|
321
|
-
* app-initiated prompts (e.g. `'prompt_onboarding_seed'`). Only `'prompt_user'`
|
|
322
|
-
* counts toward active-user metrics. */
|
|
323
|
-
eventName?: string;
|
|
324
|
-
}
|
|
325
|
-
export interface CollectionOptions {
|
|
326
|
-
/** Optional schema.org type name for this collection (e.g. "Person", "MusicAlbum"). */
|
|
327
|
-
schemaOrgType?: string;
|
|
328
|
-
}
|
|
329
|
-
export interface UpdateObjectOptions {
|
|
330
|
-
/** Fields to add or update. Pass null/undefined to delete a field. Fields prefixed with `_` are hidden from AI. */
|
|
331
|
-
data?: Record<string, unknown>;
|
|
332
|
-
}
|
|
333
|
-
export interface MoveObjectOptions {
|
|
334
|
-
/** Replace the body atomically as part of the move. If omitted, the body is preserved. */
|
|
335
|
-
body?: Record<string, unknown>;
|
|
336
|
-
}
|
|
337
|
-
export type ConnectionState = 'connected' | 'disconnected' | 'reconnecting';
|
|
338
|
-
export type ClientCompatibility = 'ok' | 'unsupported';
|
|
339
|
-
export type RoolEventSource = 'user' | 'agent';
|
|
340
|
-
export type ClientEventType = 'connected' | 'space_created' | 'space_deleted' | 'space_renamed' | 'space_access_changed' | 'user_storage_changed';
|
|
341
|
-
interface ClientEventBase {
|
|
342
|
-
timestamp: number;
|
|
343
|
-
}
|
|
344
|
-
export interface ConnectedClientEvent extends ClientEventBase {
|
|
345
|
-
type: 'connected';
|
|
346
|
-
serverVersion: string;
|
|
347
|
-
minimumSdkVersion?: string | null;
|
|
348
|
-
compatibility?: ClientCompatibility;
|
|
349
142
|
}
|
|
350
|
-
export interface
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
inboundEmailAddress?: string;
|
|
355
|
-
ownerId?: string;
|
|
356
|
-
size?: number;
|
|
357
|
-
createdAt?: string;
|
|
358
|
-
updatedAt?: string;
|
|
359
|
-
role?: string;
|
|
360
|
-
}
|
|
361
|
-
export interface SpaceDeletedClientEvent extends ClientEventBase {
|
|
362
|
-
type: 'space_deleted';
|
|
363
|
-
spaceId: string;
|
|
364
|
-
}
|
|
365
|
-
export interface SpaceRenamedClientEvent extends ClientEventBase {
|
|
366
|
-
type: 'space_renamed';
|
|
367
|
-
spaceId: string;
|
|
368
|
-
name: string;
|
|
369
|
-
}
|
|
370
|
-
export interface SpaceAccessChangedClientEvent extends ClientEventBase {
|
|
371
|
-
type: 'space_access_changed';
|
|
372
|
-
spaceId: string;
|
|
373
|
-
name: string;
|
|
374
|
-
inboundEmailAddress: string;
|
|
375
|
-
ownerId: string;
|
|
376
|
-
size: number;
|
|
377
|
-
createdAt: string;
|
|
378
|
-
updatedAt: string;
|
|
379
|
-
role: string;
|
|
380
|
-
memberCount: number;
|
|
143
|
+
export interface ServerInfo {
|
|
144
|
+
version: string;
|
|
145
|
+
minimumSdkVersion: string;
|
|
146
|
+
compatibility: ClientCompatibility;
|
|
381
147
|
}
|
|
382
|
-
export interface
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
148
|
+
export interface RoolSession {
|
|
149
|
+
account: UserAccount;
|
|
150
|
+
profile: UserProfile;
|
|
151
|
+
userAppData: UserAppData;
|
|
152
|
+
machines: MachineSummary[];
|
|
153
|
+
accountSyncToken: string;
|
|
154
|
+
server: ServerInfo;
|
|
386
155
|
}
|
|
387
|
-
export
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
type: SpaceEventType;
|
|
391
|
-
spaceId: string;
|
|
392
|
-
timestamp: number;
|
|
393
|
-
source: RoolEventSource;
|
|
394
|
-
conversationId?: string;
|
|
395
|
-
conversation?: Conversation;
|
|
396
|
-
serverVersion?: string;
|
|
156
|
+
export interface Greeting {
|
|
157
|
+
title: string;
|
|
158
|
+
text: string;
|
|
397
159
|
}
|
|
398
|
-
/**
|
|
399
|
-
* Result of an email+password sign-in.
|
|
400
|
-
* - `signed_in`: tokens issued, the user is now authenticated.
|
|
401
|
-
* - `verify_required`: the account's email isn't verified yet; a magic link
|
|
402
|
-
* has been emailed and the user must complete verification before signing in.
|
|
403
|
-
*/
|
|
404
160
|
export type PasswordSignInResult = {
|
|
405
|
-
status:
|
|
161
|
+
status: "signed_in" | "verify_required";
|
|
406
162
|
};
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
export interface
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
email: string | null;
|
|
422
|
-
name: string | null;
|
|
423
|
-
};
|
|
424
|
-
/** Check if currently authenticated (validates token is usable) */
|
|
425
|
-
isAuthenticated: () => Promise<boolean>;
|
|
426
|
-
/** Initiate login with application name */
|
|
427
|
-
login: (appName: string, params?: Record<string, string>) => Promise<void> | void;
|
|
428
|
-
/** Initiate signup with application name */
|
|
429
|
-
signup: (appName: string, params?: Record<string, string>) => Promise<void> | void;
|
|
430
|
-
/**
|
|
431
|
-
* Complete an email verification flow. Exchanges a verify JWT (from the
|
|
432
|
-
* verification email link) for a live session and signs the user in.
|
|
433
|
-
* Optional: providers that don't implement it will reject the call.
|
|
434
|
-
*/
|
|
435
|
-
verify?: (token: string) => Promise<boolean>;
|
|
436
|
-
/**
|
|
437
|
-
* Complete a native deep-link auth callback (PKCE). The app calls this from
|
|
438
|
-
* its platform deep-link handler with the full callback URL. Optional:
|
|
439
|
-
* providers that don't implement it reject the call.
|
|
440
|
-
*/
|
|
441
|
-
handleRedirect?: (url: string) => Promise<boolean>;
|
|
442
|
-
/**
|
|
443
|
-
* Sign in with email + password. Resolves to `signed_in` (authenticated) or
|
|
444
|
-
* `verify_required` (magic link emailed); rejects on bad credentials.
|
|
445
|
-
* Optional: providers that don't implement it reject the call.
|
|
446
|
-
*/
|
|
447
|
-
signInWithPassword?: (email: string, password: string) => Promise<PasswordSignInResult>;
|
|
448
|
-
/**
|
|
449
|
-
* Request a magic sign-in link by email. Resolves once the email is accepted,
|
|
450
|
-
* rejects if the address is rejected. Completion happens later via `verify`.
|
|
451
|
-
* Optional: providers that don't implement it reject the call.
|
|
452
|
-
*/
|
|
453
|
-
requestMagicLink?: (email: string) => Promise<void>;
|
|
454
|
-
/** Replace the current access and refresh tokens after a credential change. */
|
|
455
|
-
replaceTokens?: (tokens: AuthTokens) => void;
|
|
456
|
-
/** Logout and clear session */
|
|
457
|
-
logout: () => void;
|
|
458
|
-
/** Clean up resources (e.g. stop timers) */
|
|
459
|
-
destroy?: () => void;
|
|
460
|
-
/** Optional: receive the resolved auth URL from the client. */
|
|
461
|
-
setAuthUrl?: (url: string) => void;
|
|
462
|
-
/** Optional: receive the client's logger. */
|
|
463
|
-
setLogger?: (logger: import('./logger.js').Logger) => void;
|
|
464
|
-
/**
|
|
465
|
-
* Optional: receive the client's auth-state handler so provider-driven
|
|
466
|
-
* sign-in/out (and 401 token clearing) reach client events and state.
|
|
467
|
-
*/
|
|
468
|
-
setAuthStateChangedHandler?: (handler: (authenticated: boolean) => void) => void;
|
|
163
|
+
export interface RoolRequestTokens {
|
|
164
|
+
accessToken: string;
|
|
165
|
+
roolToken: string;
|
|
166
|
+
}
|
|
167
|
+
export interface RoolTokenSource {
|
|
168
|
+
readonly getTokens: () => Promise<RoolRequestTokens | undefined>;
|
|
169
|
+
}
|
|
170
|
+
export interface RoolAuth extends RoolTokenSource {
|
|
171
|
+
initialize(): Promise<boolean>;
|
|
172
|
+
isAuthenticated(): Promise<boolean>;
|
|
173
|
+
login(appName: string, params?: Record<string, string>): Promise<void>;
|
|
174
|
+
signup(appName: string, params?: Record<string, string>): Promise<void>;
|
|
175
|
+
readonly logout: () => Promise<void>;
|
|
176
|
+
onAuthStateChanged(listener: (authenticated: boolean) => void): () => void;
|
|
469
177
|
}
|
|
470
178
|
export interface RoolClientIdentity {
|
|
471
|
-
/** Application name, e.g. com.example.app or my-web-app. */
|
|
472
179
|
appName?: string;
|
|
473
|
-
/** Application version, e.g. 1.4.2. */
|
|
474
180
|
appVersion?: string;
|
|
475
|
-
/** Operating system version, e.g. iOS 17.5 or Android 15. */
|
|
476
181
|
osVersion?: string;
|
|
477
182
|
}
|
|
478
|
-
export interface ServerInfo {
|
|
479
|
-
version: string;
|
|
480
|
-
minimumSdkVersion?: string | null;
|
|
481
|
-
compatibility: ClientCompatibility;
|
|
482
|
-
}
|
|
483
183
|
export interface RoolClientConfig {
|
|
484
|
-
/**
|
|
485
|
-
* API server URL (default: `'https://api.rool.dev'`).
|
|
486
|
-
*
|
|
487
|
-
* The auth URL is derived by stripping the `api.` hostname prefix
|
|
488
|
-
* (e.g. `https://api.rool.dev` → `https://rool.dev/auth`). For local
|
|
489
|
-
* development where the API runs on a different host, set `authUrl`
|
|
490
|
-
* explicitly.
|
|
491
|
-
*/
|
|
492
184
|
apiUrl?: string;
|
|
493
|
-
/**
|
|
494
|
-
|
|
495
|
-
/** Override GraphQL endpoint (default: `{apiUrl}/graphql`) */
|
|
496
|
-
graphqlUrl?: string;
|
|
497
|
-
/** Override auth endpoint (derived from `apiUrl` by stripping `api.` prefix) */
|
|
498
|
-
authUrl?: string;
|
|
499
|
-
/** Application identity sent with SDK requests. */
|
|
500
|
-
client?: RoolClientIdentity;
|
|
185
|
+
/** Supply access and Rool tokens from an auth client. */
|
|
186
|
+
getTokens?: () => RoolRequestTokens | null | undefined | Promise<RoolRequestTokens | null | undefined>;
|
|
501
187
|
/**
|
|
502
|
-
*
|
|
503
|
-
*
|
|
188
|
+
* Supply only an access token from an external auth client. Prefer getTokens
|
|
189
|
+
* when the auth flow also issues a Rool token.
|
|
504
190
|
*/
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
*/
|
|
511
|
-
logger?: import('./logger.js').Logger;
|
|
512
|
-
}
|
|
513
|
-
/** Source of a user storage change */
|
|
514
|
-
export type UserStorageSource = 'local' | 'remote';
|
|
515
|
-
/** Event payload for user storage changes */
|
|
516
|
-
export interface UserStorageChangedEvent {
|
|
517
|
-
key: string;
|
|
518
|
-
value: unknown;
|
|
519
|
-
source: UserStorageSource;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Client-level events (space lifecycle, auth, connection, user storage).
|
|
523
|
-
*/
|
|
524
|
-
export interface RoolClientEvents {
|
|
525
|
-
/** Emitted when authentication state changes */
|
|
526
|
-
authStateChanged: (authenticated: boolean) => void;
|
|
527
|
-
/** Emitted when the current user profile is (re)hydrated, updated, or cleared */
|
|
528
|
-
currentUserChanged: (user: CurrentUser | null) => void;
|
|
529
|
-
/** Emitted when a space is added to the user's list (created or access granted) */
|
|
530
|
-
spaceAdded: (space: RoolSpaceInfo) => void;
|
|
531
|
-
/** Emitted when a space is removed from the user's list (deleted or access revoked) */
|
|
532
|
-
spaceRemoved: (spaceId: string) => void;
|
|
533
|
-
/** Emitted when a space is renamed (by any client) */
|
|
534
|
-
spaceRenamed: (spaceId: string, newName: string) => void;
|
|
535
|
-
/** Emitted when user storage changes (local or remote) */
|
|
536
|
-
userStorageChanged: (event: UserStorageChangedEvent) => void;
|
|
537
|
-
/** Emitted when SSE connection state changes */
|
|
538
|
-
connectionStateChanged: (state: ConnectionState) => void;
|
|
539
|
-
/** Emitted when server identity or compatibility changes */
|
|
540
|
-
serverInfoChanged: (info: ServerInfo) => void;
|
|
541
|
-
/** Emitted when this SDK is older than the server's minimum supported SDK version */
|
|
542
|
-
unsupported: (info: ServerInfo) => void;
|
|
543
|
-
/** Emitted on errors */
|
|
544
|
-
error: (error: Error, context?: string) => void;
|
|
545
|
-
/** Index signature for EventEmitter compatibility */
|
|
546
|
-
[key: string]: (...args: any[]) => void;
|
|
547
|
-
}
|
|
548
|
-
export interface SpaceFilesChangedEvent {
|
|
549
|
-
spaceId: string;
|
|
550
|
-
source: RoolEventSource;
|
|
551
|
-
timestamp: number;
|
|
552
|
-
}
|
|
553
|
-
export interface RoolSpaceEvents extends SpaceContentEvents {
|
|
554
|
-
/** File storage changed; call webdav.syncCollection() to reconcile. */
|
|
555
|
-
filesChanged: (event: SpaceFilesChangedEvent) => void;
|
|
556
|
-
/** WebDAV sync tokens were invalidated; discard local tokens and full-resync. */
|
|
557
|
-
filesReset: (event: SpaceFilesChangedEvent) => void;
|
|
558
|
-
/** SSE connection state changed */
|
|
559
|
-
connectionStateChanged: (state: ConnectionState) => void;
|
|
560
|
-
/** Index signature for EventEmitter compatibility */
|
|
561
|
-
[key: string]: (...args: any[]) => void;
|
|
562
|
-
}
|
|
563
|
-
/**
|
|
564
|
-
* Source of a space change event.
|
|
565
|
-
* - 'local_user': This client made the change
|
|
566
|
-
* - 'remote_user': Another user/client made the change
|
|
567
|
-
* - 'remote_agent': AI agent made the change
|
|
568
|
-
* - 'system': Resync after error
|
|
569
|
-
*/
|
|
570
|
-
export type ChangeSource = 'local_user' | 'remote_user' | 'remote_agent' | 'system';
|
|
571
|
-
export interface ConversationUpdatedEvent {
|
|
572
|
-
conversationId: string;
|
|
573
|
-
timestamp: number;
|
|
574
|
-
/** The full conversation payload from SSE, or `null` when deleted. Reactive
|
|
575
|
-
* consumers can read interaction status (e.g. the thinking dot) straight from
|
|
576
|
-
* this without opening a conversation handle. */
|
|
577
|
-
conversation: Conversation | null;
|
|
578
|
-
source: ChangeSource;
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Space content events (conversations and resets). Schema and metadata have no
|
|
582
|
-
* events here — they live in the filesystem (`/space/<collection>/.schema.json`,
|
|
583
|
-
* `/space/.meta.json`) and reactive consumers re-read them when the file tree
|
|
584
|
-
* reports a change. Object/file reactivity is exposed via `filesChanged` /
|
|
585
|
-
* `filesReset` plus WebDAV `syncCollection()`.
|
|
586
|
-
*/
|
|
587
|
-
export interface SpaceContentEvents {
|
|
588
|
-
/** Conversation interaction history was updated */
|
|
589
|
-
conversationUpdated: (event: ConversationUpdatedEvent) => void;
|
|
590
|
-
/** Emitted when a sync error occurs */
|
|
591
|
-
syncError: (error: Error) => void;
|
|
592
|
-
/** Index signature for EventEmitter compatibility */
|
|
593
|
-
[key: string]: (...args: any[]) => void;
|
|
594
|
-
}
|
|
595
|
-
export interface AuthTokens {
|
|
596
|
-
accessToken: string;
|
|
597
|
-
refreshToken: string | null;
|
|
598
|
-
expiresAt: number;
|
|
191
|
+
getAccessToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
192
|
+
/** Called after an API response rejects the current authentication. */
|
|
193
|
+
onAuthInvalidated?: () => void | Promise<void>;
|
|
194
|
+
fetch?: typeof globalThis.fetch;
|
|
195
|
+
client?: RoolClientIdentity;
|
|
599
196
|
}
|
|
600
|
-
export interface
|
|
601
|
-
|
|
602
|
-
|
|
197
|
+
export interface RoolProblemDetails {
|
|
198
|
+
type: string;
|
|
199
|
+
title: string;
|
|
200
|
+
status: number;
|
|
201
|
+
code: string;
|
|
202
|
+
detail: string;
|
|
603
203
|
}
|
|
604
|
-
export {};
|
|
605
204
|
//# sourceMappingURL=types.d.ts.map
|