@tangle-network/sandbox 0.58.0 → 0.58.1
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.
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +3 -3
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/{agent-run-outcome-DV-9cNsk.d.ts → agent-run-outcome-CJP18Ip8.d.ts} +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/{browser-interactive-control-controller-knjCl8Zp.d.ts → browser-interactive-control-controller-1m7jgLeg.d.ts} +1 -1
- package/dist/{client-BMdV_CeM.js → client-BHItHEg0.js} +9 -4
- package/dist/{client-B1I66sl_.d.ts → client-BI0_ZUUS.d.ts} +6 -4
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/core.d.ts +6 -5
- package/dist/core.js +5 -3
- package/dist/{index-CGnI-q1g.d.ts → index-BitiSmBp.d.ts} +2 -2
- package/dist/index.d.ts +12 -11
- package/dist/index.js +6 -4
- package/dist/interactive-control.d.ts +1 -1
- package/dist/line-application-DOg7jrnA.js +100 -0
- package/dist/lines-DLIo-NTB.d.ts +556 -0
- package/dist/lines.d.ts +2 -0
- package/dist/lines.js +273 -0
- package/dist/{local-cli-auth-DfuFJCcs.js → local-cli-auth-N1IYywxf.js} +1 -1
- package/dist/{mcp-local-DXO-9rtB.js → mcp-local-BWsftreI.js} +1 -1
- package/dist/{preview-Bz7TXYSf.d.ts → preview-CVrjEPgk.d.ts} +3 -3
- package/dist/runtime.d.ts +3 -3
- package/dist/{sandbox-DyrDBnjp.js → sandbox-B2kuUBn6.js} +61 -226
- package/dist/{sandbox-BMSWYvdP.d.ts → sandbox-DyPRgt1M.d.ts} +5 -411
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-BtQkJqfz.js → tangle-DCjIsZI0.js} +1 -1
- package/dist/{types-DRyvWIJf.d.ts → types-_Gn4d93t.d.ts} +60 -2
- package/package.json +10 -5
- /package/dist/{cli-auth-bundle-bRJOyaJO.js → cli-auth-bundle-0VjPAtKt.js} +0 -0
- /package/dist/{errors-CNsmhCen.d.ts → errors-AVpynVrG.d.ts} +0 -0
- /package/dist/{index-BN7zNEUB.d.ts → index-C48z7K4r.d.ts} +0 -0
- /package/dist/{index-X4EEZlMi.d.ts → index-D4u-vv87.d.ts} +0 -0
- /package/dist/{preview-operations-Dgbi46FH.js → preview-operations-BhQ4_CF7.js} +0 -0
- /package/dist/{terminal-stream-BW4veIsI.d.ts → terminal-stream-Bf2stNDX.d.ts} +0 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import { B as CreateSandboxOptions, d as BackendConfig } from "./types-_Gn4d93t.js";
|
|
2
|
+
|
|
3
|
+
//#region src/line-application.d.ts
|
|
4
|
+
/** Bounded callback request bytes after canonicalization, including JSON framing. */
|
|
5
|
+
declare const LINE_APPLICATION_REQUEST_MAX_BYTES: number;
|
|
6
|
+
/** Fits the Lines reply splitter and the callback transport's 64 KiB read bound. */
|
|
7
|
+
declare const LINE_APPLICATION_REPLY_MAX_CHARS = 12000;
|
|
8
|
+
/** Application-owned execution over the native Lines inbox and outbox. */
|
|
9
|
+
interface LineApplication {
|
|
10
|
+
/** Public HTTPS endpoint. Hub uses its existing DNS-pinned callback transport. */
|
|
11
|
+
url: string;
|
|
12
|
+
/** Server-to-server verification credential. Never a Sandbox/model credential. */
|
|
13
|
+
secret: string;
|
|
14
|
+
/** Opaque, immutable application scope, supplied by the authenticated host. */
|
|
15
|
+
binding: string;
|
|
16
|
+
}
|
|
17
|
+
/** The public attachment never reveals the callback credential or vault reference. */
|
|
18
|
+
type LineApplicationView = Omit<LineApplication, "secret">;
|
|
19
|
+
/** Hub constructs this from the retained message and current admitted membership. */
|
|
20
|
+
interface LineApplicationRequest {
|
|
21
|
+
version: 1;
|
|
22
|
+
binding: string;
|
|
23
|
+
messageId: string;
|
|
24
|
+
lineId: string;
|
|
25
|
+
attachmentId: string;
|
|
26
|
+
memberId: string;
|
|
27
|
+
lineThreadId: string;
|
|
28
|
+
ownerUserId: string;
|
|
29
|
+
/** Native transport framing is not an application user identity. */
|
|
30
|
+
sender: {
|
|
31
|
+
address: string;
|
|
32
|
+
role: string;
|
|
33
|
+
};
|
|
34
|
+
transport: "imessage" | "sms" | "whatsapp" | "email";
|
|
35
|
+
receivedAt: string;
|
|
36
|
+
/** Once recorded by Hub, recovery may observe only this application execution. */
|
|
37
|
+
acceptedExecutionId?: string;
|
|
38
|
+
text: string;
|
|
39
|
+
}
|
|
40
|
+
type LineApplicationState = {
|
|
41
|
+
state: "pending";
|
|
42
|
+
admitted: false;
|
|
43
|
+
} | {
|
|
44
|
+
state: "pending";
|
|
45
|
+
admitted: true;
|
|
46
|
+
executionId: string;
|
|
47
|
+
} | {
|
|
48
|
+
state: "completed";
|
|
49
|
+
executionId: string;
|
|
50
|
+
text: string;
|
|
51
|
+
} | {
|
|
52
|
+
state: "failed";
|
|
53
|
+
code: string;
|
|
54
|
+
executionId?: string;
|
|
55
|
+
};
|
|
56
|
+
/** Scope is echoed so a cached response cannot answer another attachment or message. */
|
|
57
|
+
type LineApplicationResult = LineApplicationState & {
|
|
58
|
+
version: 1;
|
|
59
|
+
binding: string;
|
|
60
|
+
messageId: string;
|
|
61
|
+
attachmentId: string;
|
|
62
|
+
};
|
|
63
|
+
/** Canonicalize only defined fields. Unknown provider payloads and credentials stay out. */
|
|
64
|
+
declare function parseLineApplicationRequest(value: unknown): LineApplicationRequest;
|
|
65
|
+
/** A raw agent response is not this receipt. Applications report only settled output. */
|
|
66
|
+
declare function parseLineApplicationResult(value: unknown, request: Pick<LineApplicationRequest, "binding" | "messageId" | "attachmentId" | "acceptedExecutionId">): LineApplicationResult;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/lines.d.ts
|
|
69
|
+
/** The transport a line carries. */
|
|
70
|
+
type LineTransport = "imessage" | "sms" | "whatsapp" | "email";
|
|
71
|
+
/** What a role's members share and may do in the attached sandbox. */
|
|
72
|
+
interface LineRole {
|
|
73
|
+
/** `shared`: the member's turns see other shared members' recent exchanges. `own`: they see none, and nobody sees theirs. */
|
|
74
|
+
context: "own" | "shared";
|
|
75
|
+
/** `chat`: the member's session has no shell, cannot read, search or change files, starts no subagents, and gets none of the backend's MCP servers, connections or hooks. */
|
|
76
|
+
tools: "act" | "chat";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* An opt-in, fail-closed role boundary for a general hosted agent. Hub resolves
|
|
80
|
+
* roles from its authenticated member record, never from message text.
|
|
81
|
+
*
|
|
82
|
+
* General access is reserved for owner and manager. Every other role names
|
|
83
|
+
* only its product MCP servers and needs an explicit member backend. Product
|
|
84
|
+
* servers still authorize the enrolled actor; an MCP name grants no authority.
|
|
85
|
+
*/
|
|
86
|
+
interface LineAgentRolePolicy {
|
|
87
|
+
version: 1;
|
|
88
|
+
roles: Record<string, {
|
|
89
|
+
kind: "general";
|
|
90
|
+
} | {
|
|
91
|
+
kind: "scoped";
|
|
92
|
+
mcpServers: string[];
|
|
93
|
+
}>;
|
|
94
|
+
/** Normalized member address -> actor-scoped backend; no shared fallback. */
|
|
95
|
+
members: Record<string, {
|
|
96
|
+
backend: Partial<BackendConfig>;
|
|
97
|
+
}>;
|
|
98
|
+
}
|
|
99
|
+
/** A sender an attachment admits. */
|
|
100
|
+
interface LineMemberSpec {
|
|
101
|
+
/** E.164 number, or the email / Apple ID the sender texts from. */
|
|
102
|
+
address: string;
|
|
103
|
+
/** A role name from the attachment's `roles`. */
|
|
104
|
+
role: string;
|
|
105
|
+
label?: string;
|
|
106
|
+
/** Opaque, owner-verified customer/enrollment identity, not a phone number.
|
|
107
|
+
* With member instances it keys the private home across addresses. A new
|
|
108
|
+
* customer at a recycled address must receive a new subjectId. */
|
|
109
|
+
subjectId?: string;
|
|
110
|
+
/** This member's allowance subject; requires limits.allowance.perMember.
|
|
111
|
+
* The payer never determines the private workspace identity. */
|
|
112
|
+
allowance?: LineAllowanceSubject;
|
|
113
|
+
}
|
|
114
|
+
/** Per-attachment bounds. */
|
|
115
|
+
interface LineLimits {
|
|
116
|
+
turnsPerMemberPerDay: number;
|
|
117
|
+
noticesPerSenderPerDay: number;
|
|
118
|
+
noticesPerLinePerDay: number;
|
|
119
|
+
/**
|
|
120
|
+
* Admit every member turn, text or voice, through this allowance meter
|
|
121
|
+
* (`hub.allowances`) before it runs. A refused turn never runs, and the
|
|
122
|
+
* member gets one notice. When the meter's plan counts dollars on a key
|
|
123
|
+
* resource (`spendResourceType`), Hub runs the turn on a key bound to the
|
|
124
|
+
* payer, so the turn's spend counts toward that payer. A member's box keeps
|
|
125
|
+
* the attribution of the key that created it, so name the meter when an
|
|
126
|
+
* instance line is first attached, or give it a new `keyPrefix`.
|
|
127
|
+
*/
|
|
128
|
+
allowance?: LineAllowance;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The allowance subject of a line's members. A shared line counts each
|
|
132
|
+
* member by a hash of their address (`addr:<32 hex>`); a personal line may
|
|
133
|
+
* name its one member instead.
|
|
134
|
+
*/
|
|
135
|
+
interface LineAllowanceSubject {
|
|
136
|
+
/** Application enrollment counted by the existing allowance meter. */
|
|
137
|
+
member: string;
|
|
138
|
+
/** Whose keys pay for the turn. Default: the member. */
|
|
139
|
+
payer?: string;
|
|
140
|
+
/** Default `member`; the line role never implies the paid `owner` tier. */
|
|
141
|
+
role?: "owner" | "member";
|
|
142
|
+
/** The payer's tier, which sets the dollar cap. Needs `payer`; default `member`. */
|
|
143
|
+
payerRole?: "owner" | "member";
|
|
144
|
+
/** Sent when a payment would lift the limit, for example with a pay link. */
|
|
145
|
+
paywallNotice?: string;
|
|
146
|
+
}
|
|
147
|
+
interface LineAllowance extends Partial<LineAllowanceSubject> {
|
|
148
|
+
meter: string;
|
|
149
|
+
/** Require every declared member to carry its own subjectId and allowance.
|
|
150
|
+
* Only private member instances may use this mode; unknown senders are
|
|
151
|
+
* rejected. Missing bindings never fall back to the owner's allowance. */
|
|
152
|
+
perMember?: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* An HTTPS endpoint that checks each agent answer before Hub sends it.
|
|
156
|
+
*
|
|
157
|
+
* Hub posts `{ ...context, candidate }` with `Authorization: Bearer <secret>`,
|
|
158
|
+
* where `candidate` is the agent's final text. A 2xx JSON response with an
|
|
159
|
+
* `answer` string is the exact body Hub stores and sends, unchanged. A 4xx
|
|
160
|
+
* refuses the answer; a 408, 429, 5xx or timeout is retried. Hub never sends
|
|
161
|
+
* the agent's own text on a gated line, and refuses an answer over 4,000
|
|
162
|
+
* characters instead of cutting it.
|
|
163
|
+
*
|
|
164
|
+
* A gated attachment must reject unknown senders, so no self-enrolled sender
|
|
165
|
+
* can reach a gated answer.
|
|
166
|
+
*/
|
|
167
|
+
interface LineReplyGate {
|
|
168
|
+
url: string;
|
|
169
|
+
/** Sent as a bearer token; write-only, kept in the Hub vault. */
|
|
170
|
+
secret: string;
|
|
171
|
+
/** Up to 8 fixed string fields sent with every candidate. */
|
|
172
|
+
context?: Record<string, string>;
|
|
173
|
+
/** `owner`: answer only declared members with the owner role. Default `members`. */
|
|
174
|
+
audience?: "owner" | "members";
|
|
175
|
+
}
|
|
176
|
+
/** How Hub answers an admitted message. */
|
|
177
|
+
interface LineRespondAgent {
|
|
178
|
+
/** Saved Platform profile owned by the caller. New turns use its latest revision;
|
|
179
|
+
* an admitted run and its retries retain the exact revision they first resolved.
|
|
180
|
+
* Mutually exclusive with backend.profile. */
|
|
181
|
+
profileId?: string;
|
|
182
|
+
kind: "agent";
|
|
183
|
+
/** Use the application's canonical admission and completion instead of dispatching a native turn. */
|
|
184
|
+
application?: LineApplication;
|
|
185
|
+
/** Backend for member sessions. Omit to use the sandbox's default. */
|
|
186
|
+
backend?: Partial<BackendConfig>;
|
|
187
|
+
rolePolicy?: LineAgentRolePolicy;
|
|
188
|
+
gate?: LineReplyGate;
|
|
189
|
+
/** Default true. Set false to disable tapbacks and typing. */
|
|
190
|
+
acknowledgement?: boolean;
|
|
191
|
+
/** Default on for supported channels after durable admission. This does not
|
|
192
|
+
* require a model or running sandbox. Set false to disable read receipts. */
|
|
193
|
+
readReceipts?: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** The stored respond config; the gate's secret is never returned. */
|
|
196
|
+
interface LineRespondView {
|
|
197
|
+
/** Saved Platform profile owned by the caller. New turns use its latest revision;
|
|
198
|
+
* an admitted run and its retries retain the exact revision they first resolved.
|
|
199
|
+
* Mutually exclusive with backend.profile. */
|
|
200
|
+
profileId?: string;
|
|
201
|
+
kind: "agent";
|
|
202
|
+
application?: LineApplicationView;
|
|
203
|
+
backend?: Partial<BackendConfig>;
|
|
204
|
+
rolePolicy?: LineAgentRolePolicy;
|
|
205
|
+
gate?: Omit<LineReplyGate, "secret"> & {
|
|
206
|
+
audience: "owner" | "members";
|
|
207
|
+
};
|
|
208
|
+
acknowledgement: boolean;
|
|
209
|
+
readReceipts?: boolean;
|
|
210
|
+
}
|
|
211
|
+
/** The deployed host's supported creation paths, not a promise of number inventory. */
|
|
212
|
+
interface LineProvider {
|
|
213
|
+
providerId: string;
|
|
214
|
+
transport: LineTransport;
|
|
215
|
+
selection: "number" | "identity" | "mailbox";
|
|
216
|
+
}
|
|
217
|
+
interface LineNumberInventory {
|
|
218
|
+
providerId: string;
|
|
219
|
+
transport: "imessage" | "sms" | "whatsapp";
|
|
220
|
+
selection: "identity" | "number";
|
|
221
|
+
numbers: Array<{
|
|
222
|
+
id: string;
|
|
223
|
+
address: string;
|
|
224
|
+
}>;
|
|
225
|
+
/** False when an adapter cannot attest that its result includes every page. */
|
|
226
|
+
exhaustive: boolean;
|
|
227
|
+
/** Inventory lookup never allocates or purchases a number. */
|
|
228
|
+
reserved: false;
|
|
229
|
+
}
|
|
230
|
+
interface LineExecutionKey {
|
|
231
|
+
id: string;
|
|
232
|
+
name: string;
|
|
233
|
+
expiresAt: string | null;
|
|
234
|
+
}
|
|
235
|
+
interface LineAttachOptions {
|
|
236
|
+
/** Browser session only: explicitly select an owned root key ID. No key bytes.
|
|
237
|
+
* An API-key request can omit it or name only its own key ID. */
|
|
238
|
+
runAsKeyId?: string;
|
|
239
|
+
/** A line id (`ln_...`) or an address of one of your lines. */
|
|
240
|
+
number: string;
|
|
241
|
+
/** `personal`: one owner member. `shared`: many members, one thread each. */
|
|
242
|
+
mode: "personal" | "shared";
|
|
243
|
+
members: LineMemberSpec[];
|
|
244
|
+
/** Default `reject`. `guest` (shared mode) admits unknown senders with the own-context `guest` role, so every role in use must be chat-only unless each member has their own sandbox. */
|
|
245
|
+
unknownSenders?: "reject" | "guest";
|
|
246
|
+
/**
|
|
247
|
+
* Default: owner and member share context and act; guest is own-context and chat-only.
|
|
248
|
+
* One sandbox serves every member, and `act` tools can read every member's session in it.
|
|
249
|
+
* A shared attachment that uses an `own`-context role is refused unless every role in use is `chat`,
|
|
250
|
+
* or each member runs in their own sandbox (`client.lines.attach()` with `instance`).
|
|
251
|
+
*/
|
|
252
|
+
roles?: Record<string, LineRole>;
|
|
253
|
+
respond?: LineRespondAgent;
|
|
254
|
+
limits?: Partial<LineLimits>;
|
|
255
|
+
clientReference?: string;
|
|
256
|
+
}
|
|
257
|
+
/** The sandbox options a member's own sandbox is created with. */
|
|
258
|
+
type LineInstanceCreate = Pick<CreateSandboxOptions, "name" | "environment" | "ownerContext" | "capabilities" | "resources" | "egressPolicy" | "idleTimeoutSeconds" | "maxLifetimeSeconds" | "deleteAfterStoppedSeconds"> & {
|
|
259
|
+
metadata?: Record<string, string>;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Each member runs in their own sandbox: your named instance
|
|
263
|
+
* (`client.instances`) under {@link lineInstanceKey}. Hub creates it on the
|
|
264
|
+
* member's first message, resumes it when stopped and replaces it when
|
|
265
|
+
* deleted. It holds none of your secrets and no SSH access. A member with
|
|
266
|
+
* `subjectId` uses a Hub-derived key bound to that customer and role.
|
|
267
|
+
*/
|
|
268
|
+
interface LineMemberInstance {
|
|
269
|
+
/** 1-100 letters, digits and `. _ : @ -`; the member's key appends 32 hex characters. */
|
|
270
|
+
keyPrefix: string;
|
|
271
|
+
create?: LineInstanceCreate;
|
|
272
|
+
}
|
|
273
|
+
/** `client.lines.attach()` input: every member in their own sandbox. */
|
|
274
|
+
type LineInstanceAttachOptions = LineAttachOptions & {
|
|
275
|
+
instance: LineMemberInstance;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* The instance key that serves one member: `keyPrefix` plus the first 32 hex
|
|
279
|
+
* characters of the SHA-256 of the member's address as Hub stores it (E.164,
|
|
280
|
+
* or a lowercased email). It depends only on the prefix and the address, so a
|
|
281
|
+
* person keeps their box across re-attaches, and your own code can reach it
|
|
282
|
+
* with `client.instances.ensure({ key })`. This helper applies only to
|
|
283
|
+
* address-bound members. Hub derives a different key for `subjectId` members.
|
|
284
|
+
*/
|
|
285
|
+
declare function lineInstanceKey(keyPrefix: string, address: string): Promise<string>;
|
|
286
|
+
/** Stable setup retry identity. This label never grants profile or line access. */
|
|
287
|
+
declare function profileChannelReference(profileId: string, input: Pick<LineFromConnectionInput, "connectionId" | "transport"> & {
|
|
288
|
+
phoneNumberId?: string;
|
|
289
|
+
address?: string;
|
|
290
|
+
}): Promise<string>;
|
|
291
|
+
/** Fields shared by line creation from an owned Hub connection. */
|
|
292
|
+
interface LineFromConnectionCommon {
|
|
293
|
+
connectionId: string;
|
|
294
|
+
label?: string;
|
|
295
|
+
/** Your idempotency reference: the same value returns the same line. */
|
|
296
|
+
clientReference?: string;
|
|
297
|
+
}
|
|
298
|
+
/** Input to `client.lines.fromConnection()`. Phone connections select an owned number. */
|
|
299
|
+
type LineFromConnectionInput = LineFromConnectionCommon & ({
|
|
300
|
+
transport: "imessage" /** Required for a numbered provider; omit for Inkbox identity. */;
|
|
301
|
+
phoneNumberId?: string;
|
|
302
|
+
} /** Inkbox discovers its mailbox; Resend requires an address on a verified domain. */ | {
|
|
303
|
+
transport: "email";
|
|
304
|
+
address?: string;
|
|
305
|
+
phoneNumberId?: never;
|
|
306
|
+
} | {
|
|
307
|
+
transport: "sms";
|
|
308
|
+
phoneNumberId: string;
|
|
309
|
+
} | {
|
|
310
|
+
transport: "whatsapp";
|
|
311
|
+
phoneNumberId: string;
|
|
312
|
+
});
|
|
313
|
+
/** Fields a member update may change. */
|
|
314
|
+
interface LineSendInput {
|
|
315
|
+
memberId: string;
|
|
316
|
+
text: string;
|
|
317
|
+
idempotencyKey: string;
|
|
318
|
+
/** Optional ISO instant less than seven days away. Workflows own schedules. */
|
|
319
|
+
notBefore?: string;
|
|
320
|
+
}
|
|
321
|
+
interface LineSendReceipt {
|
|
322
|
+
message: LineMessage;
|
|
323
|
+
eligibleAt: string | null;
|
|
324
|
+
expiresAt: string;
|
|
325
|
+
}
|
|
326
|
+
interface LineReminderPreferences {
|
|
327
|
+
enabled: boolean;
|
|
328
|
+
timezone: string | null;
|
|
329
|
+
quietStart: string | null;
|
|
330
|
+
quietEnd: string | null;
|
|
331
|
+
consentMessageId: string | null;
|
|
332
|
+
updatedAt: string | null;
|
|
333
|
+
}
|
|
334
|
+
interface LineMemberPatch {
|
|
335
|
+
role?: string;
|
|
336
|
+
label?: string;
|
|
337
|
+
}
|
|
338
|
+
interface LineMember {
|
|
339
|
+
id: string;
|
|
340
|
+
lineId: string;
|
|
341
|
+
attachmentId: string;
|
|
342
|
+
address: string;
|
|
343
|
+
role: string;
|
|
344
|
+
label: string | null;
|
|
345
|
+
subjectId?: string | null;
|
|
346
|
+
allowance?: LineAllowanceSubject | null;
|
|
347
|
+
source: "declared" | "guest" | "onboarded";
|
|
348
|
+
/** `invited` until the member's first message, which is their consent. */
|
|
349
|
+
status: "invited" | "active" | "stopped" | "removed";
|
|
350
|
+
createdAt: string;
|
|
351
|
+
}
|
|
352
|
+
interface LineAttachment {
|
|
353
|
+
id: string;
|
|
354
|
+
lineId: string;
|
|
355
|
+
/** Native execution sandbox or initial application enrollment anchor; empty for member instances. */
|
|
356
|
+
sandboxId: string;
|
|
357
|
+
/** Present when each member runs in their own sandbox. */
|
|
358
|
+
instance?: {
|
|
359
|
+
keyPrefix: string;
|
|
360
|
+
create: LineInstanceCreate;
|
|
361
|
+
};
|
|
362
|
+
mode: "personal" | "shared";
|
|
363
|
+
payer: "owner" | "member";
|
|
364
|
+
unknownSenders: "reject" | "guest" | "onboard";
|
|
365
|
+
roles: Record<string, LineRole>;
|
|
366
|
+
respond: LineRespondView;
|
|
367
|
+
limits: LineLimits;
|
|
368
|
+
status: "active" | "suspended" | "detached";
|
|
369
|
+
clientReference: string | null;
|
|
370
|
+
createdAt: string;
|
|
371
|
+
updatedAt: string;
|
|
372
|
+
/** Present on the attach response. */
|
|
373
|
+
members?: LineMember[];
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Voice on a line. A member calls the line, a ph0ny agent answers, and each
|
|
377
|
+
* question the agent asks with its `ask_workspace` tool runs in the caller's
|
|
378
|
+
* own thread session in the attached sandbox. Hub admits only the
|
|
379
|
+
* attachment's members; voice never onboards a caller.
|
|
380
|
+
*/
|
|
381
|
+
interface LineVoice {
|
|
382
|
+
enabled: boolean;
|
|
383
|
+
/** `enabling` until ph0ny and the provider are both configured. */
|
|
384
|
+
state: "enabling" | "enabled" | "disabled";
|
|
385
|
+
ph0nyConnectionId: string;
|
|
386
|
+
ph0nyAgentId: string;
|
|
387
|
+
updatedAt: string;
|
|
388
|
+
}
|
|
389
|
+
/** Input to `client.lines.enableVoice()`. */
|
|
390
|
+
interface LineVoiceOptions {
|
|
391
|
+
/** Your ph0ny Hub connection (provider `phony`). */
|
|
392
|
+
ph0nyConnectionId: string;
|
|
393
|
+
/** The ph0ny agent that voices the calls; Hub adds its `ask_workspace` tool. */
|
|
394
|
+
ph0nyAgentId: string;
|
|
395
|
+
}
|
|
396
|
+
interface Line {
|
|
397
|
+
id: string;
|
|
398
|
+
transport: LineTransport;
|
|
399
|
+
/** E.164 number, or `@handle` for an identity on Inkbox's shared iMessage router. */
|
|
400
|
+
address: string;
|
|
401
|
+
/** For a shared-router line, the text a person sends to `routerAddress` to reach this line. */
|
|
402
|
+
connect: string | null;
|
|
403
|
+
routerAddress: string | null;
|
|
404
|
+
connectionId: string;
|
|
405
|
+
/** The provider's phone number id, or null for a line without a pinned number. */
|
|
406
|
+
providerNumberId: string | null;
|
|
407
|
+
/** Null means Hub has no verified workspace binding for this line. */
|
|
408
|
+
workspace: {
|
|
409
|
+
resourceType: "workspace";
|
|
410
|
+
resourceId: string;
|
|
411
|
+
} | null;
|
|
412
|
+
label: string | null;
|
|
413
|
+
clientReference: string | null;
|
|
414
|
+
status: "active" | "suspended" | "released";
|
|
415
|
+
voice: LineVoice | null;
|
|
416
|
+
attachment: LineAttachment | null;
|
|
417
|
+
createdAt: string;
|
|
418
|
+
updatedAt: string;
|
|
419
|
+
}
|
|
420
|
+
interface LineThread {
|
|
421
|
+
id: string;
|
|
422
|
+
lineId: string;
|
|
423
|
+
memberId: string;
|
|
424
|
+
sandboxId: string;
|
|
425
|
+
/** The agent session this member's turns run in. */
|
|
426
|
+
sessionId: string;
|
|
427
|
+
lastMessageAt: string | null;
|
|
428
|
+
status: "active" | "closed";
|
|
429
|
+
createdAt: string;
|
|
430
|
+
}
|
|
431
|
+
interface LineMessage {
|
|
432
|
+
id: string;
|
|
433
|
+
threadId: string | null;
|
|
434
|
+
memberId: string | null;
|
|
435
|
+
direction: "in" | "out";
|
|
436
|
+
kind: "agent" | "notice" | "send";
|
|
437
|
+
/** Stable Hub dedupe key for this inbound or outbound event. */
|
|
438
|
+
deliveryKey: string;
|
|
439
|
+
/** The inbound message this outbound row answers. */
|
|
440
|
+
replyToId: string | null;
|
|
441
|
+
/** The sandbox turn receipt, when an inbound row reached a turn. */
|
|
442
|
+
turnId: string | null;
|
|
443
|
+
text: string | null;
|
|
444
|
+
status: string;
|
|
445
|
+
errorCode: string | null;
|
|
446
|
+
/** Latency marks in milliseconds after the message arrived. */
|
|
447
|
+
timeline: Record<string, number | string> | null;
|
|
448
|
+
createdAt: string;
|
|
449
|
+
}
|
|
450
|
+
/** The part of the SDK's HTTP client lines use. */
|
|
451
|
+
interface LinesHttpClient {
|
|
452
|
+
fetch(path: string, options?: RequestInit): Promise<Response>;
|
|
453
|
+
}
|
|
454
|
+
/** `client.lines`: your lines, their members and their threads. */
|
|
455
|
+
declare class LinesClient {
|
|
456
|
+
private readonly http;
|
|
457
|
+
constructor(http: LinesHttpClient);
|
|
458
|
+
/**
|
|
459
|
+
* Create a line from an owned Inkbox or Linq connection, or return the line
|
|
460
|
+
* already pinned to that provider identity. Hub owns inbound routing and
|
|
461
|
+
* never re-keys the connection.
|
|
462
|
+
*/
|
|
463
|
+
fromConnection(input: LineFromConnectionInput): Promise<Line>;
|
|
464
|
+
/** Your lines. `sandboxId` narrows to lines attached to that sandbox. */
|
|
465
|
+
list(options?: {
|
|
466
|
+
sandboxId?: string;
|
|
467
|
+
profileId?: string;
|
|
468
|
+
}): Promise<Line[]>;
|
|
469
|
+
/** Supported combinations from the maintained host channel catalog. */
|
|
470
|
+
providers(): Promise<LineProvider[]>;
|
|
471
|
+
/** Metadata only; no reservation and no provider credentials are returned. */
|
|
472
|
+
numbers(connectionId: string, transport: "imessage" | "sms" | "whatsapp"): Promise<LineNumberInventory>;
|
|
473
|
+
/** Choose the payer/execution authority for a cookie-authenticated attachment. */
|
|
474
|
+
executionKeys(): Promise<LineExecutionKey[]>;
|
|
475
|
+
get(lineId: string): Promise<Line>;
|
|
476
|
+
/** A line id for a line id or one of your lines' addresses. */
|
|
477
|
+
resolve(number: string): Promise<string>;
|
|
478
|
+
/**
|
|
479
|
+
* Attach a line so each member runs in their own sandbox. Hub checks that
|
|
480
|
+
* your API key can run sandboxes, and each turn runs as a short-lived child
|
|
481
|
+
* of that key. Attaching again with the same options returns the same
|
|
482
|
+
* attachment. To attach a line to one sandbox, use `box.lines.attach()`.
|
|
483
|
+
*/
|
|
484
|
+
attach(options: LineInstanceAttachOptions): Promise<LineAttachment>;
|
|
485
|
+
/**
|
|
486
|
+
* Detach a line (by id or address), whatever it is attached to. This is
|
|
487
|
+
* the way to detach a line attached with `instance`, which names no
|
|
488
|
+
* sandbox. Each member's own sandbox stays under its instance key. Returns
|
|
489
|
+
* false when the line was not attached.
|
|
490
|
+
*/
|
|
491
|
+
detach(number: string, options?: {
|
|
492
|
+
expectedAttachmentId?: string;
|
|
493
|
+
}): Promise<boolean>;
|
|
494
|
+
/** Detach only this observed attachment. A replacement is left untouched.
|
|
495
|
+
* The distinct native route makes older hosts refuse rather than ignore
|
|
496
|
+
* the condition. This never falls back to unconditional line detachment.
|
|
497
|
+
*/
|
|
498
|
+
detachAttachment(number: string, attachmentId: string): Promise<boolean>;
|
|
499
|
+
/**
|
|
500
|
+
* Retire a detached line's Hub routing and free its workspace transport slot.
|
|
501
|
+
* Hub refuses an attached or voice-enabled line. A retry by line id returns
|
|
502
|
+
* false; the provider connection and message history remain.
|
|
503
|
+
*/
|
|
504
|
+
release(number: string): Promise<boolean>;
|
|
505
|
+
/**
|
|
506
|
+
* Take calls on a line (Inkbox iMessage lines). Hub points the identity's
|
|
507
|
+
* incoming calls at itself, binds the ph0ny agent to the line and adds the
|
|
508
|
+
* agent's `ask_workspace` tool. Enabling again replaces every credential.
|
|
509
|
+
*/
|
|
510
|
+
enableVoice(lineId: string, options: LineVoiceOptions): Promise<Line>;
|
|
511
|
+
/** Stop taking calls on a line: Hub refuses them and Inkbox rejects them. */
|
|
512
|
+
disableVoice(lineId: string): Promise<Line>;
|
|
513
|
+
/**
|
|
514
|
+
* Queue a proactive message to an active, consenting member. Hub reuses the
|
|
515
|
+
* member's authenticated provider conversation, rechecks STOP immediately
|
|
516
|
+
* before delivery, and defers delivery during the recipient's saved quiet hours.
|
|
517
|
+
*/
|
|
518
|
+
send(lineId: string, input: LineSendInput): Promise<LineSendReceipt>;
|
|
519
|
+
/** Read the native outbox receipt. Queued is not a delivery confirmation. */
|
|
520
|
+
sentMessage(lineId: string, messageId: string): Promise<LineSendReceipt>;
|
|
521
|
+
/** Only the recipient's proven message can enable reminders or choose quiet hours. */
|
|
522
|
+
reminders(lineId: string, memberId: string): Promise<LineReminderPreferences>;
|
|
523
|
+
/** Members of the line's active attachment. */
|
|
524
|
+
members(lineId: string): {
|
|
525
|
+
list(): Promise<LineMember[]>;
|
|
526
|
+
add(spec: LineMemberSpec): Promise<LineMember>;
|
|
527
|
+
update(memberId: string, patch: LineMemberPatch): Promise<LineMember>;
|
|
528
|
+
remove(memberId: string): Promise<void>;
|
|
529
|
+
};
|
|
530
|
+
/** Read one retained message without depending on a recent-message page. */
|
|
531
|
+
message(lineId: string, messageId: string): Promise<LineMessage>;
|
|
532
|
+
/** Threads of a line (one per member) and their messages, newest first. */
|
|
533
|
+
threads(lineId: string): {
|
|
534
|
+
list(): Promise<LineThread[]>;
|
|
535
|
+
messages(threadId: string): Promise<LineMessage[]>;
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
/** `sandbox.lines`: attach lines to this sandbox. */
|
|
539
|
+
declare class SandboxLines {
|
|
540
|
+
private readonly http;
|
|
541
|
+
private readonly sandboxId;
|
|
542
|
+
private readonly lines;
|
|
543
|
+
constructor(http: LinesHttpClient, sandboxId: string);
|
|
544
|
+
/**
|
|
545
|
+
* Attach a line to this sandbox. Hub checks that your API key can run this
|
|
546
|
+
* sandbox, and each turn runs as a short-lived child of that key. Attaching
|
|
547
|
+
* again with the same options returns the same attachment.
|
|
548
|
+
*/
|
|
549
|
+
attach(options: LineAttachOptions): Promise<LineAttachment>;
|
|
550
|
+
/** Lines attached to this sandbox. */
|
|
551
|
+
list(): Promise<Line[]>;
|
|
552
|
+
/** Detach a line (by id or address) from this sandbox. */
|
|
553
|
+
detach(number: string): Promise<void>;
|
|
554
|
+
}
|
|
555
|
+
//#endregion
|
|
556
|
+
export { LinesClient as A, LineApplicationState as B, LineRole as C, LineTransport as D, LineThread as E, LINE_APPLICATION_REPLY_MAX_CHARS as F, parseLineApplicationRequest as H, LINE_APPLICATION_REQUEST_MAX_BYTES as I, LineApplication as L, SandboxLines as M, lineInstanceKey as N, LineVoice as O, profileChannelReference as P, LineApplicationRequest as R, LineRespondView as S, LineSendReceipt as T, parseLineApplicationResult as U, LineApplicationView as V, LineNumberInventory as _, LineAttachOptions as a, LineReplyGate as b, LineFromConnectionInput as c, LineLimits as d, LineMember as f, LineMessage as g, LineMemberSpec as h, LineAllowanceSubject as i, LinesHttpClient as j, LineVoiceOptions as k, LineInstanceAttachOptions as l, LineMemberPatch as m, LineAgentRolePolicy as n, LineAttachment as o, LineMemberInstance as p, LineAllowance as r, LineExecutionKey as s, Line as t, LineInstanceCreate as u, LineProvider as v, LineSendInput as w, LineRespondAgent as x, LineReminderPreferences as y, LineApplicationResult as z };
|
package/dist/lines.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as LinesClient, C as LineRole, D as LineTransport, E as LineThread, M as SandboxLines, N as lineInstanceKey, O as LineVoice, P as profileChannelReference, S as LineRespondView, T as LineSendReceipt, _ as LineNumberInventory, a as LineAttachOptions, b as LineReplyGate, c as LineFromConnectionInput, d as LineLimits, f as LineMember, g as LineMessage, h as LineMemberSpec, i as LineAllowanceSubject, j as LinesHttpClient, k as LineVoiceOptions, l as LineInstanceAttachOptions, m as LineMemberPatch, n as LineAgentRolePolicy, o as LineAttachment, p as LineMemberInstance, r as LineAllowance, s as LineExecutionKey, t as Line, u as LineInstanceCreate, v as LineProvider, w as LineSendInput, x as LineRespondAgent, y as LineReminderPreferences } from "./lines-DLIo-NTB.js";
|
|
2
|
+
export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineAttachOptions, LineAttachment, LineExecutionKey, LineFromConnectionInput, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
|