@eloxiv/client 0.0.0-stage → 0.1.0

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.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Account.d.ts +131 -0
  4. package/dist/Account.d.ts.map +1 -0
  5. package/dist/Account.js +169 -0
  6. package/dist/Account.js.map +1 -0
  7. package/dist/Agent.d.ts +496 -0
  8. package/dist/Agent.d.ts.map +1 -0
  9. package/dist/Agent.js +228 -0
  10. package/dist/Agent.js.map +1 -0
  11. package/dist/AgentSync.d.ts +990 -0
  12. package/dist/AgentSync.d.ts.map +1 -0
  13. package/dist/AgentSync.js +46 -0
  14. package/dist/AgentSync.js.map +1 -0
  15. package/dist/AppState.d.ts +127 -0
  16. package/dist/AppState.d.ts.map +1 -0
  17. package/dist/AppState.js +145 -0
  18. package/dist/AppState.js.map +1 -0
  19. package/dist/AppStateSync.d.ts +193 -0
  20. package/dist/AppStateSync.d.ts.map +1 -0
  21. package/dist/AppStateSync.js +23 -0
  22. package/dist/AppStateSync.js.map +1 -0
  23. package/dist/Auth.d.ts +95 -0
  24. package/dist/Auth.d.ts.map +1 -0
  25. package/dist/Auth.js +139 -0
  26. package/dist/Auth.js.map +1 -0
  27. package/dist/Avatars.d.ts +53 -0
  28. package/dist/Avatars.d.ts.map +1 -0
  29. package/dist/Avatars.js +121 -0
  30. package/dist/Avatars.js.map +1 -0
  31. package/dist/BrowserAnalytics.d.ts +56 -0
  32. package/dist/BrowserAnalytics.d.ts.map +1 -0
  33. package/dist/BrowserAnalytics.js +94 -0
  34. package/dist/BrowserAnalytics.js.map +1 -0
  35. package/dist/Chat.d.ts +712 -0
  36. package/dist/Chat.d.ts.map +1 -0
  37. package/dist/Chat.js +883 -0
  38. package/dist/Chat.js.map +1 -0
  39. package/dist/ChatIntegrity.d.ts +63 -0
  40. package/dist/ChatIntegrity.d.ts.map +1 -0
  41. package/dist/ChatIntegrity.js +89 -0
  42. package/dist/ChatIntegrity.js.map +1 -0
  43. package/dist/ChatSends.d.ts +103 -0
  44. package/dist/ChatSends.d.ts.map +1 -0
  45. package/dist/ChatSends.js +157 -0
  46. package/dist/ChatSends.js.map +1 -0
  47. package/dist/Client.d.ts +113 -0
  48. package/dist/Client.d.ts.map +1 -0
  49. package/dist/Client.js +189 -0
  50. package/dist/Client.js.map +1 -0
  51. package/dist/Collab.d.ts +138 -0
  52. package/dist/Collab.d.ts.map +1 -0
  53. package/dist/Collab.js +454 -0
  54. package/dist/Collab.js.map +1 -0
  55. package/dist/CollabTools.d.ts +129 -0
  56. package/dist/CollabTools.d.ts.map +1 -0
  57. package/dist/CollabTools.js +277 -0
  58. package/dist/CollabTools.js.map +1 -0
  59. package/dist/Connections.d.ts +288 -0
  60. package/dist/Connections.d.ts.map +1 -0
  61. package/dist/Connections.js +316 -0
  62. package/dist/Connections.js.map +1 -0
  63. package/dist/Consent.d.ts +338 -0
  64. package/dist/Consent.d.ts.map +1 -0
  65. package/dist/Consent.js +142 -0
  66. package/dist/Consent.js.map +1 -0
  67. package/dist/Desktop.d.ts +61 -0
  68. package/dist/Desktop.d.ts.map +1 -0
  69. package/dist/Desktop.js +101 -0
  70. package/dist/Desktop.js.map +1 -0
  71. package/dist/Directory.d.ts +36 -0
  72. package/dist/Directory.d.ts.map +1 -0
  73. package/dist/Directory.js +42 -0
  74. package/dist/Directory.js.map +1 -0
  75. package/dist/ErrorReporter.d.ts +48 -0
  76. package/dist/ErrorReporter.d.ts.map +1 -0
  77. package/dist/ErrorReporter.js +70 -0
  78. package/dist/ErrorReporter.js.map +1 -0
  79. package/dist/ExpoSqlite.d.ts +7 -0
  80. package/dist/ExpoSqlite.d.ts.map +1 -0
  81. package/dist/ExpoSqlite.js +7 -0
  82. package/dist/ExpoSqlite.js.map +1 -0
  83. package/dist/FileSync.d.ts +265 -0
  84. package/dist/FileSync.d.ts.map +1 -0
  85. package/dist/FileSync.js +29 -0
  86. package/dist/FileSync.js.map +1 -0
  87. package/dist/FileTables.gen.d.ts +109 -0
  88. package/dist/FileTables.gen.d.ts.map +1 -0
  89. package/dist/FileTables.gen.js +23 -0
  90. package/dist/FileTables.gen.js.map +1 -0
  91. package/dist/Foldkit.d.ts +487 -0
  92. package/dist/Foldkit.d.ts.map +1 -0
  93. package/dist/Foldkit.js +617 -0
  94. package/dist/Foldkit.js.map +1 -0
  95. package/dist/History.d.ts +133 -0
  96. package/dist/History.d.ts.map +1 -0
  97. package/dist/History.js +210 -0
  98. package/dist/History.js.map +1 -0
  99. package/dist/InboxSync.d.ts +428 -0
  100. package/dist/InboxSync.d.ts.map +1 -0
  101. package/dist/InboxSync.js +37 -0
  102. package/dist/InboxSync.js.map +1 -0
  103. package/dist/KernelTables.gen.d.ts +1522 -0
  104. package/dist/KernelTables.gen.d.ts.map +1 -0
  105. package/dist/KernelTables.gen.js +307 -0
  106. package/dist/KernelTables.gen.js.map +1 -0
  107. package/dist/Make.d.ts +75 -0
  108. package/dist/Make.d.ts.map +1 -0
  109. package/dist/Make.js +70 -0
  110. package/dist/Make.js.map +1 -0
  111. package/dist/Models.d.ts +88 -0
  112. package/dist/Models.d.ts.map +1 -0
  113. package/dist/Models.js +80 -0
  114. package/dist/Models.js.map +1 -0
  115. package/dist/Optimistic.d.ts +120 -0
  116. package/dist/Optimistic.d.ts.map +1 -0
  117. package/dist/Optimistic.js +231 -0
  118. package/dist/Optimistic.js.map +1 -0
  119. package/dist/PlatformSync.d.ts +273 -0
  120. package/dist/PlatformSync.d.ts.map +1 -0
  121. package/dist/PlatformSync.js +92 -0
  122. package/dist/PlatformSync.js.map +1 -0
  123. package/dist/Poll.d.ts +113 -0
  124. package/dist/Poll.d.ts.map +1 -0
  125. package/dist/Poll.js +179 -0
  126. package/dist/Poll.js.map +1 -0
  127. package/dist/Preferences.d.ts +18 -0
  128. package/dist/Preferences.d.ts.map +1 -0
  129. package/dist/Preferences.js +22 -0
  130. package/dist/Preferences.js.map +1 -0
  131. package/dist/Proposals.d.ts +29 -0
  132. package/dist/Proposals.d.ts.map +1 -0
  133. package/dist/Proposals.js +41 -0
  134. package/dist/Proposals.js.map +1 -0
  135. package/dist/React.d.ts +17 -0
  136. package/dist/React.d.ts.map +1 -0
  137. package/dist/React.js +17 -0
  138. package/dist/React.js.map +1 -0
  139. package/dist/Reader.d.ts +35 -0
  140. package/dist/Reader.d.ts.map +1 -0
  141. package/dist/Reader.js +136 -0
  142. package/dist/Reader.js.map +1 -0
  143. package/dist/Resources.d.ts +98 -0
  144. package/dist/Resources.d.ts.map +1 -0
  145. package/dist/Resources.js +161 -0
  146. package/dist/Resources.js.map +1 -0
  147. package/dist/Rows.d.ts +4 -0
  148. package/dist/Rows.d.ts.map +1 -0
  149. package/dist/Rows.js +16 -0
  150. package/dist/Rows.js.map +1 -0
  151. package/dist/Runtime.d.ts +254 -0
  152. package/dist/Runtime.d.ts.map +1 -0
  153. package/dist/Runtime.js +1249 -0
  154. package/dist/Runtime.js.map +1 -0
  155. package/dist/RuntimeRuns.d.ts +74 -0
  156. package/dist/RuntimeRuns.d.ts.map +1 -0
  157. package/dist/RuntimeRuns.js +118 -0
  158. package/dist/RuntimeRuns.js.map +1 -0
  159. package/dist/ServicesSync.d.ts +286 -0
  160. package/dist/ServicesSync.d.ts.map +1 -0
  161. package/dist/ServicesSync.js +40 -0
  162. package/dist/ServicesSync.js.map +1 -0
  163. package/dist/Session.d.ts +226 -0
  164. package/dist/Session.d.ts.map +1 -0
  165. package/dist/Session.js +763 -0
  166. package/dist/Session.js.map +1 -0
  167. package/dist/ShareGrant.d.ts +47 -0
  168. package/dist/ShareGrant.d.ts.map +1 -0
  169. package/dist/ShareGrant.js +20 -0
  170. package/dist/ShareGrant.js.map +1 -0
  171. package/dist/Sharing.d.ts +203 -0
  172. package/dist/Sharing.d.ts.map +1 -0
  173. package/dist/Sharing.js +520 -0
  174. package/dist/Sharing.js.map +1 -0
  175. package/dist/Skew.d.ts +52 -0
  176. package/dist/Skew.d.ts.map +1 -0
  177. package/dist/Skew.js +77 -0
  178. package/dist/Skew.js.map +1 -0
  179. package/dist/SpacesSync.d.ts +247 -0
  180. package/dist/SpacesSync.d.ts.map +1 -0
  181. package/dist/SpacesSync.js +30 -0
  182. package/dist/SpacesSync.js.map +1 -0
  183. package/dist/Storage.d.ts +51 -0
  184. package/dist/Storage.d.ts.map +1 -0
  185. package/dist/Storage.js +107 -0
  186. package/dist/Storage.js.map +1 -0
  187. package/dist/Sync.d.ts +48 -0
  188. package/dist/Sync.d.ts.map +1 -0
  189. package/dist/Sync.js +48 -0
  190. package/dist/Sync.js.map +1 -0
  191. package/dist/SyncTables.d.ts +13 -0
  192. package/dist/SyncTables.d.ts.map +1 -0
  193. package/dist/SyncTables.js +13 -0
  194. package/dist/SyncTables.js.map +1 -0
  195. package/dist/Tab.d.ts +36 -0
  196. package/dist/Tab.d.ts.map +1 -0
  197. package/dist/Tab.js +44 -0
  198. package/dist/Tab.js.map +1 -0
  199. package/dist/Transport.d.ts +139 -0
  200. package/dist/Transport.d.ts.map +1 -0
  201. package/dist/Transport.js +232 -0
  202. package/dist/Transport.js.map +1 -0
  203. package/dist/Upload.d.ts +41 -0
  204. package/dist/Upload.d.ts.map +1 -0
  205. package/dist/Upload.js +93 -0
  206. package/dist/Upload.js.map +1 -0
  207. package/dist/WebMcp.d.ts +78 -0
  208. package/dist/WebMcp.d.ts.map +1 -0
  209. package/dist/WebMcp.js +204 -0
  210. package/dist/WebMcp.js.map +1 -0
  211. package/dist/index.d.ts +27 -0
  212. package/dist/index.d.ts.map +1 -0
  213. package/dist/index.js +27 -0
  214. package/dist/index.js.map +1 -0
  215. package/package.json +97 -3
  216. package/src/Account.ts +249 -0
  217. package/src/Agent.ts +387 -0
  218. package/src/AgentSync.ts +59 -0
  219. package/src/AppState.ts +222 -0
  220. package/src/AppStateSync.ts +26 -0
  221. package/src/Auth.ts +225 -0
  222. package/src/Avatars.ts +144 -0
  223. package/src/BrowserAnalytics.ts +133 -0
  224. package/src/Chat.ts +1150 -0
  225. package/src/ChatIntegrity.ts +130 -0
  226. package/src/ChatSends.ts +209 -0
  227. package/src/Client.ts +319 -0
  228. package/src/Collab.ts +524 -0
  229. package/src/CollabTools.ts +381 -0
  230. package/src/Connections.ts +517 -0
  231. package/src/Consent.ts +176 -0
  232. package/src/Desktop.ts +139 -0
  233. package/src/Directory.ts +71 -0
  234. package/src/ErrorReporter.ts +112 -0
  235. package/src/ExpoSqlite.ts +6 -0
  236. package/src/FileSync.ts +34 -0
  237. package/src/FileTables.gen.ts +23 -0
  238. package/src/Foldkit.ts +960 -0
  239. package/src/History.ts +337 -0
  240. package/src/InboxSync.ts +47 -0
  241. package/src/KernelTables.gen.ts +329 -0
  242. package/src/Make.ts +120 -0
  243. package/src/Models.ts +134 -0
  244. package/src/Optimistic.ts +364 -0
  245. package/src/PlatformSync.ts +156 -0
  246. package/src/Poll.ts +227 -0
  247. package/src/Preferences.ts +42 -0
  248. package/src/Proposals.ts +57 -0
  249. package/src/React.ts +26 -0
  250. package/src/Reader.ts +180 -0
  251. package/src/Resources.ts +257 -0
  252. package/src/Rows.ts +16 -0
  253. package/src/Runtime.ts +1409 -0
  254. package/src/RuntimeRuns.ts +180 -0
  255. package/src/ServicesSync.ts +58 -0
  256. package/src/Session.ts +814 -0
  257. package/src/ShareGrant.ts +20 -0
  258. package/src/Sharing.ts +696 -0
  259. package/src/Skew.ts +97 -0
  260. package/src/SpacesSync.ts +61 -0
  261. package/src/Storage.ts +167 -0
  262. package/src/Sync.ts +125 -0
  263. package/src/SyncTables.ts +12 -0
  264. package/src/Tab.ts +59 -0
  265. package/src/Transport.ts +321 -0
  266. package/src/Upload.ts +125 -0
  267. package/src/WebMcp.ts +279 -0
  268. package/src/index.ts +26 -0
  269. package/src/web-globals.d.ts +103 -0
