@tangle-network/sandbox 0.63.20 → 0.63.22

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 (65) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +5 -5
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +2 -2
  5. package/dist/{agent-run-outcome-DlYhZnhD.d.ts → agent-run-outcome-C-VR-L0I.d.ts} +1 -1
  6. package/dist/auth/index.d.ts +2 -2
  7. package/dist/auth/index.js +1 -1
  8. package/dist/{backend-types-D6bYbvMB.js → backend-types-zuUBEJO1.js} +35 -1
  9. package/dist/{browser-interactive-control-controller-B6sySQFu.d.ts → browser-interactive-control-controller-CvObO_Kf.d.ts} +1 -1
  10. package/dist/{browser-interactive-control-controller-BJf0P_J4.js → browser-interactive-control-controller-DHx53yre.js} +16 -1
  11. package/dist/{chunked-upload-KJyRCAiC.js → chunked-upload-DN2twsUu.js} +1 -1
  12. package/dist/{chunked-upload-file-DfiGzqaR.js → chunked-upload-file-Dpv1YsoA.js} +2 -2
  13. package/dist/{cli-auth-bundle-CMgB8Ec3.js → cli-auth-bundle-R0Y7rngn.js} +8 -8
  14. package/dist/{client-Dl22CVOz.js → client-CGcWP4FX.js} +3271 -3271
  15. package/dist/client-CqpKC6n3.d.ts +6066 -0
  16. package/dist/collaboration/index.d.ts +1 -1
  17. package/dist/collaboration/index.js +1 -1
  18. package/dist/{collaboration-XHg5BEUI.js → collaboration-g_HzXa6f.js} +1 -1
  19. package/dist/core.d.ts +6 -7
  20. package/dist/core.js +5 -5
  21. package/dist/{direct-http2-Dq7tq6jV.js → direct-http2-CoGVOqVR.js} +1 -1
  22. package/dist/{errors-AB5BD3FM.js → errors-BfbOP_rx.js} +19 -1
  23. package/dist/{sandbox-DDdPhk2j.d.ts → index-D4OBUP5M.d.ts} +2105 -1461
  24. package/dist/index.d.ts +12 -4747
  25. package/dist/index.js +15 -11
  26. package/dist/intelligence/index.js +1 -1
  27. package/dist/interactive-control.d.ts +1 -1
  28. package/dist/interactive-control.js +1 -1
  29. package/dist/{interactive-controller-BSWoA0YE.d.ts → interactive-controller-BBwB_5QQ.d.ts} +3 -2
  30. package/dist/{interactive-controller-zE6hwv3C.js → interactive-controller-D4N4zqmu.js} +578 -610
  31. package/dist/{lines-hsXVdk60.d.ts → lines-5m11CEj-.d.ts} +21 -17
  32. package/dist/lines-C5ER4aN_.js +298 -0
  33. package/dist/lines.d.ts +1 -1
  34. package/dist/lines.js +1 -295
  35. package/dist/{local-cli-auth-C4QcPdZt.js → local-cli-auth-DVUBOY4y.js} +1 -1
  36. package/dist/{mcp-local-BYHcA72Z.js → mcp-local-BjLG7VHY.js} +1 -1
  37. package/dist/{preview-D8UAF7F9.d.ts → preview-CcJBQSjB.d.ts} +3 -3
  38. package/dist/{public-templates-BP3sTaSb.d.ts → public-templates-nv4AFFVc.d.ts} +2 -2
  39. package/dist/public-templates.d.ts +1 -1
  40. package/dist/public-templates.js +1 -1
  41. package/dist/runtime.d.ts +47 -40
  42. package/dist/runtime.js +4 -4
  43. package/dist/{sandbox-BJkpVtLN.js → sandbox-BDgvO9Z3.js} +9256 -9215
  44. package/dist/{secp256k1-DoWlH6ff.js → secp256k1-CmLpsmWl.js} +1 -1
  45. package/dist/session-gateway/index.d.ts +16 -17
  46. package/dist/session-gateway/index.js +20 -23
  47. package/dist/tangle/index.d.ts +1 -1
  48. package/dist/tangle/index.js +1 -1
  49. package/dist/{tangle-BBpguPfj.js → tangle-D-VfQGTu.js} +144 -138
  50. package/dist/terminal-stream-types-ClZCArRg.d.ts +662 -0
  51. package/dist/{types-BxZX2EVj.d.ts → types-BjyQe_CI.d.ts} +393 -315
  52. package/package.json +6 -6
  53. package/dist/client-DraGbXEP.d.ts +0 -1249
  54. package/dist/error-classes-BWS1a9HO.d.ts +0 -321
  55. package/dist/index-xS3mRl69.d.ts +0 -578
  56. package/dist/managed-process-B-pXdMLC.d.ts +0 -15
  57. package/dist/terminal-stream-DgD7GlFi.d.ts +0 -388
  58. /package/dist/{cli-auth-bundle-BKsrsbxy.d.ts → cli-auth-bundle-Dyw3hCGx.d.ts} +0 -0
  59. /package/dist/{index-DfA_usrZ.d.ts → index-C8VSFtWl.d.ts} +0 -0
  60. /package/dist/{index-CWUW8pqr.d.ts → index-CVjTnRWP.d.ts} +0 -0
  61. /package/dist/{keep-alive-fetch-CXvfSczd.js → keep-alive-fetch-CuwGi7gz.js} +0 -0
  62. /package/dist/{line-application-UtPFP0o4.js → line-application-DY9ZTdgF.js} +0 -0
  63. /package/dist/{preview-operations-Bvo5YcIq.js → preview-operations-Ca02vPDJ.js} +0 -0
  64. /package/dist/{raw-evidence-archive-Bxk6fUjS.js → raw-evidence-archive-CDYDqHNv.js} +0 -0
  65. /package/dist/{utils-B6gap92T.js → utils-BGvM02yJ.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { Ya as BackendConfig, yr as CreateSandboxOptions } from "./types-BxZX2EVj.js";
1
+ import { ja as BackendConfig, mr as CreateSandboxOptions } from "./types-BjyQe_CI.js";
2
2
 
3
3
  //#region src/line-application.d.ts
4
4
  /** Bounded callback request bytes after canonicalization, including JSON framing. */
@@ -73,7 +73,7 @@ declare function parseLineApplicationRequest(value: unknown): LineApplicationReq
73
73
  /** A raw agent response is not this receipt. Applications report only settled output. */
74
74
  declare function parseLineApplicationResult(value: unknown, request: Pick<LineApplicationRequest, "binding" | "messageId" | "attachmentId" | "acceptedExecutionId">): LineApplicationResult;
75
75
  //#endregion
76
- //#region src/lines.d.ts
76
+ //#region src/line-types.d.ts
77
77
  /** The transport a line carries. */
78
78
  type LineTransport = "imessage" | "sms" | "whatsapp" | "email" | "telegram" | "voice";
79
79
  /** What a role's members share and may do in the attached sandbox. */
@@ -338,20 +338,6 @@ type LineApplicationAttachOptions = Omit<LineAttachOptions, "mode" | "members" |
338
338
  };
