@b3os/sdk 0.2.0 → 0.2.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 (152) hide show
  1. package/dist/cjs/core/sse.d.ts +2 -0
  2. package/dist/cjs/core/sse.js +17 -5
  3. package/dist/cjs/core/sse.js.map +1 -1
  4. package/dist/cjs/core/util.d.ts +1 -1
  5. package/dist/cjs/core/util.js +1 -1
  6. package/dist/cjs/generated/client.d.ts +13 -0
  7. package/dist/cjs/generated/client.js +25 -0
  8. package/dist/cjs/generated/client.js.map +1 -1
  9. package/dist/cjs/generated/errors.d.ts +1 -1
  10. package/dist/cjs/generated/errors.js +95 -0
  11. package/dist/cjs/generated/errors.js.map +1 -1
  12. package/dist/cjs/generated/ids.d.ts +61 -0
  13. package/dist/cjs/generated/ids.js +15 -0
  14. package/dist/cjs/generated/ids.js.map +1 -1
  15. package/dist/cjs/generated/jobs.js +4 -0
  16. package/dist/cjs/generated/jobs.js.map +1 -1
  17. package/dist/cjs/generated/ns/actions.d.ts +303 -4
  18. package/dist/cjs/generated/ns/actions.js +446 -4
  19. package/dist/cjs/generated/ns/actions.js.map +1 -1
  20. package/dist/cjs/generated/ns/agents.d.ts +229 -0
  21. package/dist/cjs/generated/ns/agents.js +402 -0
  22. package/dist/cjs/generated/ns/agents.js.map +1 -0
  23. package/dist/cjs/generated/ns/images.d.ts +81 -0
  24. package/dist/cjs/generated/ns/images.js +122 -0
  25. package/dist/cjs/generated/ns/images.js.map +1 -0
  26. package/dist/cjs/generated/ns/infer.d.ts +71 -3
  27. package/dist/cjs/generated/ns/infer.js +98 -3
  28. package/dist/cjs/generated/ns/infer.js.map +1 -1
  29. package/dist/cjs/generated/ns/keys.d.ts +3 -1
  30. package/dist/cjs/generated/ns/keys.js +3 -1
  31. package/dist/cjs/generated/ns/keys.js.map +1 -1
  32. package/dist/cjs/generated/ns/listeners.d.ts +159 -0
  33. package/dist/cjs/generated/ns/listeners.js +264 -0
  34. package/dist/cjs/generated/ns/listeners.js.map +1 -0
  35. package/dist/cjs/generated/ns/orgs.d.ts +10 -0
  36. package/dist/cjs/generated/ns/orgs.js +26 -1
  37. package/dist/cjs/generated/ns/orgs.js.map +1 -1
  38. package/dist/cjs/generated/ns/projects.d.ts +32 -0
  39. package/dist/cjs/generated/ns/projects.js +66 -0
  40. package/dist/cjs/generated/ns/projects.js.map +1 -1
  41. package/dist/cjs/generated/ns/render.d.ts +192 -21
  42. package/dist/cjs/generated/ns/render.js +267 -24
  43. package/dist/cjs/generated/ns/render.js.map +1 -1
  44. package/dist/cjs/generated/ns/requests.d.ts +3 -1
  45. package/dist/cjs/generated/ns/requests.js +3 -1
  46. package/dist/cjs/generated/ns/requests.js.map +1 -1
  47. package/dist/cjs/generated/ns/routines.d.ts +11 -4
  48. package/dist/cjs/generated/ns/routines.js +11 -4
  49. package/dist/cjs/generated/ns/routines.js.map +1 -1
  50. package/dist/cjs/generated/ns/sandboxes.d.ts +292 -7
  51. package/dist/cjs/generated/ns/sandboxes.js +444 -6
  52. package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
  53. package/dist/cjs/generated/ns/usage.d.ts +1 -1
  54. package/dist/cjs/generated/ns/usage.js +1 -1
  55. package/dist/cjs/generated/ns/vision.d.ts +59 -17
  56. package/dist/cjs/generated/ns/vision.js +59 -21
  57. package/dist/cjs/generated/ns/vision.js.map +1 -1
  58. package/dist/cjs/generated/types.d.ts +2787 -85
  59. package/dist/cjs/helpers/sandboxes.d.ts +46 -3
  60. package/dist/cjs/helpers/sandboxes.js +127 -14
  61. package/dist/cjs/helpers/sandboxes.js.map +1 -1
  62. package/dist/cjs/index.d.ts +1 -1
  63. package/dist/cjs/index.js +2 -1
  64. package/dist/cjs/index.js.map +1 -1
  65. package/dist/esm/core/sse.d.ts +2 -0
  66. package/dist/esm/core/sse.js +17 -5
  67. package/dist/esm/core/sse.js.map +1 -1
  68. package/dist/esm/core/util.d.ts +1 -1
  69. package/dist/esm/core/util.js +1 -1
  70. package/dist/esm/generated/client.d.ts +13 -0
  71. package/dist/esm/generated/client.js +25 -0
  72. package/dist/esm/generated/client.js.map +1 -1
  73. package/dist/esm/generated/errors.d.ts +1 -1
  74. package/dist/esm/generated/errors.js +95 -0
  75. package/dist/esm/generated/errors.js.map +1 -1
  76. package/dist/esm/generated/ids.d.ts +61 -0
  77. package/dist/esm/generated/ids.js +15 -0
  78. package/dist/esm/generated/ids.js.map +1 -1
  79. package/dist/esm/generated/jobs.js +4 -0
  80. package/dist/esm/generated/jobs.js.map +1 -1
  81. package/dist/esm/generated/ns/actions.d.ts +303 -4
  82. package/dist/esm/generated/ns/actions.js +446 -4
  83. package/dist/esm/generated/ns/actions.js.map +1 -1
  84. package/dist/esm/generated/ns/agents.d.ts +229 -0
  85. package/dist/esm/generated/ns/agents.js +398 -0
  86. package/dist/esm/generated/ns/agents.js.map +1 -0
  87. package/dist/esm/generated/ns/images.d.ts +81 -0
  88. package/dist/esm/generated/ns/images.js +118 -0
  89. package/dist/esm/generated/ns/images.js.map +1 -0
  90. package/dist/esm/generated/ns/infer.d.ts +71 -3
  91. package/dist/esm/generated/ns/infer.js +98 -3
  92. package/dist/esm/generated/ns/infer.js.map +1 -1
  93. package/dist/esm/generated/ns/keys.d.ts +3 -1
  94. package/dist/esm/generated/ns/keys.js +3 -1
  95. package/dist/esm/generated/ns/keys.js.map +1 -1
  96. package/dist/esm/generated/ns/listeners.d.ts +159 -0
  97. package/dist/esm/generated/ns/listeners.js +260 -0
  98. package/dist/esm/generated/ns/listeners.js.map +1 -0
  99. package/dist/esm/generated/ns/orgs.d.ts +10 -0
  100. package/dist/esm/generated/ns/orgs.js +26 -1
  101. package/dist/esm/generated/ns/orgs.js.map +1 -1
  102. package/dist/esm/generated/ns/projects.d.ts +32 -0
  103. package/dist/esm/generated/ns/projects.js +66 -0
  104. package/dist/esm/generated/ns/projects.js.map +1 -1
  105. package/dist/esm/generated/ns/render.d.ts +192 -21
  106. package/dist/esm/generated/ns/render.js +267 -24
  107. package/dist/esm/generated/ns/render.js.map +1 -1
  108. package/dist/esm/generated/ns/requests.d.ts +3 -1
  109. package/dist/esm/generated/ns/requests.js +3 -1
  110. package/dist/esm/generated/ns/requests.js.map +1 -1
  111. package/dist/esm/generated/ns/routines.d.ts +11 -4
  112. package/dist/esm/generated/ns/routines.js +11 -4
  113. package/dist/esm/generated/ns/routines.js.map +1 -1
  114. package/dist/esm/generated/ns/sandboxes.d.ts +292 -7
  115. package/dist/esm/generated/ns/sandboxes.js +444 -6
  116. package/dist/esm/generated/ns/sandboxes.js.map +1 -1
  117. package/dist/esm/generated/ns/usage.d.ts +1 -1
  118. package/dist/esm/generated/ns/usage.js +1 -1
  119. package/dist/esm/generated/ns/vision.d.ts +59 -17
  120. package/dist/esm/generated/ns/vision.js +59 -21
  121. package/dist/esm/generated/ns/vision.js.map +1 -1
  122. package/dist/esm/generated/types.d.ts +2787 -85
  123. package/dist/esm/helpers/sandboxes.d.ts +46 -3
  124. package/dist/esm/helpers/sandboxes.js +126 -13
  125. package/dist/esm/helpers/sandboxes.js.map +1 -1
  126. package/dist/esm/index.d.ts +1 -1
  127. package/dist/esm/index.js +1 -1
  128. package/dist/esm/index.js.map +1 -1
  129. package/package.json +1 -1
  130. package/src/core/sse.ts +17 -5
  131. package/src/core/util.ts +1 -1
  132. package/src/generated/client.ts +28 -0
  133. package/src/generated/errors.ts +190 -0
  134. package/src/generated/ids.ts +15 -0
  135. package/src/generated/jobs.ts +4 -0
  136. package/src/generated/ns/actions.ts +483 -4
  137. package/src/generated/ns/agents.ts +461 -0
  138. package/src/generated/ns/images.ts +128 -0
  139. package/src/generated/ns/infer.ts +100 -3
  140. package/src/generated/ns/keys.ts +3 -1
  141. package/src/generated/ns/listeners.ts +296 -0
  142. package/src/generated/ns/orgs.ts +27 -1
  143. package/src/generated/ns/projects.ts +74 -0
  144. package/src/generated/ns/render.ts +277 -24
  145. package/src/generated/ns/requests.ts +3 -1
  146. package/src/generated/ns/routines.ts +11 -4
  147. package/src/generated/ns/sandboxes.ts +492 -7
  148. package/src/generated/ns/usage.ts +1 -1
  149. package/src/generated/ns/vision.ts +59 -21
  150. package/src/generated/types.ts +3511 -575
  151. package/src/helpers/sandboxes.ts +167 -14
  152. package/src/index.ts +1 -0