@@ -0,0 +1,496 @@
1
+ /**
2
+ * The agent from the client SDK (the AgentRuntime contract over HTTP): send a message to your agent, follow
3
+ * its run's events as they happen (server-sent events, resumable from the last sequence number seen), read the
4
+ * run, its context x-ray and its sub-agents, cancel it, make one-shot completions, and read your usage (per meter,
5
+ * grouped into insights, per run) and the budgets that apply to you. Web-standard `fetch` only, like the rest of
6
+ * the SDK.
7
+ */
8
+ import type { Attachment, BudgetPeriod, CompletionMessage, ConversationQuery, ConversationResource, GiveFeedback, EngineReadiness, ModelUsage, RunDevice, RunMode, RunEvent, ScreenSnapshot, UsageGrouping } from "@eloxiv/contracts";
9
+ export interface AgentClientOptions {
10
+ /** Kernel base URL, e.g. `http://localhost:4100`. */
11
+ readonly baseUrl: string;
12
+ /** Current bearer token; read on every call. */
13
+ readonly token?: (() => string | undefined) | undefined;
14
+ /** Organisation to act in: a fixed id, or a function read on every call. */
15
+ readonly orgId?: string | (() => string | undefined) | undefined;
16
+ readonly clientVersion?: string | undefined;
17
+ }
18
+ /** A refused or failed agent request: the HTTP status and the kernel's error (`_tag`, `message`, fields). */
19
+ export declare class AgentRequestError extends Error {
20
+ readonly name = "AgentRequestError";
21
+ readonly status: number;
22
+ readonly error: {
23
+ readonly _tag: string;
24
+ readonly [field: string]: unknown;
25
+ };
26
+ constructor(status: number, error: {
27
+ readonly _tag: string;
28
+ readonly [field: string]: unknown;
29
+ });
30
+ }
31
+ /**
32
+ * An abort signal, the part of it used here (typed here: not every platform's types have it). Pass an
33
+ * `AbortController`'s `signal`.
34
+ */
35
+ export interface AbortSignalLike {
36
+ readonly aborted: boolean;
37
+ readonly addEventListener: (type: "abort", listener: () => void, options?: {
38
+ readonly once?: boolean;
39
+ }) => void;
40
+ readonly removeEventListener: (type: "abort", listener: () => void) => void;
41
+ }
42
+ export declare const agentClient: (options: AgentClientOptions) => {
43
+ /**
44
+ * Send a message (`agent.send`): to a new conversation, or `conversationId`'s. Returns the run to follow. With
45
+ * `device`, the run executes on one of the person's paired devices (its local harness, on their own
46
+ * subscription) instead of the deployment's model; the person's consent to send the turn is asked first.
47
+ */
48
+ send: (message: {
49
+ readonly text: string;
50
+ readonly conversationId?: string;
51
+ readonly attachments?: ReadonlyArray<Attachment>;
52
+ readonly device?: RunDevice;
53
+ /** What the person is looking at (a ScreenContext snapshot: references only, after privacy rules). */
54
+ readonly screen?: ScreenSnapshot;
55
+ /** `plan`: the run reads and plans but changes nothing. Default `act`. */
56
+ readonly mode?: RunMode;
57
+ /** For a new conversation: the record it is about (a thread on that record). */
58
+ readonly resource?: ConversationResource;
59
+ /**
60
+ * Queue the message behind the conversation's active run instead of being refused: it starts when the runs
61
+ * before it end (`queued` in the answer; cancel it with `cancelQueued`), or expires after `queueTtlMs`.
62
+ */
63
+ readonly queue?: boolean;
64
+ readonly queueTtlMs?: number;
65
+ }, call?: {
66
+ readonly idempotencyKey?: string;
67
+ /** Aborting it stops waiting for the answer (the kernel may still have run it: retry under the same key). */
68
+ readonly signal?: AbortSignalLike | undefined;
69
+ }) => Promise<{
70
+ readonly conversationId: string;
71
+ readonly messageId: string;
72
+ readonly runId: string;
73
+ readonly queued?: {
74
+ readonly submissionId: string;
75
+ };
76
+ }>;
77
+ events: (runId: string, follow?: {
78
+ readonly after?: number | undefined;
79
+ readonly signal?: AbortSignalLike | undefined;
80
+ }) => AsyncGenerator<RunEvent>;
81
+ /**
82
+ * The person's send under `idempotencyKey`, if it ran: its receipt (`agent.send`'s, from the kernel's receipt
83
+ * store), or null when none has committed yet (a send still in flight commits its receipt with it).
84
+ */
85
+ sendReceipt: (idempotencyKey: string, call?: {
86
+ readonly signal?: AbortSignalLike | undefined;
87
+ }) => Promise<{
88
+ readonly receipt: unknown;
89
+ }>;
90
+ /** Follow a run to its end: every stored event in order (text deltas left out), and the finished run. */
91
+ follow: (runId: string, after?: number) => Promise<{
92
+ events: {
93
+ readonly runId: string;
94
+ readonly seq: number;
95
+ readonly type: "answer-checked" | "compacted" | "consent-decided" | "consent-required" | "delegated" | "model-step" | "processor-tripped" | "reconciled" | "reply-discarded" | "run-finished" | "run-started" | "seat-spawned" | "team-message" | "text-delta" | "tool-call" | "tool-result";
96
+ readonly data: unknown;
97
+ readonly at: string;
98
+ }[];
99
+ run: {
100
+ readonly id: string;
101
+ readonly orgId: string;
102
+ readonly userId: string;
103
+ readonly conversationId: string;
104
+ readonly parentRunId: string | null;
105
+ readonly kind: "job" | "subagent" | "turn";
106
+ readonly status: "cancelled" | "failed" | "queued" | "running" | "stopped" | "succeeded" | "waiting";
107
+ readonly stopReason: "budget" | "cancelled" | "completed" | "error" | "model-error" | "noop" | "processor" | "steps" | "tokens" | "wall-time" | null;
108
+ readonly limits: {
109
+ readonly maxSteps: number;
110
+ readonly maxTokens: number;
111
+ readonly maxWallMs: number;
112
+ };
113
+ readonly tools: readonly string[] | null;
114
+ readonly usage: {
115
+ readonly inputTokens: number;
116
+ readonly outputTokens: number;
117
+ };
118
+ readonly steps: number;
119
+ readonly result: string | null;
120
+ readonly error: string | null;
121
+ readonly mode?: "act" | "plan";
122
+ readonly continuation?: {
123
+ readonly of: string;
124
+ readonly previous: string;
125
+ readonly attempt: number;
126
+ readonly automatic: boolean;
127
+ };
128
+ readonly verification?: {
129
+ readonly outcome: "annotated" | "passed" | "retried";
130
+ readonly receipts: readonly {
131
+ readonly tool: string;
132
+ readonly receipt: {
133
+ readonly changed: boolean;
134
+ readonly verified: "unverified" | boolean;
135
+ readonly summary: string;
136
+ readonly subject?: string;
137
+ readonly checks?: readonly {
138
+ readonly id: string;
139
+ readonly ok: boolean;
140
+ readonly detail?: string;
141
+ }[];
142
+ readonly warnings?: readonly string[];
143
+ };
144
+ }[];
145
+ readonly challengedBy?: readonly string[];
146
+ } | null;
147
+ readonly activity?: {
148
+ readonly lastEventAt: string | null;
149
+ readonly stalled: boolean;
150
+ };
151
+ };
152
+ }>;
153
+ run: (runId: string) => Promise<{
154
+ readonly id: string;
155
+ readonly orgId: string;
156
+ readonly userId: string;
157
+ readonly conversationId: string;
158
+ readonly parentRunId: string | null;
159
+ readonly kind: "job" | "subagent" | "turn";
160
+ readonly status: "cancelled" | "failed" | "queued" | "running" | "stopped" | "succeeded" | "waiting";
161
+ readonly stopReason: "budget" | "cancelled" | "completed" | "error" | "model-error" | "noop" | "processor" | "steps" | "tokens" | "wall-time" | null;
162
+ readonly limits: {
163
+ readonly maxSteps: number;
164
+ readonly maxTokens: number;
165
+ readonly maxWallMs: number;
166
+ };
167
+ readonly tools: readonly string[] | null;
168
+ readonly usage: {
169
+ readonly inputTokens: number;
170
+ readonly outputTokens: number;
171
+ };
172
+ readonly steps: number;
173
+ readonly result: string | null;
174
+ readonly error: string | null;
175
+ readonly mode?: "act" | "plan";
176
+ readonly continuation?: {
177
+ readonly of: string;
178
+ readonly previous: string;
179
+ readonly attempt: number;
180
+ readonly automatic: boolean;
181
+ };
182
+ readonly verification?: {
183
+ readonly outcome: "annotated" | "passed" | "retried";
184
+ readonly receipts: readonly {
185
+ readonly tool: string;
186
+ readonly receipt: {
187
+ readonly changed: boolean;
188
+ readonly verified: "unverified" | boolean;
189
+ readonly summary: string;
190
+ readonly subject?: string;
191
+ readonly checks?: readonly {
192
+ readonly id: string;
193
+ readonly ok: boolean;
194
+ readonly detail?: string;
195
+ }[];
196
+ readonly warnings?: readonly string[];
197
+ };
198
+ }[];
199
+ readonly challengedBy?: readonly string[];
200
+ } | null;
201
+ readonly activity?: {
202
+ readonly lastEventAt: string | null;
203
+ readonly stalled: boolean;
204
+ };
205
+ }>;
206
+ /** The context x-ray of one model call of the run (default the latest). */
207
+ context: (runId: string, step?: number) => Promise<{
208
+ readonly runId: string;
209
+ readonly step: number;
210
+ readonly items: readonly {
211
+ readonly ref: string;
212
+ readonly category: "instructions" | "memory" | "messages" | "skills" | "tool-results" | "tools";
213
+ readonly tokens: number;
214
+ readonly pinned: boolean;
215
+ readonly source: unknown;
216
+ }[];
217
+ readonly totals: {
218
+ readonly [x: string]: number;
219
+ };
220
+ readonly budgets: {
221
+ readonly [x: string]: number;
222
+ };
223
+ readonly total: number;
224
+ readonly evicted: readonly {
225
+ readonly ref: string;
226
+ readonly category: "instructions" | "memory" | "messages" | "skills" | "tool-results" | "tools";
227
+ readonly tokens: number;
228
+ readonly reason: "budget" | "directive";
229
+ }[];
230
+ }>;
231
+ children: (runId: string) => Promise<readonly {
232
+ readonly id: string;
233
+ readonly orgId: string;
234
+ readonly userId: string;
235
+ readonly conversationId: string;
236
+ readonly parentRunId: string | null;
237
+ readonly kind: "job" | "subagent" | "turn";
238
+ readonly status: "cancelled" | "failed" | "queued" | "running" | "stopped" | "succeeded" | "waiting";
239
+ readonly stopReason: "budget" | "cancelled" | "completed" | "error" | "model-error" | "noop" | "processor" | "steps" | "tokens" | "wall-time" | null;
240
+ readonly limits: {
241
+ readonly maxSteps: number;
242
+ readonly maxTokens: number;
243
+ readonly maxWallMs: number;
244
+ };
245
+ readonly tools: readonly string[] | null;
246
+ readonly usage: {
247
+ readonly inputTokens: number;
248
+ readonly outputTokens: number;
249
+ };
250
+ readonly steps: number;
251
+ readonly result: string | null;
252
+ readonly error: string | null;
253
+ readonly mode?: "act" | "plan";
254
+ readonly continuation?: {
255
+ readonly of: string;
256
+ readonly previous: string;
257
+ readonly attempt: number;
258
+ readonly automatic: boolean;
259
+ };
260
+ readonly verification?: {
261
+ readonly outcome: "annotated" | "passed" | "retried";
262
+ readonly receipts: readonly {
263
+ readonly tool: string;
264
+ readonly receipt: {
265
+ readonly changed: boolean;
266
+ readonly verified: "unverified" | boolean;
267
+ readonly summary: string;
268
+ readonly subject?: string;
269
+ readonly checks?: readonly {
270
+ readonly id: string;
271
+ readonly ok: boolean;
272
+ readonly detail?: string;
273
+ }[];
274
+ readonly warnings?: readonly string[];
275
+ };
276
+ }[];
277
+ readonly challengedBy?: readonly string[];
278
+ } | null;
279
+ readonly activity?: {
280
+ readonly lastEventAt: string | null;
281
+ readonly stalled: boolean;
282
+ };
283
+ }[]>;
284
+ /**
285
+ * A page of the person's conversations, newest first: `q` searches titles and messages; `archived`, `hidden`
286
+ * and `pinned` select; `before` is the previous page's `next`. Invalid arguments are refused (`InvalidInput`).
287
+ */
288
+ conversations: (query?: ConversationQuery) => Promise<{
289
+ readonly conversations: readonly {
290
+ readonly id: string;
291
+ readonly title: string;
292
+ readonly pinned: boolean;
293
+ readonly archived: boolean;
294
+ readonly hidden: boolean;
295
+ readonly createdAt: string;
296
+ readonly updatedAt: string;
297
+ readonly resource?: {
298
+ readonly module: string;
299
+ readonly entity: string;
300
+ readonly id: string;
301
+ } | null;
302
+ }[];
303
+ readonly next: string | null;
304
+ }>;
305
+ /** Rename, pin, archive or hide one of the person's conversations (`agent.updateConversation`). */
306
+ updateConversation: (update: {
307
+ readonly conversationId: string;
308
+ readonly title?: string;
309
+ readonly pinned?: boolean;
310
+ readonly archived?: boolean;
311
+ readonly hidden?: boolean;
312
+ }) => Promise<unknown>;
313
+ /** The person's active runs (queued, running, waiting), oldest first, each with its activity (`stalled`). */
314
+ active: () => Promise<readonly {
315
+ readonly id: string;
316
+ readonly orgId: string;
317
+ readonly userId: string;
318
+ readonly conversationId: string;
319
+ readonly parentRunId: string | null;
320
+ readonly kind: "job" | "subagent" | "turn";
321
+ readonly status: "cancelled" | "failed" | "queued" | "running" | "stopped" | "succeeded" | "waiting";
322
+ readonly stopReason: "budget" | "cancelled" | "completed" | "error" | "model-error" | "noop" | "processor" | "steps" | "tokens" | "wall-time" | null;
323
+ readonly limits: {
324
+ readonly maxSteps: number;
325
+ readonly maxTokens: number;
326
+ readonly maxWallMs: number;
327
+ };
328
+ readonly tools: readonly string[] | null;
329
+ readonly usage: {
330
+ readonly inputTokens: number;
331
+ readonly outputTokens: number;
332
+ };
333
+ readonly steps: number;
334
+ readonly result: string | null;
335
+ readonly error: string | null;
336
+ readonly mode?: "act" | "plan";
337
+ readonly continuation?: {
338
+ readonly of: string;
339
+ readonly previous: string;
340
+ readonly attempt: number;
341
+ readonly automatic: boolean;
342
+ };
343
+ readonly verification?: {
344
+ readonly outcome: "annotated" | "passed" | "retried";
345
+ readonly receipts: readonly {
346
+ readonly tool: string;
347
+ readonly receipt: {
348
+ readonly changed: boolean;
349
+ readonly verified: "unverified" | boolean;
350
+ readonly summary: string;
351
+ readonly subject?: string;
352
+ readonly checks?: readonly {
353
+ readonly id: string;
354
+ readonly ok: boolean;
355
+ readonly detail?: string;
356
+ }[];
357
+ readonly warnings?: readonly string[];
358
+ };
359
+ }[];
360
+ readonly challengedBy?: readonly string[];
361
+ } | null;
362
+ readonly activity?: {
363
+ readonly lastEventAt: string | null;
364
+ readonly stalled: boolean;
365
+ };
366
+ }[]>;
367
+ /**
368
+ * Continue a turn the agent did not finish (`agent.continue`): a new run takes up the same request where the run
369
+ * `runId` (stopped, failed or cancelled) left it. Returns the new run.
370
+ */
371
+ continueTurn: (runId: string) => Promise<{
372
+ readonly kind: string;
373
+ readonly output: {
374
+ readonly id: string;
375
+ readonly conversationId: string;
376
+ };
377
+ }>;
378
+ /** Cancel a queued message that has not started (`agent.cancelQueued`). */
379
+ cancelQueued: (submissionId: string) => Promise<unknown>;
380
+ /** Cancel a run (`agent.cancel`). */
381
+ cancel: (runId: string) => Promise<unknown>;
382
+ /** A one-shot completion (text, or an object matching `schema`). */
383
+ complete: (completion: {
384
+ readonly messages: ReadonlyArray<CompletionMessage>;
385
+ readonly schema?: unknown;
386
+ /** The most the completion may write (at most the deployment's limit). */
387
+ readonly maxOutputTokens?: number;
388
+ }) => Promise<{
389
+ readonly text: string;
390
+ readonly object?: unknown;
391
+ readonly usage: ModelUsage;
392
+ }>;
393
+ /** Usage per meter in the period: yours, or the organisation's (`scope: "org"`, for those who manage the agent). */
394
+ usage: (query?: {
395
+ readonly scope?: "user" | "org";
396
+ readonly period?: BudgetPeriod;
397
+ }) => Promise<Readonly<Record<string, number>>>;
398
+ /** Usage grouped by model, day, run or member (the organisation's only), largest cost first. */
399
+ insights: (query: {
400
+ readonly by: UsageGrouping;
401
+ readonly scope?: "user" | "org";
402
+ readonly period?: BudgetPeriod;
403
+ }) => Promise<{
404
+ readonly scope: "org" | "user";
405
+ readonly period: "day" | "month" | "total";
406
+ readonly by: "day" | "member" | "model" | "run";
407
+ readonly rows: readonly {
408
+ readonly key: string;
409
+ readonly calls: number;
410
+ readonly inputTokens: number;
411
+ readonly outputTokens: number;
412
+ readonly costMicros: number;
413
+ }[];
414
+ }>;
415
+ /** One of your runs' stored trace: its model and tool calls as spans, and your feedback on it. */
416
+ trace: (runId: string) => Promise<{
417
+ readonly runId: string;
418
+ readonly status: string;
419
+ readonly spans: readonly {
420
+ readonly kind: "model" | "tool";
421
+ readonly step: number;
422
+ readonly name: string;
423
+ readonly startedAt: string;
424
+ readonly finishedAt: string | null;
425
+ readonly durationMs: number | null;
426
+ readonly ok: boolean;
427
+ readonly errorTag: string | null;
428
+ readonly inputTokens: number | null;
429
+ readonly outputTokens: number | null;
430
+ }[];
431
+ readonly feedback: {
432
+ readonly rating: "down" | "up";
433
+ readonly comment: string | null;
434
+ } | null;
435
+ }>;
436
+ /** Rate one of your runs (`agent.feedback`): up or down, with an optional comment and tags. */
437
+ feedback: (feedback: GiveFeedback) => Promise<unknown>;
438
+ /** Feedback on runs: yours, or the organisation's (`scope: "org"`, for those who manage the agent). */
439
+ feedbackList: (query?: {
440
+ readonly scope?: "user" | "org";
441
+ readonly period?: BudgetPeriod;
442
+ }) => Promise<{
443
+ readonly scope: "org" | "user";
444
+ readonly period: "day" | "month" | "total";
445
+ readonly up: number;
446
+ readonly down: number;
447
+ readonly entries: readonly {
448
+ readonly runId: string;
449
+ readonly userId: string;
450
+ readonly rating: "down" | "up";
451
+ readonly comment: string | null;
452
+ readonly tags: readonly string[];
453
+ readonly at: string;
454
+ }[];
455
+ }>;
456
+ /** One of your runs' usage per metered call. */
457
+ runUsage: (runId: string) => Promise<{
458
+ readonly runId: string;
459
+ readonly calls: readonly {
460
+ readonly step: number | null;
461
+ readonly kind: string | null;
462
+ readonly provider: string;
463
+ readonly model: string;
464
+ readonly inputTokens: number;
465
+ readonly outputTokens: number;
466
+ readonly costMicros: number;
467
+ readonly estimated: boolean;
468
+ readonly at: string;
469
+ }[];
470
+ readonly inputTokens: number;
471
+ readonly outputTokens: number;
472
+ readonly costMicros: number;
473
+ }>;
474
+ /** The budgets that apply to you (with their alert thresholds). */
475
+ budgets: () => Promise<readonly {
476
+ readonly id: string;
477
+ readonly orgId: string;
478
+ readonly scope: "org" | "user";
479
+ readonly userId: string | null;
480
+ readonly meter: "agent.cost" | "agent.tokens";
481
+ readonly period: "day" | "month" | "total";
482
+ readonly limit: number;
483
+ readonly alertAt?: number | null;
484
+ }[]>;
485
+ /**
486
+ * Whether the person's agent can answer on the organisation's model (AgentRuntime `readiness`): the kernel's
487
+ * `configured`, `missing` or `unavailable`. A request that gets no answer, or an answer that is not the kernel's
488
+ * (a gateway's error, a body it does not recognise), is `unknown`: a failed probe is never taken for a missing
489
+ * setup. A refusal of the caller (401, 403) throws `AgentRequestError`, as every request does.
490
+ */
491
+ readiness: (options?: {
492
+ readonly signal?: AbortSignalLike;
493
+ }) => Promise<EngineReadiness>;
494
+ };
495
+ export type AgentClient = ReturnType<typeof agentClient>;
496
+ //# sourceMappingURL=Agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,UAAU,EAEV,YAAY,EACZ,iBAAiB,EAEjB,iBAAiB,EACjB,oBAAoB,EAEpB,YAAY,EAEZ,eAAe,EACf,UAAU,EAEV,SAAS,EACT,OAAO,EACP,QAAQ,EAGR,cAAc,EAEd,aAAa,EAEd,MAAM,mBAAmB,CAAA;AAG1B,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAA;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CA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