339
339
  limits?: Omit<Partial<LineLimits>, "allowance">;
340
340
  };
341
- /**
342
- * The instance key that serves one member: `keyPrefix` plus the first 32 hex
343
- * characters of the SHA-256 of the member's address as Hub stores it (E.164,
344
- * or a lowercased email). It depends only on the prefix and the address, so a
345
- * person keeps their box across re-attaches, and your own code can reach it
346
- * with `client.instances.ensure({ key })`. This helper applies only to
347
- * address-bound members. Hub derives a different key for `subjectId` members.
348
- */
349
- declare function lineInstanceKey(keyPrefix: string, address: string): Promise<string>;
350
- /** Stable setup retry identity. This label never grants profile or line access. */
351
- declare function profileChannelReference(profileId: string, input: Pick<LineFromConnectionInput, "connectionId" | "transport"> & {
352
- phoneNumberId?: string;
353
- address?: string;
354
- }): Promise<string>;
355
341
  /** Fields shared by line creation from an owned Hub connection. */
356
342
  interface LineFromConnectionCommon {
357
343
  connectionId: string;
@@ -573,6 +559,24 @@ interface LineMessage {
573
559
  interface LinesHttpClient {
574
560
  fetch(path: string, options?: RequestInit): Promise<Response>;
575
561
  }
562
+ //#endregion
563
+ //#region src/line-identity.d.ts
564
+ /**
565
+ * The instance key that serves one member: `keyPrefix` plus the first 32 hex
566
+ * characters of the SHA-256 of the member's address as Hub stores it (E.164,
567
+ * or a lowercased email). It depends only on the prefix and the address, so a
568
+ * person keeps their box across re-attaches, and your own code can reach it
569
+ * with `client.instances.ensure({ key })`. This helper applies only to
570
+ * address-bound members. Hub derives a different key for `subjectId` members.
571
+ */
572
+ declare function lineInstanceKey(keyPrefix: string, address: string): Promise<string>;
573
+ /** Stable setup retry identity. This label never grants profile or line access. */
574
+ declare function profileChannelReference(profileId: string, input: Pick<LineFromConnectionInput, "connectionId" | "transport"> & {
575
+ phoneNumberId?: string;
576
+ address?: string;
577
+ }): Promise<string>;
578
+ //#endregion
579
+ //#region src/lines.d.ts
576
580
  /** `client.lines`: your lines, their members and their threads. */
577
581
  declare class LinesClient {
578
582
  private readonly http;
@@ -685,4 +689,4 @@ declare class SandboxLines {
685
689
  detach(number: string): Promise<void>;
686
690
  }
687
691
  //#endregion
688
- export { LineSendReceipt as A, lineInstanceKey as B, LineReplyCode as C, LineRespondView as D, LineRespondAgent as E, LineVoice as F, LineApplicationRequest as G, LINE_APPLICATION_REPLY_MAX_CHARS as H, LineVoiceOptions as I, LineApplicationView as J, LineApplicationResult as K, LinesClient as L, LineSenderVerificationStart as M, LineThread as N, LineRole as O, LineTransport as P, LinesHttpClient as R, LineReminderPreferences as S, LineReplyGate as T, LINE_APPLICATION_REQUEST_MAX_BYTES as U, profileChannelReference as V, LineApplication as W, parseLineApplicationResult as X, parseLineApplicationRequest as Y, LineMemberPatch as _, LineApplicationAttachOptions as a, LineNumberInventory as b, LineAttachmentReauthorization as c, LineImage as d, LineInstanceAttachOptions as f, LineMemberInstance as g, LineMember as h, LineAllowanceSubject as i, LineSenderVerification as j, LineSendInput as k, LineExecutionKey as l, LineLimits as m, LineAgentRolePolicy as n, LineAttachOptions as o, LineInstanceCreate as p, LineApplicationState as q, LineAllowance as r, LineAttachment as s, Line as t, LineFromConnectionInput as u, LineMemberSpec as v, LineReplyCodeInput as w, LineProvider as x, LineMessage as y, SandboxLines as z };
692
+ export { LineRespondAgent as A, LineVoiceOptions as B, LineMessage as C, LineReplyCode as D, LineReminderPreferences as E, LineSenderVerification as F, LineApplicationRequest as G, LINE_APPLICATION_REPLY_MAX_CHARS as H, LineSenderVerificationStart as I, LineApplicationView as J, LineApplicationResult as K, LineThread as L, LineRole as M, LineSendInput as N, LineReplyCodeInput as O, LineSendReceipt as P, LineTransport as R, LineMemberSpec as S, LineProvider as T, LINE_APPLICATION_REQUEST_MAX_BYTES as U, LinesHttpClient as V, LineApplication as W, parseLineApplicationResult as X, parseLineApplicationRequest as Y, LineInstanceCreate as _, Line as a, LineMemberInstance as b, LineAllowanceSubject as c, LineAttachment as d, LineAttachmentReauthorization as f, LineInstanceAttachOptions as g, LineImage as h, profileChannelReference as i, LineRespondView as j, LineReplyGate as k, LineApplicationAttachOptions as l, LineFromConnectionInput as m, SandboxLines as n, LineAgentRolePolicy as o, LineExecutionKey as p, LineApplicationState as q, lineInstanceKey as r, LineAllowance as s, LinesClient as t, LineAttachOptions as u, LineLimits as v, LineNumberInventory as w, LineMemberPatch as x, LineMember as y, LineVoice as z };
@@ -0,0 +1,298 @@
1
+ import { T as ValidationError, n as parseErrorResponse } from "./errors-BfbOP_rx.js";
2
+ //#region src/line-identity.ts
3
+ /**
4
+ * The instance key that serves one member: `keyPrefix` plus the first 32 hex
5
+ * characters of the SHA-256 of the member's address as Hub stores it (E.164,
6
+ * or a lowercased email). It depends only on the prefix and the address, so a
7
+ * person keeps their box across re-attaches, and your own code can reach it
8
+ * with `client.instances.ensure({ key })`. This helper applies only to
9
+ * address-bound members. Hub derives a different key for `subjectId` members.
10
+ */
11
+ async function lineInstanceKey(keyPrefix, address) {
12
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(address));
13
+ return `${keyPrefix}${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 32)}`;
14
+ }
15
+ /** Stable setup retry identity. This label never grants profile or line access. */
16
+ async function profileChannelReference(profileId, input) {
17
+ if (!/^ap_[A-Za-z0-9_-]{1,61}$/.test(profileId)) throw new ValidationError("Use a stored Platform profile ID");
18
+ const identity = JSON.stringify([
19
+ input.connectionId,
20
+ input.transport,
21
+ input.phoneNumberId ?? null,
22
+ input.address?.trim().toLowerCase() ?? null
23
+ ]);
24
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(identity));
25
+ return `profile:${profileId}:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 32)}`;
26
+ }
27
+ //#endregion
28
+ //#region src/lines.ts
29
+ /**
30
+ * Lines: give a sandbox a phone number or messaging address.
31
+ *
32
+ * A line is an address that Tangle Hub receives on, such as an Inkbox
33
+ * iMessage identity or Linq WhatsApp number. Attaching it to a sandbox makes
34
+ * Hub route each inbound message to that sandbox. Each member gets a separate
35
+ * thread in its own agent session. Hub sends the agent's answer on the same
36
+ * line. Hub owns routing, consent (STOP/START), unknown senders and
37
+ * metering, so an app only chooses who may text and in which mode.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const line = await client.lines.fromConnection({ connectionId, transport: "imessage" });
42
+ * await box.lines.attach({
43
+ * number: line.id,
44
+ * mode: "personal",
45
+ * members: [{ address: "+15550100001", role: "owner" }],
46
+ * });
47
+ * // Text `line.connect` to `line.routerAddress`, then write to the agent.
48
+ * ```
49
+ *
50
+ * A line can also give every member their own sandbox, so a public line
51
+ * serves each person from an isolated box with its own files:
52
+ *
53
+ * ```ts
54
+ * await client.lines.attach({
55
+ * number: line.id,
56
+ * mode: "shared",
57
+ * members: [{ address: "+15550100001", role: "owner" }],
58
+ * unknownSenders: "guest",
59
+ * roles: { owner: { context: "own", tools: "act" }, guest: { context: "own", tools: "act" } },
60
+ * instance: { keyPrefix: "person:", create: { idleTimeoutSeconds: 600 } },
61
+ * });
62
+ * ```
63
+ */
64
+ const LINE_ID = /^ln_[A-Za-z0-9_-]+$/;
65
+ async function hubData(response) {
66
+ const body = await response.text();
67
+ if (!response.ok) throw parseErrorResponse(response.status, body, void 0, response.headers);
68
+ const parsed = JSON.parse(body);
69
+ if (parsed.success !== true || parsed.data === void 0) throw parseErrorResponse(502, body, void 0, response.headers);
70
+ return parsed.data;
71
+ }
72
+ function json(method, body) {
73
+ return {
74
+ method,
75
+ headers: { "Content-Type": "application/json" },
76
+ body: JSON.stringify(body)
77
+ };
78
+ }
79
+ /** `client.lines`: your lines, their members and their threads. */
80
+ var LinesClient = class {
81
+ constructor(http) {
82
+ this.http = http;
83
+ }
84
+ /**
85
+ * Create a line from an owned Inkbox or Linq connection, or return the line
86
+ * already pinned to that provider identity. Hub owns inbound routing and
87
+ * never re-keys the connection.
88
+ */
89
+ async fromConnection(input) {
90
+ return (await hubData(await this.http.fetch("/v1/lines", json("POST", input)))).line;
91
+ }
92
+ /** Your lines. `sandboxId` narrows to lines attached to that sandbox. */
93
+ async list(options = {}) {
94
+ const params = new URLSearchParams();
95
+ if (options.sandboxId) params.set("sandboxId", options.sandboxId);
96
+ if (options.profileId) params.set("profileId", options.profileId);
97
+ const query = params.size ? `?${params}` : "";
98
+ return (await hubData(await this.http.fetch(`/v1/lines${query}`))).lines;
99
+ }
100
+ /** Supported combinations from the maintained host channel catalog. */
101
+ async providers() {
102
+ return (await hubData(await this.http.fetch("/v1/lines/providers"))).providers;
103
+ }
104
+ /** Metadata only; no reservation and no provider credentials are returned. */
105
+ async numbers(connectionId, transport) {
106
+ const params = new URLSearchParams({
107
+ connectionId,
108
+ transport
109
+ });
110
+ return hubData(await this.http.fetch(`/v1/lines/numbers?${params}`));
111
+ }
112
+ /** Choose the payer/execution authority for a cookie-authenticated attachment. */
113
+ async executionKeys() {
114
+ return (await hubData(await this.http.fetch("/v1/lines/execution-keys"))).keys;
115
+ }
116
+ async get(lineId) {
117
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`))).line;
118
+ }
119
+ /** A line id for a line id or one of your lines' addresses. */
120
+ async resolve(number) {
121
+ if (LINE_ID.test(number)) return number;
122
+ const line = (await this.list()).find((l) => l.address === number);
123
+ if (!line) throw new ValidationError(`No line with address ${number}`);
124
+ return line.id;
125
+ }
126
+ /** Start a signed Inkbox iMessage owner-handset test for an unattached line. */
127
+ async startSenderVerification(number) {
128
+ const lineId = await this.resolve(number);
129
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/sender-verifications`, json("POST", {})));
130
+ }
131
+ /** Read proof state with the same owner API key that started the test. */
132
+ async getSenderVerification(number, testId) {
133
+ if (!/^lsv_[A-Za-z0-9_-]+$/.test(testId)) throw new ValidationError("A valid sender verification id is required");
134
+ const lineId = await this.resolve(number);
135
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/sender-verifications/${encodeURIComponent(testId)}`));
136
+ }
137
+ /**
138
+ * Attach a line to member sandboxes or one application callback. Hub checks
139
+ * the owner key and keeps one active attachment. The callback must resolve
140
+ * each declared customer's subject to its own authorized private target.
141
+ */
142
+ async attach(options) {
143
+ const lineId = await this.resolve(options.number);
144
+ const { number: _number, ...rest } = options;
145
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, json("PUT", rest)))).attachment;
146
+ }
147
+ /** Bind the current API key to this same attachment after app key rotation.
148
+ * Hub checks the observed attachment and old key, app key lineage, owner,
149
+ * workspace and sandbox. A race leaves the existing binding unchanged.
150
+ */
151
+ async reauthorizeAttachment(number, expected) {
152
+ if (!/^lat_[A-Za-z0-9_-]+$/.test(expected.expectedAttachmentId)) throw new ValidationError("A valid expected attachment id is required");
153
+ if (!/^key_[A-Za-z0-9_-]+$/.test(expected.expectedRunAsKeyId)) throw new ValidationError("A valid expected execution key id is required");
154
+ const lineId = await this.resolve(number);
155
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment/reauthorize`, json("PUT", expected)))).attachment;
156
+ }
157
+ /**
158
+ * Detach a line (by id or address), whatever it is attached to. This is
159
+ * the way to detach a line attached with `instance`, which names no
160
+ * sandbox. Each member's own sandbox stays under its instance key. Returns
161
+ * false when the line was not attached.
162
+ */
163
+ async detach(number, options = {}) {
164
+ if (options.expectedAttachmentId !== void 0 && !/^lat_[A-Za-z0-9_-]+$/.test(options.expectedAttachmentId)) throw new ValidationError("Invalid expected attachment identity");
165
+ const lineId = await this.resolve(number);
166
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, {
167
+ method: "DELETE",
168
+ ...options.expectedAttachmentId ? { headers: { "if-match": `"${options.expectedAttachmentId}"` } } : {}
169
+ }))).detached;
170
+ }
171
+ /** Detach only this observed attachment. A replacement is left untouched.
172
+ * The distinct native route makes older hosts refuse rather than ignore
173
+ * the condition. This never falls back to unconditional line detachment.
174
+ */
175
+ async detachAttachment(number, attachmentId) {
176
+ if (!/^[A-Za-z0-9_-]{1,256}$/.test(attachmentId)) throw new ValidationError("A valid expected attachment id is required");
177
+ const lineId = await this.resolve(number);
178
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachments/${encodeURIComponent(attachmentId)}`, { method: "DELETE" }))).detached;
179
+ }
180
+ /**
181
+ * Retire a detached line's Hub routing and free its workspace transport slot.
182
+ * Hub refuses an attached or voice-enabled line. A retry by line id returns
183
+ * false; the provider connection and message history remain.
184
+ */
185
+ async release(number) {
186
+ const lineId = await this.resolve(number);
187
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, { method: "DELETE" }))).released;
188
+ }
189
+ /**
190
+ * Take calls for an active Hub line. Without a phone number ID, the line
191
+ * must be Inkbox iMessage; Hub changes its call action and adds
192
+ * `ask_workspace` to the agent. With an owned ph0ny phone number ID, Hub
193
+ * binds that Twilio number to the line's admission hook and leaves the
194
+ * line's provider call settings unchanged.
195
+ */
196
+ async enableVoice(lineId, options) {
197
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: {
198
+ enabled: true,
199
+ ph0ny: {
200
+ connectionId: options.ph0nyConnectionId,
201
+ agentId: options.ph0nyAgentId,
202
+ ...options.ph0nyPhoneNumberId ? { phoneNumberId: options.ph0nyPhoneNumberId } : {}
203
+ }
204
+ } })))).line;
205
+ }
206
+ /** Stop taking calls on a line: Hub refuses them and Inkbox rejects them. */
207
+ async disableVoice(lineId) {
208
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: { enabled: false } })))).line;
209
+ }
210
+ /**
211
+ * Queue a proactive message to an active, consenting member. Hub reuses the
212
+ * member's authenticated provider conversation, rechecks STOP immediately
213
+ * before delivery, and defers delivery during the recipient's saved quiet hours.
214
+ */
215
+ async send(lineId, input) {
216
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/send`, json("POST", input)));
217
+ }
218
+ /** Read the native outbox receipt. Queued is not a delivery confirmation. */
219
+ async sentMessage(lineId, messageId) {
220
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/outbox/${encodeURIComponent(messageId)}`));
221
+ }
222
+ /** Only the recipient's proven message can enable reminders or choose quiet hours. */
223
+ async reminders(lineId, memberId) {
224
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/members/${encodeURIComponent(memberId)}/reminders`));
225
+ }
226
+ /** Members of the line's active attachment. */
227
+ members(lineId) {
228
+ const base = `/v1/lines/${encodeURIComponent(lineId)}/members`;
229
+ const http = this.http;
230
+ return {
231
+ async list() {
232
+ return (await hubData(await http.fetch(base))).members;
233
+ },
234
+ async add(spec) {
235
+ return (await hubData(await http.fetch(base, json("POST", spec)))).member;
236
+ },
237
+ async update(memberId, patch) {
238
+ return (await hubData(await http.fetch(`${base}/${encodeURIComponent(memberId)}`, json("PATCH", patch)))).member;
239
+ },
240
+ async remove(memberId) {
241
+ await hubData(await http.fetch(`${base}/${encodeURIComponent(memberId)}`, { method: "DELETE" }));
242
+ }
243
+ };
244
+ }
245
+ /** Read one retained message without depending on a recent-message page. */
246
+ async message(lineId, messageId) {
247
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/messages/${encodeURIComponent(messageId)}`))).message;
248
+ }
249
+ /** Threads of a line (one per member) and their messages, newest first. */
250
+ threads(lineId) {
251
+ const base = `/v1/lines/${encodeURIComponent(lineId)}/threads`;
252
+ const http = this.http;
253
+ return {
254
+ async list() {
255
+ return (await hubData(await http.fetch(base))).threads;
256
+ },
257
+ async messages(threadId) {
258
+ return (await hubData(await http.fetch(`${base}/${encodeURIComponent(threadId)}/messages`))).messages;
259
+ }
260
+ };
261
+ }
262
+ };
263
+ /** `sandbox.lines`: attach lines to this sandbox. */
264
+ var SandboxLines = class {
265
+ lines;
266
+ constructor(http, sandboxId) {
267
+ this.http = http;
268
+ this.sandboxId = sandboxId;
269
+ this.lines = new LinesClient(http);
270
+ }
271
+ /**
272
+ * Attach a line to this sandbox. Hub checks that your API key can run this
273
+ * sandbox, and each turn runs as a short-lived child of that key. Attaching
274
+ * again with the same options returns the same attachment.
275
+ */
276
+ async attach(options) {
277
+ const lineId = await this.lines.resolve(options.number);
278
+ const { number: _number, ...rest } = options;
279
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, json("PUT", {
280
+ ...rest,
281
+ sandboxId: this.sandboxId
282
+ })))).attachment;
283
+ }
284
+ /** Lines attached to this sandbox. */
285
+ async list() {
286
+ return this.lines.list({ sandboxId: this.sandboxId });
287
+ }
288
+ /** Detach a line (by id or address) from this sandbox. */
289
+ async detach(number) {
290
+ const lineId = await this.lines.resolve(number);
291
+ const line = await this.lines.get(lineId);
292
+ if (!line.attachment) return;
293
+ if (line.attachment.sandboxId !== this.sandboxId) throw new ValidationError(`Line ${lineId} is attached to another sandbox`);
294
+ await this.lines.detachAttachment(lineId, line.attachment.id);
295
+ }
296
+ };
297
+ //#endregion
298
+ export { profileChannelReference as i, SandboxLines as n, lineInstanceKey as r, LinesClient as t };
package/dist/lines.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as LineSendReceipt, B as lineInstanceKey, C as LineReplyCode, D as LineRespondView, E as LineRespondAgent, F as LineVoice, I as LineVoiceOptions, L as LinesClient, M as LineSenderVerificationStart, N as LineThread, O as LineRole, P as LineTransport, R as LinesHttpClient, S as LineReminderPreferences, T as LineReplyGate, V as profileChannelReference, _ as LineMemberPatch, a as LineApplicationAttachOptions, b as LineNumberInventory, c as LineAttachmentReauthorization, d as LineImage, f as LineInstanceAttachOptions, g as LineMemberInstance, h as LineMember, i as LineAllowanceSubject, j as LineSenderVerification, k as LineSendInput, l as LineExecutionKey, m as LineLimits, n as LineAgentRolePolicy, o as LineAttachOptions, p as LineInstanceCreate, r as LineAllowance, s as LineAttachment, t as Line, u as LineFromConnectionInput, v as LineMemberSpec, w as LineReplyCodeInput, x as LineProvider, y as LineMessage, z as SandboxLines } from "./lines-hsXVdk60.js";
1
+ import { A as LineRespondAgent, B as LineVoiceOptions, C as LineMessage, D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, I as LineSenderVerificationStart, L as LineThread, M as LineRole, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, R as LineTransport, S as LineMemberSpec, T as LineProvider, V as LinesHttpClient, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, c as LineAllowanceSubject, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, j as LineRespondView, k as LineReplyGate, l as LineApplicationAttachOptions, m as LineFromConnectionInput, n as SandboxLines, o as LineAgentRolePolicy, p as LineExecutionKey, r as lineInstanceKey, s as LineAllowance, t as LinesClient, u as LineAttachOptions, v as LineLimits, w as LineNumberInventory, x as LineMemberPatch, y as LineMember, z as LineVoice } from "./lines-5m11CEj-.js";
2
2
  export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineApplicationAttachOptions, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineImage, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };