@sylphx/sdk 0.32.0 → 0.32.2

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 (127) hide show
  1. package/README.md +125 -0
  2. package/dist/access.d.ts +50 -1
  3. package/dist/access.js +14 -2
  4. package/dist/access.js.map +1 -1
  5. package/dist/agents.d.ts +2002 -0
  6. package/dist/agents.js +1367 -0
  7. package/dist/agents.js.map +1 -0
  8. package/dist/ai.js +1 -1
  9. package/dist/ai.js.map +1 -1
  10. package/dist/analytics.d.ts +232 -0
  11. package/dist/analytics.js +126 -0
  12. package/dist/analytics.js.map +1 -0
  13. package/dist/artifacts.d.ts +47 -1
  14. package/dist/artifacts.js +30 -2
  15. package/dist/artifacts.js.map +1 -1
  16. package/dist/assets.js +1 -1
  17. package/dist/assets.js.map +1 -1
  18. package/dist/auth/client.d.ts +34 -3
  19. package/dist/auth/client.js +42 -5
  20. package/dist/auth/client.js.map +1 -1
  21. package/dist/auth/continue-mock.d.ts +21 -0
  22. package/dist/auth/continue-mock.js +75 -0
  23. package/dist/auth/continue-mock.js.map +1 -0
  24. package/dist/auth/end-user-keys-mock.d.ts +83 -0
  25. package/dist/auth/end-user-keys-mock.js +427 -0
  26. package/dist/auth/end-user-keys-mock.js.map +1 -0
  27. package/dist/auth/end-user-keys.d.ts +219 -0
  28. package/dist/auth/end-user-keys.js +240 -0
  29. package/dist/auth/end-user-keys.js.map +1 -0
  30. package/dist/auth/verify.js +1 -1
  31. package/dist/auth/verify.js.map +1 -1
  32. package/dist/auth.d.ts +370 -2
  33. package/dist/auth.js +282 -2
  34. package/dist/auth.js.map +1 -1
  35. package/dist/billing.d.ts +96 -11
  36. package/dist/billing.js +41 -1
  37. package/dist/billing.js.map +1 -1
  38. package/dist/broker.d.ts +165 -33
  39. package/dist/broker.js +103 -7
  40. package/dist/broker.js.map +1 -1
  41. package/dist/browser-upload.d.ts +101 -0
  42. package/dist/browser-upload.js +130 -0
  43. package/dist/browser-upload.js.map +1 -0
  44. package/dist/build.d.ts +361 -28
  45. package/dist/build.js +302 -10
  46. package/dist/build.js.map +1 -1
  47. package/dist/common.d.ts +1 -1
  48. package/dist/common.js +1 -1
  49. package/dist/common.js.map +1 -1
  50. package/dist/config/flags.d.ts +12 -2
  51. package/dist/config/flags.js +54 -6
  52. package/dist/config/flags.js.map +1 -1
  53. package/dist/config.d.ts +24 -0
  54. package/dist/config.js +22 -1
  55. package/dist/config.js.map +1 -1
  56. package/dist/connections.d.ts +128 -25
  57. package/dist/connections.js +72 -25
  58. package/dist/connections.js.map +1 -1
  59. package/dist/data.d.ts +358 -13
  60. package/dist/data.js +166 -9
  61. package/dist/data.js.map +1 -1
  62. package/dist/entitlement.js +1 -1
  63. package/dist/entitlement.js.map +1 -1
  64. package/dist/events/realtime.js +1 -1
  65. package/dist/events/realtime.js.map +1 -1
  66. package/dist/events/webhooks.js +1 -1
  67. package/dist/events/webhooks.js.map +1 -1
  68. package/dist/events.d.ts +36 -0
  69. package/dist/events.js +29 -1
  70. package/dist/events.js.map +1 -1
  71. package/dist/flags.d.ts +20 -0
  72. package/dist/flags.js +48 -0
  73. package/dist/flags.js.map +1 -0
  74. package/dist/hosting.js +1 -1
  75. package/dist/hosting.js.map +1 -1
  76. package/dist/ids.d.ts +192 -2
  77. package/dist/ids.js +40 -2
  78. package/dist/ids.js.map +1 -1
  79. package/dist/index.d.ts +18 -1
  80. package/dist/index.js +32 -2
  81. package/dist/index.js.map +1 -1
  82. package/dist/keys.js +1 -1
  83. package/dist/keys.js.map +1 -1
  84. package/dist/knowledge.d.ts +1215 -0
  85. package/dist/knowledge.js +1012 -0
  86. package/dist/knowledge.js.map +1 -0
  87. package/dist/localization.js +1 -1
  88. package/dist/localization.js.map +1 -1
  89. package/dist/methods.js +1938 -15
  90. package/dist/methods.js.map +1 -1
  91. package/dist/money.d.ts +1989 -53
  92. package/dist/money.js +1401 -19
  93. package/dist/money.js.map +1 -1
  94. package/dist/network.js +1 -1
  95. package/dist/network.js.map +1 -1
  96. package/dist/notify.d.ts +686 -1
  97. package/dist/notify.js +552 -1
  98. package/dist/notify.js.map +1 -1
  99. package/dist/observability.d.ts +138 -0
  100. package/dist/observability.js +89 -1
  101. package/dist/observability.js.map +1 -1
  102. package/dist/realtime.d.ts +404 -0
  103. package/dist/realtime.js +312 -0
  104. package/dist/realtime.js.map +1 -0
  105. package/dist/release.js +1 -1
  106. package/dist/release.js.map +1 -1
  107. package/dist/runners.js +1 -1
  108. package/dist/runners.js.map +1 -1
  109. package/dist/runtime.d.ts +3 -0
  110. package/dist/runtime.js +54 -1
  111. package/dist/runtime.js.map +1 -1
  112. package/dist/sandboxes/stream-mock.d.ts +124 -0
  113. package/dist/sandboxes/stream-mock.js +476 -0
  114. package/dist/sandboxes/stream-mock.js.map +1 -0
  115. package/dist/sandboxes/stream.d.ts +407 -0
  116. package/dist/sandboxes/stream.js +335 -0
  117. package/dist/sandboxes/stream.js.map +1 -0
  118. package/dist/sandboxes.d.ts +94 -17
  119. package/dist/sandboxes.js +33 -4
  120. package/dist/sandboxes.js.map +1 -1
  121. package/dist/secrets.d.ts +336 -0
  122. package/dist/secrets.js +268 -1
  123. package/dist/secrets.js.map +1 -1
  124. package/dist/workflows.d.ts +119 -3
  125. package/dist/workflows.js +144 -4
  126. package/dist/workflows.js.map +1 -1
  127. package/package.json +2 -2