@@ -0,0 +1,159 @@
1
+ import type { RequestOptions, StreamOptions } from "../../core/client.ts";
2
+ import { Namespace } from "../../core/namespace.ts";
3
+ import type { Op } from "../../core/op.ts";
4
+ import type { APIPromise, ListPromise } from "../../core/promise.ts";
5
+ import type { EventStream } from "../../core/sse.ts";
6
+ import type * as T from "../types.ts";
7
+ /** Descriptors of every listeners operation, keyed by method name (for tooling and custom clients). */
8
+ export declare const listenersOps: {
9
+ readonly listListeners: Op;
10
+ readonly createListener: Op;
11
+ readonly deleteListener: Op;
12
+ readonly getListener: Op;
13
+ readonly updateListener: Op;
14
+ readonly listEvents: Op;
15
+ readonly ingestEvents: Op;
16
+ readonly redeliverEvent: Op;
17
+ readonly streamEvents: Op;
18
+ readonly testListener: Op;
19
+ };
20
+ /**
21
+ * Persistent subscriptions: a polled, streamed or pushed source, a CEL filter and a routine or webhook sink (`/v1/listeners`).
22
+ */
23
+ export declare class ListenersAPI extends Namespace {
24
+ /**
25
+ * List listeners
26
+ *
27
+ * Lists this project's listeners, newest first, in every status. Deleted listeners are not listed.
28
+ *
29
+ * `GET /v1/listeners` · scope `listeners:read` · served by the node
30
+ */
31
+ listListeners(params?: T.ListenersListListenersParams, options?: RequestOptions): ListPromise<T.ListenerList, T.Listener>;
32
+ /**
33
+ * Create a listener
34
+ *
35
+ * Validates the definition, compiles its CEL expressions and starts the source; the answer is `201` with the
36
+ * listener in status `starting`, and `active` follows once the first connect or poll succeeds. A source that
37
+ * cannot be reached does not fail the create: the listener goes `reconnecting` and retries with backoff, and
38
+ * after 24 hours of failures it ends `failed` with the reason in `error`.
39
+ *
40
+ * The routine named in a `routine` sink must exist in this project and needs `routines:run` on top of
41
+ * `listeners:write`; a `source.connection` needs `vault:run`, and the URL's host must be one of the
42
+ * connection's `hosts` (otherwise `422 listener_invalid`, reason `connection_host`). Without `ttl_s` or
43
+ * `expires_at` the listener lives until it is deleted. Without `budget.events_per_day` it gets the
44
+ * organization's share, `listeners.events.daily` divided by `listeners.active.max`; the object always shows the
45
+ * budget in force.
46
+ *
47
+ * A `filter.model` asks the small model one question about each event CEL kept, as the listener's owner, so it
48
+ * needs `infer:run` and bills infer tokens, within `budget.model_tokens_per_day`. The question is the system
49
+ * message and the event its own delimited user message; no tools are offered and the answer is parsed strictly.
50
+ * An event's content can still try to steer the model: at worst it makes the answer `true` for that event,
51
+ * which `budget.events_per_day` and `budget.model_tokens_per_day` bound, so do not rely on the model filter
52
+ * alone to keep untrusted events from a sink that acts on them. When the model cannot answer (an error, a
53
+ * timeout, output that does not parse, the token budget spent), `on_error` decides (`drop` by default, or
54
+ * `pass`), and the event's `filter.model` says what happened.
55
+ *
56
+ * A `pack` source is checked by the actions trigger manager at create (the trigger exists, `with` is valid,
57
+ * its connections are usable) and is held there as a trigger subscription the listener owns; it is removed
58
+ * when the listener is paused, deleted or ends.
59
+ *
60
+ * A `webhook` source's listener is `active` at once, and its answer carries `source.hook_id` and
61
+ * `source.hook_url` to give the provider; with the `b3os` scheme it also carries `source.secret`, which no
62
+ * later answer shows. A `verify.secret` connection needs `vault:run`. A `websocket` source is held by the
63
+ * node's socket holder; while that unit is down the listener stays `starting` or `reconnecting`.
64
+ *
65
+ * The listener belongs to the creating key (`owner.kind: key`): when that key is revoked or expires the
66
+ * listener ends `revoked`. One created from a sandbox belongs to the key that created the sandbox and also
67
+ * ends when the sandbox's root sandbox ends.
68
+ *
69
+ * `POST /v1/listeners` · scope `listeners:write` · served by the node
70
+ */
71
+ createListener(body: T.ListenerCreateRequest, options?: RequestOptions): APIPromise<T.Listener>;
72
+ /**
73
+ * Delete a listener
74
+ *
75
+ * Closes the source and stops delivery at once; an event already handed to its sink is not recalled. The
76
+ * event history stays readable for its 7 days through `GET /v1/listeners/{listener_id}/events` and is then
77
+ * deleted.
78
+ *
79
+ * `DELETE /v1/listeners/{listener_id}` · scope `listeners:write` · served by the node
80
+ */
81
+ deleteListener(listenerId: string, options?: RequestOptions): APIPromise<T.Deleted>;
82
+ /**
83
+ * Get a listener
84
+ *
85
+ * Returns one of this project's listeners: its status, the source's state (cursor, connected since, next
86
+ * attempt), the budget in force and what it used today (UTC), and its counters.
87
+ *
88
+ * `GET /v1/listeners/{listener_id}` · scope `listeners:read` · served by the node
89
+ */
90
+ getListener(listenerId: string, options?: RequestOptions): APIPromise<T.Listener>;
91
+ /**
92
+ * Change, pause or resume a listener
93
+ *
94
+ * Changes the lifetime (`ttl_s` counts from now; `expires_at: null` removes it), the filter, the sink, the
95
+ * budget, `redact` and `metadata`. `paused: true` closes the source and stops delivery, keeping the cursor;
96
+ * `false` opens it again where it stopped. A listener paused by its budget resumes by itself when the UTC day
97
+ * ends, or now if the PATCH raises the budget above what it used. The source cannot change: create a new
98
+ * listener. A new filter or `redact` applies to events received after the answer. A listener that ended
99
+ * (`failed`, `expired`, `revoked`) answers `409 listener_not_active`, except that a `failed` one can be
100
+ * resumed with `paused: false`, which starts its source again.
101
+ *
102
+ * `PATCH /v1/listeners/{listener_id}` · scope `listeners:write` · served by the node
103
+ */
104
+ updateListener(listenerId: string, body: T.ListenerUpdateRequest, options?: RequestOptions): APIPromise<T.Listener>;
105
+ /**
106
+ * List a listener's events
107
+ *
108
+ * The listener's history, newest first: every event it kept (duplicates within the dedupe window are only
109
+ * counted, in `stats.duplicates`) with its payload, the filter's verdict, its status and its delivery, and a
110
+ * `gap` record for each time the source was down with events possibly missed. Kept 7 days. Payloads larger
111
+ * than 64 KiB are cut to their first 64 KiB with `payload_truncated: true`. Values at the listener's `redact`
112
+ * paths read `"[redacted]"`.
113
+ *
114
+ * `GET /v1/listeners/{listener_id}/events` · scope `listeners:read` · served by the node
115
+ */
116
+ listEvents(listenerId: string, params?: T.ListenersListEventsParams, options?: RequestOptions): ListPromise<T.ListenerEventList, T.ListenerEvent>;
117
+ /**
118
+ * Send events to a push listener
119
+ *
120
+ * Sends up to 100 events to a listener whose source is `push`. Each goes through dedupe (its `dedupe_key`, or
121
+ * the listener's `dedupe.key` expression, or a hash of the payload), the filter and the sink, as an event from
122
+ * any other source would. The answer comes once every event is in the listener's log (`202`); delivery
123
+ * follows. A listener of another source type answers `409 listener_wrong_source`; one that is not active,
124
+ * `409 listener_not_active`; one whose backlog is full, `429 listener_backlog_full` with `Retry-After`.
125
+ * Code in a sandbox calls it at `B3OS_API_URL` when its grant holds `listeners:write`.
126
+ *
127
+ * `POST /v1/listeners/{listener_id}/events` · scope `listeners:write` · served by the node
128
+ */
129
+ ingestEvents(listenerId: string, body: T.ListenerIngestRequest, options?: RequestOptions): APIPromise<T.ListenerIngestResult>;
130
+ /**
131
+ * Deliver an event again
132
+ *
133
+ * Hands a kept event (`delivered` or `failed`) to the sink again, with the same `dedupe_key`, so a sink that
134
+ * already has it can drop it. The filter does not run again. The answer is the event, `pending`.
135
+ *
136
+ * `POST /v1/listeners/{listener_id}/events/{event_id}/redeliver` · scope `listeners:write` · served by the node
137
+ */
138
+ redeliverEvent(listenerId: string, eventId: string, options?: RequestOptions): APIPromise<T.ListenerEvent>;
139
+ /**
140
+ * Stream a listener's events
141
+ *
142
+ * Server-sent events as the listener keeps events, records gaps and changes status. Reconnect with
143
+ * `Last-Event-ID` (the `seq` of the last frame you read) to resume: frames still in the 7-day history are sent
144
+ * again from there. `: ping` every 15 seconds.
145
+ *
146
+ * `GET /v1/listeners/{listener_id}/stream` · scope `listeners:read` · served by the node
147
+ */
148
+ streamEvents(listenerId: string, options?: StreamOptions): EventStream<T.ListenerStreamFrame>;
149
+ /**
150
+ * Test a listener on a sample event
151
+ *
152
+ * Runs a sample payload through the listener's dedupe key and filter and returns what happened, without
153
+ * touching the dedupe window or the history. With `deliver: true` the sample, if the filter keeps it, is also
154
+ * written to the log and delivered like any event, marked `test: true` in the sink's copy.
155
+ *
156
+ * `POST /v1/listeners/{listener_id}/test` · scope `listeners:write` · served by the node
157
+ */
158
+ testListener(listenerId: string, body: T.ListenerTestRequest, options?: RequestOptions): APIPromise<T.ListenerTestResult>;
159
+ }
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ // Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ListenersAPI = exports.listenersOps = void 0;
5
+ const namespace_ts_1 = require("../../core/namespace.js");
6
+ const listListenersOp = {
7
+ id: "listenersListListeners",
8
+ method: "GET",
9
+ path: "/v1/listeners",
10
+ timeoutMs: 10000,
11
+ scope: "listeners:read",
12
+ };
13
+ const createListenerOp = {
14
+ id: "listenersCreateListener",
15
+ method: "POST",
16
+ path: "/v1/listeners",
17
+ body: "json",
18
+ idem: true,
19
+ timeoutMs: 15000,
20
+ scope: "listeners:write",
21
+ };
22
+ const deleteListenerOp = {
23
+ id: "listenersDeleteListener",
24
+ method: "DELETE",
25
+ path: "/v1/listeners/{listener_id}",
26
+ params: ["listener_id"],
27
+ timeoutMs: 10000,
28
+ scope: "listeners:write",
29
+ };
30
+ const getListenerOp = {
31
+ id: "listenersGetListener",
32
+ method: "GET",
33
+ path: "/v1/listeners/{listener_id}",
34
+ params: ["listener_id"],
35
+ timeoutMs: 10000,
36
+ scope: "listeners:read",
37
+ };
38
+ const updateListenerOp = {
39
+ id: "listenersUpdateListener",
40
+ method: "PATCH",
41
+ path: "/v1/listeners/{listener_id}",
42
+ params: ["listener_id"],
43
+ body: "json",
44
+ timeoutMs: 10000,
45
+ scope: "listeners:write",
46
+ };
47
+ const listEventsOp = {
48
+ id: "listenersListEvents",
49
+ method: "GET",
50
+ path: "/v1/listeners/{listener_id}/events",
51
+ params: ["listener_id"],
52
+ timeoutMs: 10000,
53
+ scope: "listeners:read",
54
+ };
55
+ const ingestEventsOp = {
56
+ id: "listenersIngestEvents",
57
+ method: "POST",
58
+ path: "/v1/listeners/{listener_id}/events",
59
+ params: ["listener_id"],
60
+ body: "json",
61
+ timeoutMs: 10000,
62
+ scope: "listeners:write",
63
+ };
64
+ const redeliverEventOp = {
65
+ id: "listenersRedeliverEvent",
66
+ method: "POST",
67
+ path: "/v1/listeners/{listener_id}/events/{event_id}/redeliver",
68
+ params: ["listener_id", "event_id"],
69
+ timeoutMs: 10000,
70
+ scope: "listeners:write",
71
+ };
72
+ const streamEventsOp = {
73
+ id: "listenersStreamEvents",
74
+ method: "GET",
75
+ path: "/v1/listeners/{listener_id}/stream",
76
+ params: ["listener_id"],
77
+ stream: "sse",
78
+ timeoutMs: 3600000,
79
+ scope: "listeners:read",
80
+ };
81
+ const testListenerOp = {
82
+ id: "listenersTestListener",
83
+ method: "POST",
84
+ path: "/v1/listeners/{listener_id}/test",
85
+ params: ["listener_id"],
86
+ body: "json",
87
+ timeoutMs: 10000,
88
+ scope: "listeners:write",
89
+ };
90
+ /** Descriptors of every listeners operation, keyed by method name (for tooling and custom clients). */
91
+ exports.listenersOps = {
92
+ listListeners: listListenersOp,
93
+ createListener: createListenerOp,
94
+ deleteListener: deleteListenerOp,
95
+ getListener: getListenerOp,
96
+ updateListener: updateListenerOp,
97
+ listEvents: listEventsOp,
98
+ ingestEvents: ingestEventsOp,
99
+ redeliverEvent: redeliverEventOp,
100
+ streamEvents: streamEventsOp,
101
+ testListener: testListenerOp,
102
+ };
103
+ /**
104
+ * Persistent subscriptions: a polled, streamed or pushed source, a CEL filter and a routine or webhook sink (`/v1/listeners`).
105
+ */
106
+ class ListenersAPI extends namespace_ts_1.Namespace {
107
+ /**
108
+ * List listeners
109
+ *
110
+ * Lists this project's listeners, newest first, in every status. Deleted listeners are not listed.
111
+ *
112
+ * `GET /v1/listeners` · scope `listeners:read` · served by the node
113
+ */
114
+ listListeners(params, options) {
115
+ return this._client._list(listListenersOp, { query: params }, options);
116
+ }
117
+ /**
118
+ * Create a listener
119
+ *
120
+ * Validates the definition, compiles its CEL expressions and starts the source; the answer is `201` with the
121
+ * listener in status `starting`, and `active` follows once the first connect or poll succeeds. A source that
122
+ * cannot be reached does not fail the create: the listener goes `reconnecting` and retries with backoff, and
123
+ * after 24 hours of failures it ends `failed` with the reason in `error`.
124
+ *
125
+ * The routine named in a `routine` sink must exist in this project and needs `routines:run` on top of
126
+ * `listeners:write`; a `source.connection` needs `vault:run`, and the URL's host must be one of the
127
+ * connection's `hosts` (otherwise `422 listener_invalid`, reason `connection_host`). Without `ttl_s` or
128
+ * `expires_at` the listener lives until it is deleted. Without `budget.events_per_day` it gets the
129
+ * organization's share, `listeners.events.daily` divided by `listeners.active.max`; the object always shows the
130
+ * budget in force.
131
+ *
132
+ * A `filter.model` asks the small model one question about each event CEL kept, as the listener's owner, so it
133
+ * needs `infer:run` and bills infer tokens, within `budget.model_tokens_per_day`. The question is the system
134
+ * message and the event its own delimited user message; no tools are offered and the answer is parsed strictly.
135
+ * An event's content can still try to steer the model: at worst it makes the answer `true` for that event,
136
+ * which `budget.events_per_day` and `budget.model_tokens_per_day` bound, so do not rely on the model filter
137
+ * alone to keep untrusted events from a sink that acts on them. When the model cannot answer (an error, a
138
+ * timeout, output that does not parse, the token budget spent), `on_error` decides (`drop` by default, or
139
+ * `pass`), and the event's `filter.model` says what happened.
140
+ *
141
+ * A `pack` source is checked by the actions trigger manager at create (the trigger exists, `with` is valid,
142
+ * its connections are usable) and is held there as a trigger subscription the listener owns; it is removed
143
+ * when the listener is paused, deleted or ends.
144
+ *
145
+ * A `webhook` source's listener is `active` at once, and its answer carries `source.hook_id` and
146
+ * `source.hook_url` to give the provider; with the `b3os` scheme it also carries `source.secret`, which no
147
+ * later answer shows. A `verify.secret` connection needs `vault:run`. A `websocket` source is held by the
148
+ * node's socket holder; while that unit is down the listener stays `starting` or `reconnecting`.
149
+ *
150
+ * The listener belongs to the creating key (`owner.kind: key`): when that key is revoked or expires the
151
+ * listener ends `revoked`. One created from a sandbox belongs to the key that created the sandbox and also
152
+ * ends when the sandbox's root sandbox ends.
153
+ *
154
+ * `POST /v1/listeners` · scope `listeners:write` · served by the node
155
+ */
156
+ createListener(body, options) {
157
+ return this._client._call(createListenerOp, { body }, options);
158
+ }
159
+ /**
160
+ * Delete a listener
161
+ *
162
+ * Closes the source and stops delivery at once; an event already handed to its sink is not recalled. The
163
+ * event history stays readable for its 7 days through `GET /v1/listeners/{listener_id}/events` and is then
164
+ * deleted.
165
+ *
166
+ * `DELETE /v1/listeners/{listener_id}` · scope `listeners:write` · served by the node
167
+ */
168
+ deleteListener(listenerId, options) {
169
+ return this._client._call(deleteListenerOp, { path: [listenerId] }, options);
170
+ }
171
+ /**
172
+ * Get a listener
173
+ *
174
+ * Returns one of this project's listeners: its status, the source's state (cursor, connected since, next
175
+ * attempt), the budget in force and what it used today (UTC), and its counters.
176
+ *
177
+ * `GET /v1/listeners/{listener_id}` · scope `listeners:read` · served by the node
178
+ */
179
+ getListener(listenerId, options) {
180
+ return this._client._call(getListenerOp, { path: [listenerId] }, options);
181
+ }
182
+ /**
183
+ * Change, pause or resume a listener
184
+ *
185
+ * Changes the lifetime (`ttl_s` counts from now; `expires_at: null` removes it), the filter, the sink, the
186
+ * budget, `redact` and `metadata`. `paused: true` closes the source and stops delivery, keeping the cursor;
187
+ * `false` opens it again where it stopped. A listener paused by its budget resumes by itself when the UTC day
188
+ * ends, or now if the PATCH raises the budget above what it used. The source cannot change: create a new
189
+ * listener. A new filter or `redact` applies to events received after the answer. A listener that ended
190
+ * (`failed`, `expired`, `revoked`) answers `409 listener_not_active`, except that a `failed` one can be
191
+ * resumed with `paused: false`, which starts its source again.
192
+ *
193
+ * `PATCH /v1/listeners/{listener_id}` · scope `listeners:write` · served by the node
194
+ */
195
+ updateListener(listenerId, body, options) {
196
+ return this._client._call(updateListenerOp, { path: [listenerId], body }, options);
197
+ }
198
+ /**
199
+ * List a listener's events
200
+ *
201
+ * The listener's history, newest first: every event it kept (duplicates within the dedupe window are only
202
+ * counted, in `stats.duplicates`) with its payload, the filter's verdict, its status and its delivery, and a
203
+ * `gap` record for each time the source was down with events possibly missed. Kept 7 days. Payloads larger
204
+ * than 64 KiB are cut to their first 64 KiB with `payload_truncated: true`. Values at the listener's `redact`
205
+ * paths read `"[redacted]"`.
206
+ *
207
+ * `GET /v1/listeners/{listener_id}/events` · scope `listeners:read` · served by the node
208
+ */
209
+ listEvents(listenerId, params, options) {
210
+ return this._client._list(listEventsOp, { path: [listenerId], query: params }, options);
211
+ }
212
+ /**
213
+ * Send events to a push listener
214
+ *
215
+ * Sends up to 100 events to a listener whose source is `push`. Each goes through dedupe (its `dedupe_key`, or
216
+ * the listener's `dedupe.key` expression, or a hash of the payload), the filter and the sink, as an event from
217
+ * any other source would. The answer comes once every event is in the listener's log (`202`); delivery
218
+ * follows. A listener of another source type answers `409 listener_wrong_source`; one that is not active,
219
+ * `409 listener_not_active`; one whose backlog is full, `429 listener_backlog_full` with `Retry-After`.
220
+ * Code in a sandbox calls it at `B3OS_API_URL` when its grant holds `listeners:write`.
221
+ *
222
+ * `POST /v1/listeners/{listener_id}/events` · scope `listeners:write` · served by the node
223
+ */
224
+ ingestEvents(listenerId, body, options) {
225
+ return this._client._call(ingestEventsOp, { path: [listenerId], body }, options);
226
+ }
227
+ /**
228
+ * Deliver an event again
229
+ *
230
+ * Hands a kept event (`delivered` or `failed`) to the sink again, with the same `dedupe_key`, so a sink that
231
+ * already has it can drop it. The filter does not run again. The answer is the event, `pending`.
232
+ *
233
+ * `POST /v1/listeners/{listener_id}/events/{event_id}/redeliver` · scope `listeners:write` · served by the node
234
+ */
235
+ redeliverEvent(listenerId, eventId, options) {
236
+ return this._client._call(redeliverEventOp, { path: [listenerId, eventId] }, options);
237
+ }
238
+ /**
239
+ * Stream a listener's events
240
+ *
241
+ * Server-sent events as the listener keeps events, records gaps and changes status. Reconnect with
242
+ * `Last-Event-ID` (the `seq` of the last frame you read) to resume: frames still in the 7-day history are sent
243
+ * again from there. `: ping` every 15 seconds.
244
+ *
245
+ * `GET /v1/listeners/{listener_id}/stream` · scope `listeners:read` · served by the node
246
+ */
247
+ streamEvents(listenerId, options) {
248
+ return this._client._stream(streamEventsOp, { path: [listenerId] }, options, {});
249
+ }
250
+ /**
251
+ * Test a listener on a sample event
252
+ *
253
+ * Runs a sample payload through the listener's dedupe key and filter and returns what happened, without
254
+ * touching the dedupe window or the history. With `deliver: true` the sample, if the filter keeps it, is also
255
+ * written to the log and delivered like any event, marked `test: true` in the sink's copy.
256
+ *
257
+ * `POST /v1/listeners/{listener_id}/test` · scope `listeners:write` · served by the node
258
+ */
259
+ testListener(listenerId, body, options) {
260
+ return this._client._call(testListenerOp, { path: [listenerId], body }, options);
261
+ }
262
+ }
263
+ exports.ListenersAPI = ListenersAPI;
264
+ //# sourceMappingURL=listeners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../../src/generated/ns/listeners.ts"],"names":[],"mappings":";AAAA,4GAA4G;;;AAG5G,0DAAoD;AAMpD,MAAM,eAAe,GAAO;IAC1B,EAAE,EAAE,wBAAwB;IAC5B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AACF,MAAM,gBAAgB,GAAO;IAC3B,EAAE,EAAE,yBAAyB;IAC7B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,iBAAiB;CACzB,CAAC;AACF,MAAM,gBAAgB,GAAO;IAC3B,EAAE,EAAE,yBAAyB;IAC7B,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,6BAA6B;IACnC,MAAM,EAAE,CAAC,aAAa,CAAC;IACvB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,iBAAiB;CACzB,CAAC;AACF,MAAM,aAAa,GAAO;IACxB,EAAE,EAAE,sBAAsB;IAC1B,MAAM,EAA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;IAED;;;;;;;;OAQG;IACH,YAAY,CACV,UAAkB,EAClB,IAA2B,EAC3B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAuB,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACF;AAxLD,oCAwLC"}
@@ -8,6 +8,7 @@ export declare const orgsOps: {
8
8
  readonly listOrgs: Op;
9
9
  readonly getOrg: Op;
10
10
  readonly listMembers: Op;
11
+ readonly getOrgSettings: Op;
11
12
  };
12
13
  /** Organizations and members (`/v1/orgs`; served by beta-api.b3os.org). */
13
14
  export declare class OrgsAPI extends Namespace {
@@ -35,4 +36,13 @@ export declare class OrgsAPI extends Namespace {
35
36
  * `GET /v1/orgs/{org_id}/members` · scope `platform:read` · served by beta-api.b3os.org
36
37
  */
37
38
  listMembers(orgId: string, params?: T.PlatformListMembersParams, options?: RequestOptions): ListPromise<T.MemberList, T.Member>;
39
+ /**
40
+ * List an organization's settings
41
+ *
42
+ * The settings stored for the organization, which apply to every project that sets nothing itself. Members
43
+ * and the organization's keys may read them.
44
+ *
45
+ * `GET /v1/orgs/{org_id}/settings` · scope `authenticated` · served by beta-api.b3os.org
46
+ */
47
+ getOrgSettings(orgId: string, options?: RequestOptions): APIPromise<T.StoredSettingList>;
38
48
  }
@@ -29,8 +29,22 @@ const listMembersOp = {
29
29
  timeoutMs: 10000,
30
30
  scope: "platform:read",
31
31
  };
32
+ const getOrgSettingsOp = {
33
+ id: "platformGetOrgSettings",
34
+ method: "GET",
35
+ path: "/v1/orgs/{org_id}/settings",
36
+ params: ["org_id"],
37
+ edge: true,
38
+ timeoutMs: 10000,
39
+ scope: "authenticated",
40
+ };
32
41
  /** Descriptors of every orgs operation, keyed by method name (for tooling and custom clients). */
33
- exports.orgsOps = { listOrgs: listOrgsOp, getOrg: getOrgOp, listMembers: listMembersOp };
42
+ exports.orgsOps = {
43
+ listOrgs: listOrgsOp,
44
+ getOrg: getOrgOp,
45
+ listMembers: listMembersOp,
46
+ getOrgSettings: getOrgSettingsOp,
47
+ };
34
48
  /** Organizations and members (`/v1/orgs`; served by beta-api.b3os.org). */
35
49
  class OrgsAPI extends namespace_ts_1.Namespace {
36
50
  /**
@@ -63,6 +77,17 @@ class OrgsAPI extends namespace_ts_1.Namespace {
63
77
  listMembers(orgId, params, options) {
64
78
  return this._client._list(listMembersOp, { path: [orgId], query: params }, options);
65
79
  }
80
+ /**
81
+ * List an organization's settings
82
+ *
83
+ * The settings stored for the organization, which apply to every project that sets nothing itself. Members
84
+ * and the organization's keys may read them.
85
+ *
86
+ * `GET /v1/orgs/{org_id}/settings` · scope `authenticated` · served by beta-api.b3os.org
87
+ */
88
+ getOrgSettings(orgId, options) {
89
+ return this._client._call(getOrgSettingsOp, { path: [orgId] }, options);
90
+ }
66
91
  }
67
92
  exports.OrgsAPI = OrgsAPI;
68
93
  //# sourceMappingURL=orgs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"orgs.js","sourceRoot":"","sources":["../../../../src/generated/ns/orgs.ts"],"names":[],"mappings":";AAAA,4GAA4G;;;AAG5G,0DAAoD;AAKpD,MAAM,UAAU,GAAO;IACrB,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,eAAe;CACvB,CAAC;AACF,MAAM,QAAQ,GAAO;IACnB,EAAE,EAAE,gBAAgB;IACpB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,eAAe;CACvB,CAAC;AACF,MAAM,aAAa,GAAO;IACxB,EAAE,EAAE,qBAAqB;IACzB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,2BA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AAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAyB,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;IAED;;;;;;;OAOG;IACH,cAAc,CAAC,KAAa,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAsB,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/F,CAAC;CACF;AAjDD,0BAiDC"}
@@ -10,6 +10,9 @@ export declare const projectsOps: {
10
10
  readonly deleteProject: Op;
11
11
  readonly getProject: Op;
12
12
  readonly updateProject: Op;
13
+ readonly getProjectSettings: Op;
14
+ readonly unsetProjectSetting: Op;
15
+ readonly setProjectSetting: Op;
13
16
  };
14
17
  /** Projects (`/v1/projects`; served by beta-api.b3os.org). */
15
18
  export declare class ProjectsAPI extends Namespace {
@@ -54,4 +57,33 @@ export declare class ProjectsAPI extends Namespace {
54
57
  * `PATCH /v1/projects/{project_id}` · scope `platform:write` · served by beta-api.b3os.org
55
58
  */
56
59
  updateProject(projectId: string, body: T.ProjectUpdateRequest, options?: RequestOptions): APIPromise<T.Project>;
60
+ /**
61
+ * List a project's settings
62
+ *
63
+ * The settings stored for the project, without inherited values (`GET /v1/settings` resolves those). Any valid
64
+ * credential may read its own project's; another project of the organization needs `platform:read`.
65
+ *
66
+ * `GET /v1/projects/{project_id}/settings` · scope `authenticated` · served by beta-api.b3os.org
67
+ */
68
+ getProjectSettings(projectId: string, options?: RequestOptions): APIPromise<T.StoredSettingList>;
69
+ /**
70
+ * Unset a project setting
71
+ *
72
+ * Removes the project's own value, so the organization's or the default applies again. Who may call it is as
73
+ * for setting it. Unsetting an option the project does not set succeeds too.
74
+ *
75
+ * `DELETE /v1/projects/{project_id}/settings/{option}` · scope `authenticated` · served by beta-api.b3os.org
76
+ */
77
+ unsetProjectSetting(projectId: string, option: string, options?: RequestOptions): APIPromise<T.Deleted>;
78
+ /**
79
+ * Set a project setting
80
+ *
81
+ * Sets `option` for the project. A credential with `settings:write` sets its own project's; `platform:write`
82
+ * sets any project's in the organization. The value must be one the option serves: an unknown option or a
83
+ * value outside its catalog is `422 invalid_option`, a reserved value `422 option_not_allowed`. Nodes apply
84
+ * it within a few seconds; work already running keeps what it started with.
85
+ *
86
+ * `PUT /v1/projects/{project_id}/settings/{option}` · scope `authenticated` · served by beta-api.b3os.org
87
+ */
88
+ setProjectSetting(projectId: string, option: string, body: T.SettingRequest, options?: RequestOptions): APIPromise<T.StoredSetting>;
57
89
  }
@@ -49,6 +49,34 @@ const updateProjectOp = {
49
49
  timeoutMs: 10000,
50
50
  scope: "platform:write",
51
51
  };
52
+ const getProjectSettingsOp = {
53
+ id: "platformGetProjectSettings",
54
+ method: "GET",
55
+ path: "/v1/projects/{project_id}/settings",
56
+ params: ["project_id"],
57
+ edge: true,
58
+ timeoutMs: 10000,
59
+ scope: "authenticated",
60
+ };
61
+ const unsetProjectSettingOp = {
62
+ id: "platformUnsetProjectSetting",
63
+ method: "DELETE",
64
+ path: "/v1/projects/{project_id}/settings/{option}",
65
+ params: ["project_id", "option"],
66
+ edge: true,
67
+ timeoutMs: 10000,
68
+ scope: "authenticated",
69
+ };
70
+ const setProjectSettingOp = {
71
+ id: "platformSetProjectSetting",
72
+ method: "PUT",
73
+ path: "/v1/projects/{project_id}/settings/{option}",
74
+ params: ["project_id", "option"],
75
+ body: "json",
76
+ edge: true,
77
+ timeoutMs: 10000,
78
+ scope: "authenticated",
79
+ };
52
80
  /** Descriptors of every projects operation, keyed by method name (for tooling and custom clients). */
53
81
  exports.projectsOps = {
54
82
  listProjects: listProjectsOp,
@@ -56,6 +84,9 @@ exports.projectsOps = {
56
84
  deleteProject: deleteProjectOp,
57
85
  getProject: getProjectOp,
58
86
  updateProject: updateProjectOp,
87
+ getProjectSettings: getProjectSettingsOp,
88
+ unsetProjectSetting: unsetProjectSettingOp,
89
+ setProjectSetting: setProjectSettingOp,
59
90
  };
60
91
  /** Projects (`/v1/projects`; served by beta-api.b3os.org). */
61
92
  class ProjectsAPI extends namespace_ts_1.Namespace {
@@ -110,6 +141,41 @@ class ProjectsAPI extends namespace_ts_1.Namespace {
110
141
  updateProject(projectId, body, options) {
111
142
  return this._client._call(updateProjectOp, { path: [projectId], body }, options);
112
143
  }
144
+ /**
145
+ * List a project's settings
146
+ *
147
+ * The settings stored for the project, without inherited values (`GET /v1/settings` resolves those). Any valid
148
+ * credential may read its own project's; another project of the organization needs `platform:read`.
149
+ *
150
+ * `GET /v1/projects/{project_id}/settings` · scope `authenticated` · served by beta-api.b3os.org
151
+ */
152
+ getProjectSettings(projectId, options) {
153
+ return this._client._call(getProjectSettingsOp, { path: [projectId] }, options);
154
+ }
155
+ /**
156
+ * Unset a project setting
157
+ *
158
+ * Removes the project's own value, so the organization's or the default applies again. Who may call it is as
159
+ * for setting it. Unsetting an option the project does not set succeeds too.
160
+ *
161
+ * `DELETE /v1/projects/{project_id}/settings/{option}` · scope `authenticated` · served by beta-api.b3os.org
162
+ */
163
+ unsetProjectSetting(projectId, option, options) {
164
+ return this._client._call(unsetProjectSettingOp, { path: [projectId, option] }, options);
165
+ }
166
+ /**
167
+ * Set a project setting
168
+ *
169
+ * Sets `option` for the project. A credential with `settings:write` sets its own project's; `platform:write`
170
+ * sets any project's in the organization. The value must be one the option serves: an unknown option or a
171
+ * value outside its catalog is `422 invalid_option`, a reserved value `422 option_not_allowed`. Nodes apply
172
+ * it within a few seconds; work already running keeps what it started with.
173
+ *
174
+ * `PUT /v1/projects/{project_id}/settings/{option}` · scope `authenticated` · served by beta-api.b3os.org
175
+ */
176
+ setProjectSetting(projectId, option, body, options) {
177
+ return this._client._call(setProjectSettingOp, { path: [projectId, option], body }, options);
178
+ }
113
179
  }
114
180
  exports.ProjectsAPI = ProjectsAPI;
115
181
  //# sourceMappingURL=projects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../../src/generated/ns/projects.ts"],"names":[],"mappings":";AAAA,4GAA4G;;;AAG5G,0DAAoD;AAKpD,MAAM,cAAc,GAAO;IACzB,EAAE,EAAE,sBAAsB;IAC1B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,eAAe;CACvB,CAAC;AACF,MAAM,eAAe,GAAO;IAC1B,EAAE,EAAE,uBAAuB;IAC3B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AACF,MAAM,eAAe,GAAO;IAC1B,EAAE,EAAE,uBAAuB;IAC3B,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,CAAC,YAAY,CAAC;IACtB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AACF,MAAM,YAAY,GAAO;IACvB,EAAE,EAAE,oBAAoB;IACxB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,CAAC,YAAY,CAAC;IACtB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,eAAe;CACvB,CAAC;AACF,MAAM,eAAe,GAAO;IAC1B,EAAE,EAAE,uBAAuB;IAC3B,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,CAAC,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAEF,sGAAsG;AACzF,QAA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