@unfenced-ai/sdk 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 (59) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +171 -0
  3. package/dist/client.d.ts +385 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +349 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/credentials.d.ts +14 -0
  8. package/dist/credentials.d.ts.map +1 -0
  9. package/dist/credentials.js +17 -0
  10. package/dist/credentials.js.map +1 -0
  11. package/dist/fetch.d.ts +16 -0
  12. package/dist/fetch.d.ts.map +1 -0
  13. package/dist/fetch.js +387 -0
  14. package/dist/fetch.js.map +1 -0
  15. package/dist/http.d.ts +76 -0
  16. package/dist/http.d.ts.map +1 -0
  17. package/dist/http.js +250 -0
  18. package/dist/http.js.map +1 -0
  19. package/dist/index.d.ts +53 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +41 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/library.d.ts +17 -0
  24. package/dist/library.d.ts.map +1 -0
  25. package/dist/library.js +25 -0
  26. package/dist/library.js.map +1 -0
  27. package/dist/memory.d.ts +13 -0
  28. package/dist/memory.d.ts.map +1 -0
  29. package/dist/memory.js +45 -0
  30. package/dist/memory.js.map +1 -0
  31. package/dist/permissions.d.ts +29 -0
  32. package/dist/permissions.d.ts.map +1 -0
  33. package/dist/permissions.js +69 -0
  34. package/dist/permissions.js.map +1 -0
  35. package/dist/protocol.d.ts +296 -0
  36. package/dist/protocol.d.ts.map +1 -0
  37. package/dist/protocol.js +89 -0
  38. package/dist/protocol.js.map +1 -0
  39. package/dist/session.d.ts +97 -0
  40. package/dist/session.d.ts.map +1 -0
  41. package/dist/session.js +88 -0
  42. package/dist/session.js.map +1 -0
  43. package/dist/sessions.d.ts +131 -0
  44. package/dist/sessions.d.ts.map +1 -0
  45. package/dist/sessions.js +197 -0
  46. package/dist/sessions.js.map +1 -0
  47. package/dist/token-usage.d.ts +11 -0
  48. package/dist/token-usage.d.ts.map +1 -0
  49. package/dist/token-usage.js +34 -0
  50. package/dist/token-usage.js.map +1 -0
  51. package/dist/types.d.ts +1409 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +2 -0
  54. package/dist/types.js.map +1 -0
  55. package/dist/url-identity.d.ts +8 -0
  56. package/dist/url-identity.d.ts.map +1 -0
  57. package/dist/url-identity.js +18 -0
  58. package/dist/url-identity.js.map +1 -0
  59. package/package.json +44 -0