@@ -0,0 +1,404 @@
1
+ import * as runtime from './runtime.js';
2
+ /** The request of BindSubscription. */
3
+ export interface BindSubscriptionRequest {
4
+ /** The Events Subscription's resource name. */
5
+ subscription: string;
6
+ /** The channel its events are published to, `namespace:name`. */
7
+ channel: string;
8
+ }
9
+ /** The response of BindSubscription. */
10
+ export interface BindSubscriptionResponse {
11
+ /** The Subscription bound. */
12
+ subscription?: string;
13
+ /** The channel it feeds. */
14
+ channel?: string;
15
+ }
16
+ /** ChannelGrant is the capabilities a token grants on one channel pattern. */
17
+ export interface ChannelGrant {
18
+ /**
19
+ * A channel name or pattern: `room:42`, or `room:*` for every channel of the
20
+ * namespace. `*` is allowed only as the whole name part, and never in the
21
+ * namespace part.
22
+ */
23
+ pattern?: string;
24
+ /** The capabilities granted. At least one. */
25
+ capabilities?: Capability[];
26
+ }
27
+ /** The request of DeleteNamespace. */
28
+ export interface DeleteNamespaceRequest {
29
+ /** The namespace name. */
30
+ name: string;
31
+ }
32
+ /** The response of DeleteNamespace. */
33
+ export interface DeleteNamespaceResponse {
34
+ }
35
+ /** The request of GetNamespace. */
36
+ export interface GetNamespaceRequest {
37
+ /** The namespace name. */
38
+ name: string;
39
+ }
40
+ /** The request of IssueToken. */
41
+ export interface IssueTokenRequest {
42
+ /** Which kind of token to mint. */
43
+ kind: TokenKind;
44
+ /** The end user's id. Required for a connection token. */
45
+ user?: string;
46
+ /**
47
+ * The channels and capabilities to grant. A channel token takes exactly one
48
+ * grant whose pattern has no `*`. At most 64 grants.
49
+ */
50
+ grants: ChannelGrant[];
51
+ /** How long the token lives; 1 minute to 24 hours, default 1 hour. */
52
+ ttl?: string;
53
+ }
54
+ /** The response of IssueToken. */
55
+ export interface IssueTokenResponse {
56
+ /**
57
+ * The token. Opaque; sent in the `connect` frame or the `Authorization`
58
+ * header, never in a URL.
59
+ */
60
+ token?: string;
61
+ /** When it expires. */
62
+ expireTime?: string;
63
+ /** The claims the service put in it, for the caller to log or check. */
64
+ claims?: TokenClaims;
65
+ /**
66
+ * The realtime host the client connects to. Never hard-code it: it can
67
+ * change, with no port, and the protocol-v1 paths are fixed.
68
+ */
69
+ connectUri?: string;
70
+ /**
71
+ * The earliest the client should ask for a replacement: the in-band
72
+ * `refresh_required` frame arrives at this time.
73
+ */
74
+ refreshTime?: string;
75
+ }
76
+ /** The request of ListMessages. */
77
+ export interface ListMessagesRequest {
78
+ /** The channel, `namespace:name`. */
79
+ channel: string;
80
+ /**
81
+ * Return messages after this cursor. Empty starts at the oldest kept
82
+ * message.
83
+ */
84
+ cursor?: string;
85
+ /** At most this many messages; default 100, at most 1,000. */
86
+ pageSize?: number;
87
+ /**
88
+ * When no message is after the cursor, wait up to this many seconds for
89
+ * one; 0 to 30, default 0 (answer at once).
90
+ */
91
+ waitSeconds?: number;
92
+ }
93
+ /** The response of ListMessages. */
94
+ export interface ListMessagesResponse {
95
+ /** The messages, oldest first. Empty when the wait ran out. */
96
+ messages?: Message[];
97
+ /**
98
+ * The cursor to pass as `cursor` next. Always set unless the
99
+ * namespace is ephemeral.
100
+ */
101
+ nextCursor?: string;
102
+ }
103
+ /** The request of ListNamespaces. */
104
+ export interface ListNamespacesRequest {
105
+ /** At most this many namespaces; the service caps it. */
106
+ pageSize?: number;
107
+ /** The `next_page_token` of the previous page. */
108
+ pageToken?: string;
109
+ }
110
+ /** The response of ListNamespaces. */
111
+ export interface ListNamespacesResponse {
112
+ /** The page of namespaces. */
113
+ namespaces?: Namespace[];
114
+ /** Empty on the last page. */
115
+ nextPageToken?: string;
116
+ }
117
+ /** The request of ListPresence. */
118
+ export interface ListPresenceRequest {
119
+ /** The channel, `namespace:name`. */
120
+ channel: string;
121
+ /** At most this many members; default 100, at most 1,000. */
122
+ pageSize?: number;
123
+ /** The `next_page_token` of the previous page. */
124
+ pageToken?: string;
125
+ }
126
+ /** The response of ListPresence. */
127
+ export interface ListPresenceResponse {
128
+ /** The members present. */
129
+ members?: Member[];
130
+ /** Empty on the last page. */
131
+ nextPageToken?: string;
132
+ }
133
+ /** Member is one connection present on a channel. */
134
+ export interface Member {
135
+ /** The user id from the token. */
136
+ user?: string;
137
+ /** The connection id, unique while the connection lives. */
138
+ connectionId?: string;
139
+ /** The application's presence data, at most 4 KiB encoded. */
140
+ data?: unknown;
141
+ /** When this connection entered. */
142
+ enterTime?: string;
143
+ }
144
+ /** Message is one message of a channel. */
145
+ export interface Message {
146
+ /** The channel, `namespace:name`. */
147
+ channel?: string;
148
+ /**
149
+ * The message's cursor: opaque, ordered within the channel, and the value
150
+ * to resume from. Empty in an ephemeral namespace.
151
+ */
152
+ cursor?: string;
153
+ /** The application's event name, for example `move`. 1 to 64 characters. */
154
+ event?: string;
155
+ /** The JSON payload, at most 64 KiB encoded. */
156
+ data?: unknown;
157
+ /** The user id of the publisher; empty when a server published without one. */
158
+ publisher?: string;
159
+ /** When the service accepted the message. */
160
+ publishTime?: string;
161
+ }
162
+ /**
163
+ * Namespace is the only configured object of Sylphx Realtime. It carries the
164
+ * rules of every channel named `<namespace>:<name>`. Channels are implicit:
165
+ * they exist from their first publish or subscribe and are never created.
166
+ * Declared in `sylphx.toml` as `[realtime.namespaces.<name>]`.
167
+ */
168
+ export interface Namespace {
169
+ /**
170
+ * The namespace name: 1 to 32 characters of `a-z`, `0-9`, `-` and `_`,
171
+ * starting with a letter. It is the part of a channel before the first
172
+ * colon, and never changes.
173
+ */
174
+ name?: string;
175
+ /** How much history channels keep. Default NONE. */
176
+ history?: HistoryPreset;
177
+ /** Whether channels track who is present. Default off. */
178
+ presence?: boolean;
179
+ /**
180
+ * Whether a client holding a token with the publish capability may publish.
181
+ * Default off: only servers publish.
182
+ */
183
+ clientPublish?: boolean;
184
+ /** When the namespace was created. */
185
+ readonly createTime?: string;
186
+ /** When the rules last changed. */
187
+ readonly updateTime?: string;
188
+ }
189
+ /** The request of Publish. */
190
+ export interface PublishRequest {
191
+ /**
192
+ * The channel, `namespace:name`: the name is 1 to 128 characters of
193
+ * `a-z A-Z 0-9 - _ . =` and no `*`.
194
+ */
195
+ channel: string;
196
+ /** The application's event name, 1 to 64 characters. */
197
+ event: string;
198
+ /** The JSON payload, at most 64 KiB encoded. */
199
+ data?: unknown;
200
+ }
201
+ /** The response of Publish. */
202
+ export interface PublishResponse {
203
+ /** The published message; its cursor is empty in an ephemeral namespace. */
204
+ message?: Message;
205
+ }
206
+ /** The request of PutNamespace. */
207
+ export interface PutNamespaceRequest {
208
+ /** The namespace name; see Namespace.name. */
209
+ name: string;
210
+ /** How much history channels keep. */
211
+ history?: HistoryPreset;
212
+ /** Whether channels track presence. */
213
+ presence?: boolean;
214
+ /** Whether clients may publish. */
215
+ clientPublish?: boolean;
216
+ }
217
+ /**
218
+ * TokenClaims are the claims every Sylphx Realtime token carries. A token is
219
+ * opaque to SDK users; this message states what the service puts in it and
220
+ * what it checks.
221
+ */
222
+ export interface TokenClaims {
223
+ /** The token's kind. */
224
+ kind?: TokenKind;
225
+ /**
226
+ * The authoritative Access environment id, not a client-supplied value.
227
+ * Valid only within the organization, project and cell below.
228
+ */
229
+ environment?: string;
230
+ /**
231
+ * The end user's id (`sub`). Required for a connection token; it is the
232
+ * user shown in presence.
233
+ */
234
+ user?: string;
235
+ /**
236
+ * The channels the holder may use. A connection token holds the grants of
237
+ * every channel its connection may touch; a channel token holds exactly one.
238
+ */
239
+ grants?: ChannelGrant[];
240
+ /** When the token was issued. */
241
+ issueTime?: string;
242
+ /**
243
+ * When the token expires. Between issue time plus 1 minute and 24 hours.
244
+ * The service closes a connection whose token has expired and was not
245
+ * refreshed.
246
+ */
247
+ expireTime?: string;
248
+ /** A unique id; the service can revoke a token by it until it expires. */
249
+ tokenId?: string;
250
+ /**
251
+ * The issuing Access key id (not its secret). Required: the service rechecks
252
+ * its freshness, expiry, revocation and token-issuing authority through the
253
+ * Access verifier at admission, refresh and while the connection is open.
254
+ */
255
+ issuerKeyId?: string;
256
+ /** The authoritative Access organization id of the issuing tenant. Required. */
257
+ organization?: string;
258
+ /** The authoritative Access project id of the issuing tenant. Required. */
259
+ project?: string;
260
+ /** The authoritative Access cell id of the issuing tenant. Required. */
261
+ cell?: string;
262
+ }
263
+ /** Capability is one thing a token lets its holder do on a channel pattern. */
264
+ export type Capability = 'subscribe' | 'publish' | 'presence' | (string & {});
265
+ /**
266
+ * HistoryPreset is how much of a channel's past a namespace keeps. Longer
267
+ * retention is not a realtime feature: route the channel's messages to an
268
+ * Events topic.
269
+ */
270
+ export type HistoryPreset = 'none' | 'short' | 'standard' | (string & {});
271
+ /** TokenKind says what a token connects. */
272
+ export type TokenKind = 'connection' | 'channel' | (string & {});
273
+ /**
274
+ * ChannelService is the Channel API of Sylphx Realtime: the server side that
275
+ * configures namespaces, publishes, reads history, lists presence, and mints
276
+ * the tokens clients connect with. It is served by the Events service at the
277
+ * Realtime origin, not by the Resource API, and is called with the
278
+ * environment's secret key (`SYLPHX_API_KEY`); the key's org, project and
279
+ * environment are the tenant. Clients connect with a token over the Sylphx
280
+ * channel protocol v1 (`protocol.proto`).
281
+ *
282
+ * The same calls become MCP tools. An agent cannot hold a socket, so
283
+ * ListMessages with `wait_seconds` is its subscribe.
284
+ *
285
+ * Namespace of Sylphx Realtime on `Sylphx`.
286
+ */
287
+ export declare class RealtimeApi {
288
+ /** The `namespaces` collection. */
289
+ readonly namespaces: NamespacesCollection;
290
+ /** The `channels` collection. */
291
+ readonly channels: ChannelsCollection;
292
+ /** The `tokens` collection. */
293
+ readonly tokens: TokensCollection;
294
+ /** The `bindings` collection. */
295
+ readonly bindings: BindingsCollection;
296
+ constructor(client: runtime.Client);
297
+ }
298
+ /** `namespaces` of Sylphx Realtime: served at `https://api.realtime.sylphx.com`. */
299
+ export declare class NamespacesCollection {
300
+ private readonly client;
301
+ constructor(client: runtime.Client);
302
+ /**
303
+ * Creates or replaces a namespace's rules. Existing channels follow the new
304
+ * rules from their next message; shortening history trims at the next
305
+ * publish.
306
+ *
307
+ * `PUT /v1/namespaces/{name}` · permission `realtime:write` · effect `write`
308
+ *
309
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PLAN_LIMIT_REACHED`.
310
+ */
311
+ put(request: PutNamespaceRequest): Promise<Namespace>;
312
+ /**
313
+ * Reads a namespace.
314
+ *
315
+ * `GET /v1/namespaces/{name}` · permission `realtime:read` · effect `read`
316
+ *
317
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
318
+ */
319
+ get(request: GetNamespaceRequest): Promise<Namespace>;
320
+ /**
321
+ * Lists the environment's namespaces.
322
+ *
323
+ * `GET /v1/namespaces` · permission `realtime:read` · effect `read`
324
+ *
325
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`.
326
+ */
327
+ list(request: ListNamespacesRequest): Promise<ListNamespacesResponse>;
328
+ /**
329
+ * Deletes a namespace, its channels' history and presence, and closes the
330
+ * subscriptions on them.
331
+ *
332
+ * `DELETE /v1/namespaces/{name}` · permission `realtime:write` · effect `destructive`
333
+ *
334
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
335
+ */
336
+ delete(request: DeleteNamespaceRequest): Promise<DeleteNamespaceResponse>;
337
+ }
338
+ /** `channels` of Sylphx Realtime: served at `https://api.realtime.sylphx.com`. */
339
+ export declare class ChannelsCollection {
340
+ private readonly client;
341
+ constructor(client: runtime.Client);
342
+ /**
343
+ * Publishes a message to a channel. The namespace must exist. The server
344
+ * publishes regardless of `client_publish`. A repeated Sylphx-Effect-Id
345
+ * publishes once.
346
+ *
347
+ * `POST /v1/channels:publish` · permission `realtime:publish` · effect `write`
348
+ *
349
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`.
350
+ */
351
+ publish(request: PublishRequest): Promise<PublishResponse>;
352
+ /**
353
+ * Lists a channel's messages after a cursor, oldest first. With
354
+ * `wait_seconds`, an empty result waits up to that long for the first new
355
+ * message and answers as soon as one arrives: this is how an agent
356
+ * subscribes.
357
+ *
358
+ * `GET /v1/channels/{channel}/messages` · permission `realtime:read` · effect `read`
359
+ *
360
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`.
361
+ */
362
+ history(request: ListMessagesRequest): Promise<ListMessagesResponse>;
363
+ /**
364
+ * Lists who is present on a channel.
365
+ *
366
+ * `GET /v1/channels/{channel}/presence` · permission `realtime:read` · effect `read`
367
+ *
368
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`.
369
+ */
370
+ presence(request: ListPresenceRequest): Promise<ListPresenceResponse>;
371
+ }
372
+ /** `tokens` of Sylphx Realtime: served at `https://api.realtime.sylphx.com`. */
373
+ export declare class TokensCollection {
374
+ private readonly client;
375
+ constructor(client: runtime.Client);
376
+ /**
377
+ * Mints a connection or channel token for an end user. The customer's
378
+ * server calls it with the secret key after authenticating the user, and
379
+ * hands the token to the client.
380
+ *
381
+ * `POST /v1/tokens:issue` · permission `realtime:token` · effect `write`
382
+ *
383
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`.
384
+ */
385
+ issue(request: IssueTokenRequest): Promise<IssueTokenResponse>;
386
+ }
387
+ /** `bindings` of Sylphx Realtime: served at `https://api.realtime.sylphx.com`. */
388
+ export declare class BindingsCollection {
389
+ private readonly client;
390
+ constructor(client: runtime.Client);
391
+ /**
392
+ * Binds a bus Subscription's matching events to a channel: each event the
393
+ * Subscription matches is published to the channel, with the event's
394
+ * CloudEvents `type` as the message event and its `data` as the payload. The
395
+ * Subscription itself is an Events Resource (`sylphx.events.v1`); this call
396
+ * only names the channel it feeds, and replaces the Subscription's earlier
397
+ * binding.
398
+ *
399
+ * `POST /v1/subscription-bindings` · permission `realtime:write` · effect `write`
400
+ *
401
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`.
402
+ */
403
+ create(request: BindSubscriptionRequest): Promise<BindSubscriptionResponse>;
404
+ }