package/dist/client.js ADDED
@@ -0,0 +1,349 @@
1
+ /**
2
+ * The `Unfenced` client class — the package's public entry point.
3
+ *
4
+ * Every method's signature and doc comment is exactly what it was in the former
5
+ * single-file `index.ts`; only the bodies changed, from inline logic to a one
6
+ * line call into the domain module that now holds it (`fetching`, `live`,
7
+ * `library`, `perms`, `memory`, `vault`). The four transport fields and the
8
+ * private `request`/`awaitJob` helpers moved into `Transport` and `fetch.ts`, so
9
+ * the one private field left is `http`. The public surface is unchanged.
10
+ */
11
+ import { Transport } from "./http.js";
12
+ import * as fetching from "./fetch.js";
13
+ import * as live from "./sessions.js";
14
+ import * as library from "./library.js";
15
+ import * as perms from "./permissions.js";
16
+ import * as memory from "./memory.js";
17
+ import * as vault from "./credentials.js";
18
+ export class Unfenced {
19
+ /** The transport. Holds the base URL, the token, the fetch, and the extra
20
+ * headers — the four things every method's request needs — so the methods
21
+ * themselves carry none of it. */
22
+ http;
23
+ constructor(options = {}) {
24
+ this.http = new Transport(options);
25
+ }
26
+ /** Report counts only. Never sends tool arguments, page text, or image data. */
27
+ async recordTokenUsage(usage) {
28
+ await this.http.request("POST", "/usage/tokens", usage, 1500);
29
+ }
30
+ // ---- fetch -------------------------------------------------------------
31
+ /**
32
+ * Fetch a URL as clean content. Escalates from plain HTTP to a stealth
33
+ * browser to a headed browser only as far as the site forces, and resolves
34
+ * when the job is done.
35
+ */
36
+ fetch(url, options = {}) {
37
+ return fetching.fetch(this.http, url, options);
38
+ }
39
+ /**
40
+ * Fetch many URLs concurrently (each escalates independently).
41
+ *
42
+ * One entry per URL, in input order, with a failed URL carrying its structured
43
+ * error in place. A single bad URL must never cost the caller the whole batch —
44
+ * an agent batching 20 URLs would otherwise lose all 20 and have to bisect to
45
+ * find the offender.
46
+ */
47
+ batch(urls, options = {}) {
48
+ return fetching.batch(this.http, urls, options);
49
+ }
50
+ /**
51
+ * The same, but it always answers.
52
+ *
53
+ * `batch` resolves when every URL has, so one slow host decides when the
54
+ * whole call returns. An external QA run watched a ten-URL batch blow its
55
+ * client's sixty-second transport timeout — which returns NOTHING: every
56
+ * sibling that had already succeeded was discarded with it, and the caller
57
+ * got an opaque transport error naming no URL, so it could not even retry
58
+ * intelligently.
59
+ *
60
+ * The per-URL error isolation this tool promises only ever covered fast
61
+ * failures. This covers slow ones. Each URL races one shared deadline;
62
+ * whatever has not arrived becomes a `timeout` entry, in input order.
63
+ *
64
+ * A partial answer is worth far more to an agent than none — it can use what
65
+ * came back and retry exactly what did not.
66
+ */
67
+ batchWithin(urls, deadlineMs, options = {}) {
68
+ return fetching.batchWithin(this.http, urls, deadlineMs, options);
69
+ }
70
+ // ---- live sessions -----------------------------------------------------
71
+ /**
72
+ * Open a live browser session on a URL and get a handle to drive it.
73
+ *
74
+ * `account` names a sign-in account to act as (e.g. a specific one of several
75
+ * Google logins). It selects that account's isolated, stored session — so the
76
+ * page opens already signed in as that account and cookie changes persist back
77
+ * to it. Absent means the default session.
78
+ *
79
+ * A SIGN-IN ACCOUNT's name ("google", "google-2") — not a site or host, and
80
+ * not the name of a per-site login ("namecheap.com"), which is a password used
81
+ * INSIDE an account rather than an account. A credential's `site` says where a
82
+ * login is used, not what it is called, and the two sit next to each other in
83
+ * every listing; passing either opened a Chrome profile and a stored session
84
+ * that nothing else ever read, so the login was asked for again and never
85
+ * reached the next machine. The server now answers `unknown-account` (400)
86
+ * rather than quietly creating that drawer — unless the name already HAS a
87
+ * stored session, which is a drawer it opens rather than mints. A roster it
88
+ * could not read answers `accounts-unreadable` (503): retry, or omit `account`.
89
+ */
90
+ open(url, options = {}) {
91
+ return live.open(this, this.http, url, options);
92
+ }
93
+ /**
94
+ * Switch an open session to a DIFFERENT sign-in account — "check my other
95
+ * account". An account is bound to a page's isolated profile at open, so this
96
+ * is not a live swap: the current account's jar is saved, its page closed, and
97
+ * the same SITE reopened signed in as `account`. Returns a NEW Session (a new
98
+ * id) — use it going forward; the old one is closed. A one-off that never
99
+ * changes the site's configured default.
100
+ *
101
+ * `account` is a sign-in account's NAME, never a site or host — an unknown one
102
+ * is refused with `unknown-account` (400) BEFORE the open page is torn down, so
103
+ * a bad name costs nothing and leaves the current session usable.
104
+ */
105
+ switchAccount(sessionId, account) {
106
+ return live.switchAccount(this, this.http, sessionId, account);
107
+ }
108
+ /**
109
+ * Which account the page is actually signed in as — the DOWNSTREAM identity (e.g.
110
+ * which ChatGPT account), not the provider login that reached it. A non-disruptive
111
+ * same-origin read, so it can confirm identity mid-task. `identity` is null when the
112
+ * site is not one the server knows how to read (then observe the account menu).
113
+ */
114
+ /**
115
+ * What the account owner has to clear before the agent can continue.
116
+ *
117
+ * Read-only, and it must stay that way: a wall is cleared by a
118
+ * human-authenticated action, never by the caller that is blocked on it. An
119
+ * agent asking this is asking "what do you need from me" on the user's behalf,
120
+ * which is worth having as a question because most people do not live in the
121
+ * dashboard and would otherwise never learn a sign-in was waiting.
122
+ *
123
+ * `clearAt` is where the person goes. Hand that over rather than describing a
124
+ * screen.
125
+ */
126
+ pendingApprovals() {
127
+ return live.pendingApprovals(this.http);
128
+ }
129
+ whoami(sessionId) {
130
+ return live.whoami(this.http, sessionId);
131
+ }
132
+ /** Every live session currently open on the server. */
133
+ liveSessions() {
134
+ return live.liveSessions(this.http);
135
+ }
136
+ // Internal — used by Session.
137
+ observe(id, opts) {
138
+ return live.observe(this.http, id, opts);
139
+ }
140
+ /** Read the current page together with its provider-session continuity state. */
141
+ refresh(id, opts) {
142
+ return live.refresh(this.http, id, opts);
143
+ }
144
+ /**
145
+ * Read a page, and receive a picture with it when the reading cannot describe
146
+ * the page on its own.
147
+ *
148
+ * `observe` above returns the snapshot alone and keeps doing so, because that
149
+ * is what its callers expect. This one hands back the whole envelope — the
150
+ * server attaches `picture` and `marks` when the reading reports `look`, and a
151
+ * projection that quietly dropped them would put the agent back where it
152
+ * started: told that something is missing and made to spend a turn asking for
153
+ * it.
154
+ */
155
+ read(id, opts) {
156
+ return live.read(this.http, id, opts);
157
+ }
158
+ /**
159
+ * `opts` are OPTIONS on the call, not fields of the action — a native dialog is
160
+ * raised by the page mid-act and is not part of what was asked of it.
161
+ */
162
+ act(id, action, opts) {
163
+ return live.act(this.http, id, action, opts);
164
+ }
165
+ extract(id, format = "markdown", maxWords) {
166
+ return live.extract(this.http, id, format, maxWords);
167
+ }
168
+ screenshot(id) {
169
+ return live.screenshot(this.http, id);
170
+ }
171
+ /**
172
+ * A picture of the page with everything actable outlined and numbered.
173
+ *
174
+ * Separate from `screenshot` rather than an option on it, because the two have
175
+ * different callers and different costs: `screenshot` feeds a replay stream
176
+ * many times a turn and must stay a bare frame, while this one pays for a
177
+ * snapshot in order to guarantee the boxes and the list describe one instant.
178
+ */
179
+ see(id, opts = {}) {
180
+ return live.see(this.http, id, opts);
181
+ }
182
+ /**
183
+ * Fill several fields in one call.
184
+ *
185
+ * The saving is model round trips, not network ones. Text only and never
186
+ * submits — a password goes through `act` as a fill_secret, which is the one
187
+ * path allowed to resolve a stored value.
188
+ */
189
+ fill(id, fields) {
190
+ return live.fill(this.http, id, fields);
191
+ }
192
+ /**
193
+ * Hold a page open while something happens elsewhere.
194
+ *
195
+ * For the wait a login actually involves: a code sent to email, an approval
196
+ * in an app. Capped by the server, and a parked page still holds a real tab,
197
+ * so only a few may be parked at once.
198
+ */
199
+ park(id, minutes, reason) {
200
+ return live.park(this.http, id, minutes, reason);
201
+ }
202
+ /** Files this session's page has handed to the browser. Names and sizes. */
203
+ downloads(id) {
204
+ return live.downloads(this.http, id);
205
+ }
206
+ /**
207
+ * Read one of them as text.
208
+ *
209
+ * A PDF goes through the same reader a fetched PDF does, so downloading a
210
+ * statement and reading it is one capability rather than two halves of one.
211
+ */
212
+ readDownload(id, filename) {
213
+ return live.readDownload(this.http, id, filename);
214
+ }
215
+ /**
216
+ * Release a live page. Idempotent: closing one that has already closed — or
217
+ * idled out — succeeds and says so, because that is the state you asked for.
218
+ */
219
+ /**
220
+ * Release a page. Idempotent: closing one that is already gone is the state
221
+ * the caller asked for, so it succeeds rather than erroring — an agent
222
+ * closing in a `finally` must not be punished for a slow task.
223
+ *
224
+ * `wasOpen` says whether anything was actually released. It is false for an
225
+ * id that is not open FOR YOU, which covers a mistyped id, one that idled
226
+ * out, and one that was closed earlier — deliberately not told apart, since
227
+ * three different answers would let an 8-character id be probed for
228
+ * existence across accounts.
229
+ */
230
+ closeSession(id) {
231
+ return live.closeSession(this.http, id);
232
+ }
233
+ // ---- library & memory --------------------------------------------------
234
+ /** Recorded runs (demo / agent / live-channel), newest first. */
235
+ sessions(query = {}) {
236
+ return library.sessions(this.http, query);
237
+ }
238
+ /** A recorded session with its replay frames, tool trace, and answer. */
239
+ recordedSession(id) {
240
+ return library.recordedSession(this.http, id);
241
+ }
242
+ history(limit = 50) {
243
+ return library.history(this.http, limit);
244
+ }
245
+ domains() {
246
+ return library.domains(this.http);
247
+ }
248
+ // ---- act-allowlist -----------------------------------------------------
249
+ /** Sites the agent may act on WITHOUT asking (the free bucket only). */
250
+ permissions() {
251
+ return perms.permissions(this.http);
252
+ }
253
+ /**
254
+ * Every saved site with its mode. This — not permissions() — is what "may I act
255
+ * here?" must read: BOTH `free` and `approve` permit acting (approve just asks
256
+ * the human per action); only `read` does not. permissions() returns free-only,
257
+ * so a site granted "Ask each time" is invisible to it — which made agents give
258
+ * up on approve-granted sites they were in fact allowed to act on.
259
+ */
260
+ /**
261
+ * The act-allowlist AND whether this key is exempt from it.
262
+ *
263
+ * `permissionEntries` returns the granted hosts and nothing else, which reads
264
+ * as "these and no others" — wrong for a key carrying any-site, whose list is
265
+ * usually empty precisely because it needs no grants. Callers that decide
266
+ * whether to ATTEMPT something must use this one; the older method stays for
267
+ * callers that only want to display the grants.
268
+ */
269
+ permissionScope() {
270
+ return perms.permissionScope(this.http);
271
+ }
272
+ permissionEntries() {
273
+ return perms.permissionEntries(this.http);
274
+ }
275
+ /**
276
+ * A deep link that opens the dashboard set up to unblock a site — the Add-login
277
+ * drawer for a missing login (mode "credential", the default), or the Sites
278
+ * grant for a missing permission (mode "permission"). Hand this to a person so
279
+ * they fix it in one screen; it carries only the host, never a secret.
280
+ */
281
+ connectLink(host, opts = {}) {
282
+ return perms.connectLink(this.http, host, opts);
283
+ }
284
+ /** Allow the agent to act on a site. Returns the host key that was stored. */
285
+ allow(site) {
286
+ return perms.allow(this.http, site);
287
+ }
288
+ /** Revoke acting on a site. */
289
+ deny(site) {
290
+ return perms.deny(this.http, site);
291
+ }
292
+ // ---- task memory -------------------------------------------------------
293
+ /**
294
+ * Jot a durable note keyed by a short label, scoped to this agent.
295
+ *
296
+ * Survives across sessions — the agent's own scratchpad for task state, not a
297
+ * secret store. Setting the same key again overwrites it. Rejected server-side
298
+ * for an empty/oversized key or value, or when the scratchpad is full.
299
+ */
300
+ remember(key, value) {
301
+ return memory.remember(this.http, key, value);
302
+ }
303
+ recall(keyOrOptions) {
304
+ return memory.recall(this.http, keyOrOptions);
305
+ }
306
+ /** Forget a note. Returns whether one was actually removed. */
307
+ forget(key) {
308
+ return memory.forget(this.http, key);
309
+ }
310
+ // ---- credential vault --------------------------------------------------
311
+ /**
312
+ * Store (or rotate) a secret under a name, scoped to this account+agent.
313
+ *
314
+ * This is the HUMAN path: a person at a dashboard/CLI puts the secret in once,
315
+ * and the agent thereafter fills it by name with a `fill_secret` action,
316
+ * never seeing the value. Returns the name, the account identifier, and the
317
+ * time — never the secret. There is deliberately no method that reads a stored
318
+ * secret back.
319
+ *
320
+ * `username` is the optional account email/login this credential is for, shown
321
+ * back so a login is recognizable. OMIT it on a password rotation to preserve
322
+ * the existing identifier; pass an empty string to clear it.
323
+ *
324
+ * `kind` is "password" (default) or "totp" — for a TOTP, `secret` is the
325
+ * authenticator SEED (a base32 string or otpauth:// URI), and the agent fills
326
+ * the current code with a fill_totp action, never seeing the seed or the code.
327
+ */
328
+ storeCredential(name, secret, username, kind) {
329
+ return vault.storeCredential(this.http, name, secret, username, kind);
330
+ }
331
+ /** The NAMES of the credentials stored for this account+agent. Never values. */
332
+ credentialNames() {
333
+ return vault.credentialNames(this.http);
334
+ }
335
+ /** Delete a stored credential by name. Returns whether one was removed. */
336
+ deleteCredential(name) {
337
+ return vault.deleteCredential(this.http, name);
338
+ }
339
+ /**
340
+ * How this account wants the agent to choose among several sign-in accounts:
341
+ * `askMode` "always" (ask every time a provider is ambiguous) or "remember"
342
+ * (reuse a per-site choice), plus the remembered site→account map. open_page
343
+ * reads this to decide whether to ask or reuse.
344
+ */
345
+ accountPrefs() {
346
+ return vault.accountPrefs(this.http);
347
+ }
348
+ }
349
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AA6B1C,MAAM,OAAO,QAAQ;IACnB;;uCAEmC;IAClB,IAAI,CAAY;IAEjC,YAAY,UAA2B,EAAE;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC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,CAAC;IACvC,CAAC;IAED,2EAA2E;IAE3E;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CACb,IAAY,EACZ,MAAc,EACd,QAAiB,EACjB,IAA0B;QAE1B,OAAO,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,gFAAgF;IAChF,eAAe;QACb,OAAO,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,2EAA2E;IAC3E,gBAAgB,CAAC,IAAY;QAC3B,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACH,YAAY;QACV,OAAO,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The credential vault and the account's sign-in preferences.
3
+ *
4
+ * The bodies of the `Unfenced` methods under `// ---- credential vault`, moved
5
+ * out with only `this.request` -> `http.request`. No method here ever returns a
6
+ * stored secret — that was true before the split and stays true after it.
7
+ */
8
+ import { Transport } from "./http.js";
9
+ import type { AccountPrefs, CredentialName } from "./types.js";
10
+ export declare function storeCredential(http: Transport, name: string, secret: string, username?: string, kind?: "password" | "totp"): Promise<CredentialName>;
11
+ export declare function credentialNames(http: Transport): Promise<CredentialName[]>;
12
+ export declare function deleteCredential(http: Transport, name: string): Promise<boolean>;
13
+ export declare function accountPrefs(http: Transport): Promise<AccountPrefs>;
14
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GACzB,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAI1E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIhF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAEnE"}
@@ -0,0 +1,17 @@
1
+ export function storeCredential(http, name, secret, username, kind) {
2
+ return http.request("POST", "/vault", { name, secret, username, kind });
3
+ }
4
+ export function credentialNames(http) {
5
+ return http
6
+ .request("GET", "/vault")
7
+ .then((r) => r.credentials);
8
+ }
9
+ export function deleteCredential(http, name) {
10
+ return http
11
+ .request("DELETE", `/vault/${encodeURIComponent(name)}`)
12
+ .then((r) => r.removed);
13
+ }
14
+ export function accountPrefs(http) {
15
+ return http.request("GET", "/prefs").then((r) => r.prefs);
16
+ }
17
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,eAAe,CAC7B,IAAe,EACf,IAAY,EACZ,MAAc,EACd,QAAiB,EACjB,IAA0B;IAE1B,OAAO,IAAI,CAAC,OAAO,CAAiB,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,OAAO,IAAI;SACR,OAAO,CAAoC,KAAK,EAAE,QAAQ,CAAC;SAC3D,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAe,EAAE,IAAY;IAC5D,OAAO,IAAI;SACR,OAAO,CAAuB,QAAQ,EAAE,UAAU,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;SAC7E,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,OAAO,IAAI,CAAC,OAAO,CAA0B,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The fetch tier of the client: one URL, a batch, and a batch on a deadline.
3
+ *
4
+ * These are the bodies of `Unfenced.fetch`/`batch`/`batchWithin`, moved out
5
+ * verbatim and re-shaped from methods to functions that take a `Transport`.
6
+ * `this.request` became `http.request`, `this.awaitJob` and `this.fetch` became
7
+ * the module-local `awaitJob` and `fetch` below; nothing else changed. The error
8
+ * helpers (`errorCodeOf`, `targetRejection`, `toFetchFailure`) live here because
9
+ * fetch is their only caller. URL identity is shared with the worker.
10
+ */
11
+ import { Transport } from "./http.js";
12
+ import type { FetchOptions, FetchResult } from "./types.js";
13
+ export declare function fetch(http: Transport, url: string, options?: FetchOptions, retryBusy?: boolean, cancelOnTimeout?: boolean): Promise<FetchResult>;
14
+ export declare function batch(http: Transport, urls: string[], options?: FetchOptions): Promise<FetchResult[]>;
15
+ export declare function batchWithin(http: Transport, urls: string[], deadlineMs: number, options?: FetchOptions): Promise<FetchResult[]>;
16
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAmD,MAAM,WAAW,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA+M5D,wBAAsB,KAAK,CACzB,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,YAAiB,EAC1B,SAAS,UAAQ,EACjB,eAAe,UAAQ,GACtB,OAAO,CAAC,WAAW,CAAC,CA4FtB;AAED,wBAAsB,KAAK,CACzB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC,CAmCxB;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC,CAsExB"}