@inkbox/sdk 0.3.1 → 0.4.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.
- package/README.md +30 -25
- package/dist/agent_identity.d.ts +28 -31
- package/dist/agent_identity.d.ts.map +1 -1
- package/dist/agent_identity.js +34 -58
- package/dist/agent_identity.js.map +1 -1
- package/dist/api_keys/resources/apiKeys.d.ts +39 -0
- package/dist/api_keys/resources/apiKeys.d.ts.map +1 -0
- package/dist/api_keys/resources/apiKeys.js +38 -0
- package/dist/api_keys/resources/apiKeys.js.map +1 -0
- package/dist/api_keys/types.d.ts +68 -0
- package/dist/api_keys/types.d.ts.map +1 -0
- package/dist/api_keys/types.js +30 -0
- package/dist/api_keys/types.js.map +1 -0
- package/dist/identities/exceptions.d.ts +35 -0
- package/dist/identities/exceptions.d.ts.map +1 -0
- package/dist/identities/exceptions.js +49 -0
- package/dist/identities/exceptions.js.map +1 -0
- package/dist/identities/resources/identities.d.ts +36 -25
- package/dist/identities/resources/identities.d.ts.map +1 -1
- package/dist/identities/resources/identities.js +61 -31
- package/dist/identities/resources/identities.js.map +1 -1
- package/dist/identities/types.d.ts +38 -12
- package/dist/identities/types.d.ts.map +1 -1
- package/dist/identities/types.js +13 -3
- package/dist/identities/types.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/inkbox.d.ts +22 -9
- package/dist/inkbox.d.ts.map +1 -1
- package/dist/inkbox.js +38 -27
- package/dist/inkbox.js.map +1 -1
- package/dist/mail/resources/mailboxes.d.ts +4 -28
- package/dist/mail/resources/mailboxes.d.ts.map +1 -1
- package/dist/mail/resources/mailboxes.js +4 -37
- package/dist/mail/resources/mailboxes.js.map +1 -1
- package/dist/mail/types.d.ts +4 -7
- package/dist/mail/types.d.ts.map +1 -1
- package/dist/mail/types.js +0 -1
- package/dist/mail/types.js.map +1 -1
- package/dist/phone/types.d.ts +6 -0
- package/dist/phone/types.d.ts.map +1 -1
- package/dist/phone/types.js +1 -0
- package/dist/phone/types.js.map +1 -1
- package/dist/tunnels/_reserved_names.d.ts +22 -0
- package/dist/tunnels/_reserved_names.d.ts.map +1 -0
- package/dist/tunnels/_reserved_names.js +149 -0
- package/dist/tunnels/_reserved_names.js.map +1 -0
- package/dist/tunnels/_validation.d.ts +16 -1
- package/dist/tunnels/_validation.d.ts.map +1 -1
- package/dist/tunnels/_validation.js +33 -8
- package/dist/tunnels/_validation.js.map +1 -1
- package/dist/tunnels/client/_protocol.d.ts +1 -1
- package/dist/tunnels/client/_protocol.js +1 -1
- package/dist/tunnels/client/_protocol.js.map +1 -1
- package/dist/tunnels/client/_runtime.d.ts +3 -2
- package/dist/tunnels/client/_runtime.d.ts.map +1 -1
- package/dist/tunnels/client/_runtime.js +7 -7
- package/dist/tunnels/client/_runtime.js.map +1 -1
- package/dist/tunnels/client/_state.d.ts +0 -13
- package/dist/tunnels/client/_state.d.ts.map +1 -1
- package/dist/tunnels/client/_state.js +0 -27
- package/dist/tunnels/client/_state.js.map +1 -1
- package/dist/tunnels/client/index.d.ts +13 -13
- package/dist/tunnels/client/index.d.ts.map +1 -1
- package/dist/tunnels/client/index.js +20 -65
- package/dist/tunnels/client/index.js.map +1 -1
- package/dist/tunnels/exceptions.d.ts +8 -6
- package/dist/tunnels/exceptions.d.ts.map +1 -1
- package/dist/tunnels/exceptions.js +12 -26
- package/dist/tunnels/exceptions.js.map +1 -1
- package/dist/tunnels/resources/tunnels.d.ts +9 -38
- package/dist/tunnels/resources/tunnels.d.ts.map +1 -1
- package/dist/tunnels/resources/tunnels.js +10 -92
- package/dist/tunnels/resources/tunnels.js.map +1 -1
- package/dist/tunnels/types.d.ts +17 -33
- package/dist/tunnels/types.d.ts.map +1 -1
- package/dist/tunnels/types.js +13 -23
- package/dist/tunnels/types.js.map +1 -1
- package/package.json +1 -1
- package/protocol/tunnel_protocol_constants.json +1 -1
package/README.md
CHANGED
|
@@ -127,18 +127,27 @@ console.log(status.restrictions.maxSendsPerDay); // 10 (unclaimed) or 500 (cl
|
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
129
|
// Create and fully provision an identity
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
// createIdentity atomically provisions the mailbox AND the tunnel —
|
|
131
|
+
// both come back on the response. Phone numbers stay opt-in.
|
|
132
|
+
const identity = await inkbox.createIdentity("sales-bot", {
|
|
133
|
+
displayName: "Sales Bot",
|
|
134
|
+
description: "Sales-outreach agent",
|
|
135
|
+
});
|
|
136
|
+
const phone = await identity.provisionPhoneNumber({ type: "toll_free" });
|
|
132
137
|
|
|
133
|
-
console.log(identity.emailAddress);
|
|
138
|
+
console.log(identity.emailAddress); // sales-bot@inkboxmail.com
|
|
139
|
+
console.log(identity.tunnel?.publicHost); // sales-bot.inkboxwire.com
|
|
134
140
|
console.log(phone.number);
|
|
135
141
|
|
|
136
142
|
// Pin the identity's mailbox to a verified custom sending domain
|
|
137
143
|
// (bare name; see "Custom Sending Domains" below).
|
|
138
|
-
await inkbox.createIdentity("sales-bot", { sendingDomain: "mail.acme.com" });
|
|
144
|
+
await inkbox.createIdentity("sales-bot-2", { sendingDomain: "mail.acme.com" });
|
|
145
|
+
|
|
146
|
+
// Provision a passthrough tunnel (tls_mode is fixed at create time)
|
|
147
|
+
await inkbox.createIdentity("sales-bot-pt", { tunnel: { tlsMode: "passthrough" } });
|
|
139
148
|
|
|
140
|
-
// Link an existing
|
|
141
|
-
|
|
149
|
+
// Link an existing phone number to an identity (mailbox + tunnel are
|
|
150
|
+
// 1:1 with their identity and cannot be relinked).
|
|
142
151
|
await identity.assignPhoneNumber("phone-number-uuid-here");
|
|
143
152
|
|
|
144
153
|
// Get an existing identity (returned with current channel state)
|
|
@@ -152,8 +161,8 @@ const allIdentities = await inkbox.listIdentities();
|
|
|
152
161
|
await identity.update({ status: "paused" });
|
|
153
162
|
await identity.update({ newHandle: "sales-bot-v2" });
|
|
154
163
|
|
|
155
|
-
// Unlink
|
|
156
|
-
|
|
164
|
+
// Unlink phone number (without releasing it). Mailbox is 1:1 with the
|
|
165
|
+
// identity and cannot be unlinked — delete the identity instead.
|
|
157
166
|
await identity.unlinkPhoneNumber();
|
|
158
167
|
|
|
159
168
|
// Delete
|
|
@@ -553,31 +562,26 @@ for (const t of segments) {
|
|
|
553
562
|
|
|
554
563
|
## Org-level Mailboxes
|
|
555
564
|
|
|
556
|
-
|
|
565
|
+
Mailboxes are provisioned atomically by `inkbox.createIdentity(...)` and
|
|
566
|
+
removed by `identity.delete()` (cascade). The `inkbox.mailboxes`
|
|
567
|
+
surface is read + update + search only.
|
|
557
568
|
|
|
558
569
|
```ts
|
|
559
570
|
// List all mailboxes in the organisation
|
|
560
571
|
const mailboxes = await inkbox.mailboxes.list();
|
|
561
572
|
|
|
562
573
|
// Get a specific mailbox
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
// Create a mailbox linked to an agent identity
|
|
566
|
-
const mb = await inkbox.mailboxes.create({
|
|
567
|
-
agentHandle: "support-agent",
|
|
568
|
-
displayName: "Support Inbox",
|
|
569
|
-
});
|
|
574
|
+
const mb = await inkbox.mailboxes.get("abc-xyz@inkboxmail.com");
|
|
570
575
|
console.log(mb.emailAddress);
|
|
571
576
|
console.log(mb.sendingDomain); // bare domain the mailbox sends from
|
|
577
|
+
console.log(mb.agentIdentityId); // non-null for live customer mailboxes (1:1 invariant)
|
|
572
578
|
|
|
573
|
-
//
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
// Update display name or webhook URL
|
|
578
|
-
await inkbox.mailboxes.update(mb.emailAddress, { displayName: "New Name" });
|
|
579
|
+
// Update webhook URL or filter mode. Note: display_name has moved to
|
|
580
|
+
// the agent identity — set it via identity.update({ displayName: ... }).
|
|
581
|
+
// The mailbox PATCH endpoint hard-rejects display_name with a 422.
|
|
579
582
|
await inkbox.mailboxes.update(mb.emailAddress, { webhookUrl: "https://example.com/hook" });
|
|
580
583
|
await inkbox.mailboxes.update(mb.emailAddress, { webhookUrl: null }); // remove webhook
|
|
584
|
+
await inkbox.mailboxes.update(mb.emailAddress, { filterMode: "whitelist" }); // admin-scoped key only
|
|
581
585
|
|
|
582
586
|
// Full-text search across messages in a mailbox
|
|
583
587
|
const results = await inkbox.mailboxes.search(mb.emailAddress, { q: "invoice", limit: 20 });
|
|
@@ -585,15 +589,16 @@ for (const msg of results) {
|
|
|
585
589
|
console.log(msg.subject, msg.fromAddress);
|
|
586
590
|
}
|
|
587
591
|
|
|
588
|
-
//
|
|
589
|
-
|
|
592
|
+
// To remove a mailbox, delete its owning identity (cascades to the
|
|
593
|
+
// linked mailbox AND tunnel; revokes scoped API keys):
|
|
594
|
+
await (await inkbox.getIdentity("support-agent")).delete();
|
|
590
595
|
```
|
|
591
596
|
|
|
592
597
|
---
|
|
593
598
|
|
|
594
599
|
## Custom Sending Domains
|
|
595
600
|
|
|
596
|
-
If your org has registered custom sending domains in the console, list them and (admin-only) set the org default. New mailboxes inherit the org default unless you pass `
|
|
601
|
+
If your org has registered custom sending domains in the console, list them and (admin-only) set the org default. New mailboxes inherit the org default unless you pass `sendingDomain` to `createIdentity`. Domain registration, DNS records, verification, DKIM rotation, and deletion stay in the console.
|
|
597
602
|
|
|
598
603
|
```ts
|
|
599
604
|
import { SendingDomainStatus } from "@inkbox/sdk";
|
package/dist/agent_identity.d.ts
CHANGED
|
@@ -15,23 +15,31 @@ import { ForwardMode, MessageDirection } from "./mail/types.js";
|
|
|
15
15
|
import type { Message, MessageDetail, ThreadDetail } from "./mail/types.js";
|
|
16
16
|
import type { PhoneCall, PhoneCallWithRateLimit, PhoneTranscript, TextConversationSummary, TextMessage } from "./phone/types.js";
|
|
17
17
|
import type { _AgentIdentityData, IdentityMailbox, IdentityPhoneNumber } from "./identities/types.js";
|
|
18
|
+
import type { Tunnel } from "./tunnels/types.js";
|
|
18
19
|
import type { Inkbox } from "./inkbox.js";
|
|
19
20
|
export declare class AgentIdentity {
|
|
20
21
|
private _data;
|
|
21
22
|
private readonly _inkbox;
|
|
22
23
|
private _mailbox;
|
|
23
24
|
private _phoneNumber;
|
|
25
|
+
private _tunnel;
|
|
24
26
|
private _credentials;
|
|
25
27
|
private _credentialsVaultRef;
|
|
26
28
|
constructor(data: _AgentIdentityData, inkbox: Inkbox);
|
|
27
29
|
get agentHandle(): string;
|
|
28
30
|
get id(): string;
|
|
31
|
+
/** Human-readable display name. Defaults server-side to `agentHandle` if unset. */
|
|
32
|
+
get displayName(): string | null;
|
|
33
|
+
/** Free-form org-internal description, or `null` if unset. Never surfaces in outbound mail. */
|
|
34
|
+
get description(): string | null;
|
|
29
35
|
/** Email address assigned at creation time. Always trust this value — do not derive it from `agentHandle`. */
|
|
30
36
|
get emailAddress(): string | null;
|
|
31
|
-
/** The mailbox currently assigned to this identity
|
|
37
|
+
/** The mailbox currently assigned to this identity. Non-null for live identities (1:1 invariant). */
|
|
32
38
|
get mailbox(): IdentityMailbox | null;
|
|
33
39
|
/** The phone number currently assigned to this identity, or `null` if none. */
|
|
34
40
|
get phoneNumber(): IdentityPhoneNumber | null;
|
|
41
|
+
/** The tunnel currently assigned to this identity. Non-null for live identities (1:1 invariant). */
|
|
42
|
+
get tunnel(): Tunnel | null;
|
|
35
43
|
/**
|
|
36
44
|
* Identity-scoped credential access.
|
|
37
45
|
*
|
|
@@ -106,34 +114,6 @@ export declare class AgentIdentity {
|
|
|
106
114
|
* @param secretId - UUID of the secret to delete.
|
|
107
115
|
*/
|
|
108
116
|
deleteSecret(secretId: string): Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Create a new mailbox and link it to this identity.
|
|
111
|
-
*
|
|
112
|
-
* @param options.displayName - Optional human-readable sender name.
|
|
113
|
-
* @param options.emailLocalPart - Optional requested mailbox local part.
|
|
114
|
-
* @param options.sendingDomainId - Optional sending-domain selector by row id
|
|
115
|
-
* (e.g. `"sending_domain_<uuid>"`). Omit to inherit the org's default
|
|
116
|
-
* custom domain (or fall through to the platform default if none).
|
|
117
|
-
* Pass `null` to force the platform default. Pass a verified domain's id
|
|
118
|
-
* to bind this mailbox to it.
|
|
119
|
-
*/
|
|
120
|
-
createMailbox(options?: {
|
|
121
|
-
displayName?: string;
|
|
122
|
-
emailLocalPart?: string;
|
|
123
|
-
sendingDomainId?: string | null;
|
|
124
|
-
}): Promise<IdentityMailbox>;
|
|
125
|
-
/**
|
|
126
|
-
* Link an existing mailbox to this identity.
|
|
127
|
-
*
|
|
128
|
-
* @param mailboxId - UUID of the mailbox to link. Obtain via
|
|
129
|
-
* `inkbox.mailboxes.list()` or `inkbox.mailboxes.get()`.
|
|
130
|
-
* @returns The linked {@link IdentityMailbox}.
|
|
131
|
-
*/
|
|
132
|
-
assignMailbox(mailboxId: string): Promise<IdentityMailbox>;
|
|
133
|
-
/**
|
|
134
|
-
* Unlink this identity's mailbox (does not delete the mailbox).
|
|
135
|
-
*/
|
|
136
|
-
unlinkMailbox(): Promise<void>;
|
|
137
117
|
/**
|
|
138
118
|
* Provision a new phone number and link it to this identity.
|
|
139
119
|
*
|
|
@@ -385,12 +365,23 @@ export declare class AgentIdentity {
|
|
|
385
365
|
updatedCount: number;
|
|
386
366
|
}>;
|
|
387
367
|
/**
|
|
388
|
-
* Update this identity's handle.
|
|
368
|
+
* Update this identity's handle, display name, description, and/or status.
|
|
369
|
+
*
|
|
370
|
+
* Only provided fields are applied; omitted fields are left unchanged.
|
|
371
|
+
* For `displayName` and `description`, explicit `null` clears the column;
|
|
372
|
+
* omitting the key leaves it untouched.
|
|
389
373
|
*
|
|
390
374
|
* @param options.newHandle - New agent handle.
|
|
375
|
+
* @param options.displayName - New display name, or `null` to clear.
|
|
376
|
+
* @param options.description - New description, or `null` to clear.
|
|
377
|
+
* @param options.status - `"active"` or `"paused"`. Call `delete()`
|
|
378
|
+
* to remove the identity; `"deleted"` is rejected here.
|
|
391
379
|
*/
|
|
392
380
|
update(options: {
|
|
393
381
|
newHandle?: string;
|
|
382
|
+
displayName?: string | null;
|
|
383
|
+
description?: string | null;
|
|
384
|
+
status?: "active" | "paused";
|
|
394
385
|
}): Promise<void>;
|
|
395
386
|
/**
|
|
396
387
|
* Re-fetch this identity from the API and update cached channels.
|
|
@@ -402,7 +393,13 @@ export declare class AgentIdentity {
|
|
|
402
393
|
* @returns `this` for chaining.
|
|
403
394
|
*/
|
|
404
395
|
refresh(): Promise<AgentIdentity>;
|
|
405
|
-
/**
|
|
396
|
+
/**
|
|
397
|
+
* Delete this identity.
|
|
398
|
+
*
|
|
399
|
+
* Cascades: flips the linked mailbox to `deleted`, force-finalizes the
|
|
400
|
+
* linked tunnel to `deleted`, revokes any identity-scoped API keys, and
|
|
401
|
+
* unassigns (but does not delete) any linked phone number.
|
|
402
|
+
*/
|
|
406
403
|
delete(): Promise<void>;
|
|
407
404
|
private _requireVaultUnlocked;
|
|
408
405
|
private _requireMailbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_identity.d.ts","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,EACV,SAAS,EACT,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"agent_identity.d.ts","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAA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;;;;;;;;OAQG;IACG,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAUvC;;;;;;OAMG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa;CAQtB"}
|
package/dist/agent_identity.js
CHANGED
|
@@ -15,6 +15,7 @@ export class AgentIdentity {
|
|
|
15
15
|
_inkbox;
|
|
16
16
|
_mailbox;
|
|
17
17
|
_phoneNumber;
|
|
18
|
+
_tunnel;
|
|
18
19
|
_credentials = null;
|
|
19
20
|
_credentialsVaultRef = null; // tracks which _unlocked built the cache
|
|
20
21
|
constructor(data, inkbox) {
|
|
@@ -22,18 +23,25 @@ export class AgentIdentity {
|
|
|
22
23
|
this._inkbox = inkbox;
|
|
23
24
|
this._mailbox = data.mailbox;
|
|
24
25
|
this._phoneNumber = data.phoneNumber;
|
|
26
|
+
this._tunnel = data.tunnel;
|
|
25
27
|
}
|
|
26
28
|
// ------------------------------------------------------------------
|
|
27
29
|
// Identity properties
|
|
28
30
|
// ------------------------------------------------------------------
|
|
29
31
|
get agentHandle() { return this._data.agentHandle; }
|
|
30
32
|
get id() { return this._data.id; }
|
|
33
|
+
/** Human-readable display name. Defaults server-side to `agentHandle` if unset. */
|
|
34
|
+
get displayName() { return this._data.displayName; }
|
|
35
|
+
/** Free-form org-internal description, or `null` if unset. Never surfaces in outbound mail. */
|
|
36
|
+
get description() { return this._data.description; }
|
|
31
37
|
/** Email address assigned at creation time. Always trust this value — do not derive it from `agentHandle`. */
|
|
32
38
|
get emailAddress() { return this._data.emailAddress; }
|
|
33
|
-
/** The mailbox currently assigned to this identity
|
|
39
|
+
/** The mailbox currently assigned to this identity. Non-null for live identities (1:1 invariant). */
|
|
34
40
|
get mailbox() { return this._mailbox; }
|
|
35
41
|
/** The phone number currently assigned to this identity, or `null` if none. */
|
|
36
42
|
get phoneNumber() { return this._phoneNumber; }
|
|
43
|
+
/** The tunnel currently assigned to this identity. Non-null for live identities (1:1 invariant). */
|
|
44
|
+
get tunnel() { return this._tunnel; }
|
|
37
45
|
/**
|
|
38
46
|
* Identity-scoped credential access.
|
|
39
47
|
*
|
|
@@ -155,60 +163,6 @@ export class AgentIdentity {
|
|
|
155
163
|
// ------------------------------------------------------------------
|
|
156
164
|
// Channel management
|
|
157
165
|
// ------------------------------------------------------------------
|
|
158
|
-
/**
|
|
159
|
-
* Create a new mailbox and link it to this identity.
|
|
160
|
-
*
|
|
161
|
-
* @param options.displayName - Optional human-readable sender name.
|
|
162
|
-
* @param options.emailLocalPart - Optional requested mailbox local part.
|
|
163
|
-
* @param options.sendingDomainId - Optional sending-domain selector by row id
|
|
164
|
-
* (e.g. `"sending_domain_<uuid>"`). Omit to inherit the org's default
|
|
165
|
-
* custom domain (or fall through to the platform default if none).
|
|
166
|
-
* Pass `null` to force the platform default. Pass a verified domain's id
|
|
167
|
-
* to bind this mailbox to it.
|
|
168
|
-
*/
|
|
169
|
-
async createMailbox(options = {}) {
|
|
170
|
-
const mailbox = await this._inkbox._mailboxes.create({
|
|
171
|
-
agentHandle: this.agentHandle,
|
|
172
|
-
...options,
|
|
173
|
-
});
|
|
174
|
-
const linked = {
|
|
175
|
-
id: mailbox.id,
|
|
176
|
-
emailAddress: mailbox.emailAddress,
|
|
177
|
-
sendingDomain: mailbox.sendingDomain,
|
|
178
|
-
displayName: mailbox.displayName,
|
|
179
|
-
filterMode: mailbox.filterMode,
|
|
180
|
-
agentIdentityId: mailbox.agentIdentityId,
|
|
181
|
-
createdAt: mailbox.createdAt,
|
|
182
|
-
updatedAt: mailbox.updatedAt,
|
|
183
|
-
filterModeChangeNotice: mailbox.filterModeChangeNotice,
|
|
184
|
-
};
|
|
185
|
-
this._mailbox = linked;
|
|
186
|
-
this._data.emailAddress = mailbox.emailAddress;
|
|
187
|
-
return linked;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Link an existing mailbox to this identity.
|
|
191
|
-
*
|
|
192
|
-
* @param mailboxId - UUID of the mailbox to link. Obtain via
|
|
193
|
-
* `inkbox.mailboxes.list()` or `inkbox.mailboxes.get()`.
|
|
194
|
-
* @returns The linked {@link IdentityMailbox}.
|
|
195
|
-
*/
|
|
196
|
-
async assignMailbox(mailboxId) {
|
|
197
|
-
const data = await this._inkbox._idsResource.assignMailbox(this.agentHandle, {
|
|
198
|
-
mailboxId,
|
|
199
|
-
});
|
|
200
|
-
this._mailbox = data.mailbox;
|
|
201
|
-
this._data = data;
|
|
202
|
-
return this._mailbox;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Unlink this identity's mailbox (does not delete the mailbox).
|
|
206
|
-
*/
|
|
207
|
-
async unlinkMailbox() {
|
|
208
|
-
this._requireMailbox();
|
|
209
|
-
await this._inkbox._idsResource.unlinkMailbox(this.agentHandle);
|
|
210
|
-
this._mailbox = null;
|
|
211
|
-
}
|
|
212
166
|
/**
|
|
213
167
|
* Provision a new phone number and link it to this identity.
|
|
214
168
|
*
|
|
@@ -487,9 +441,17 @@ export class AgentIdentity {
|
|
|
487
441
|
// Identity management
|
|
488
442
|
// ------------------------------------------------------------------
|
|
489
443
|
/**
|
|
490
|
-
* Update this identity's handle.
|
|
444
|
+
* Update this identity's handle, display name, description, and/or status.
|
|
445
|
+
*
|
|
446
|
+
* Only provided fields are applied; omitted fields are left unchanged.
|
|
447
|
+
* For `displayName` and `description`, explicit `null` clears the column;
|
|
448
|
+
* omitting the key leaves it untouched.
|
|
491
449
|
*
|
|
492
450
|
* @param options.newHandle - New agent handle.
|
|
451
|
+
* @param options.displayName - New display name, or `null` to clear.
|
|
452
|
+
* @param options.description - New description, or `null` to clear.
|
|
453
|
+
* @param options.status - `"active"` or `"paused"`. Call `delete()`
|
|
454
|
+
* to remove the identity; `"deleted"` is rejected here.
|
|
493
455
|
*/
|
|
494
456
|
async update(options) {
|
|
495
457
|
const result = await this._inkbox._idsResource.update(this.agentHandle, options);
|
|
@@ -497,7 +459,14 @@ export class AgentIdentity {
|
|
|
497
459
|
...result,
|
|
498
460
|
mailbox: this._mailbox,
|
|
499
461
|
phoneNumber: this._phoneNumber,
|
|
462
|
+
tunnel: this._tunnel,
|
|
500
463
|
};
|
|
464
|
+
if (options.newHandle !== undefined && this._tunnel != null) {
|
|
465
|
+
// The server renames the linked tunnel in the same transaction
|
|
466
|
+
// under the unified handle namespace; refresh to pick up the
|
|
467
|
+
// new tunnelName / publicHost on the cached tunnel.
|
|
468
|
+
await this.refresh();
|
|
469
|
+
}
|
|
501
470
|
}
|
|
502
471
|
/**
|
|
503
472
|
* Re-fetch this identity from the API and update cached channels.
|
|
@@ -513,10 +482,17 @@ export class AgentIdentity {
|
|
|
513
482
|
this._data = data;
|
|
514
483
|
this._mailbox = data.mailbox;
|
|
515
484
|
this._phoneNumber = data.phoneNumber;
|
|
485
|
+
this._tunnel = data.tunnel;
|
|
516
486
|
this._credentials = null;
|
|
517
487
|
return this;
|
|
518
488
|
}
|
|
519
|
-
/**
|
|
489
|
+
/**
|
|
490
|
+
* Delete this identity.
|
|
491
|
+
*
|
|
492
|
+
* Cascades: flips the linked mailbox to `deleted`, force-finalizes the
|
|
493
|
+
* linked tunnel to `deleted`, revokes any identity-scoped API keys, and
|
|
494
|
+
* unassigns (but does not delete) any linked phone number.
|
|
495
|
+
*/
|
|
520
496
|
async delete() {
|
|
521
497
|
await this._inkbox._idsResource.delete(this.agentHandle);
|
|
522
498
|
}
|
|
@@ -530,7 +506,7 @@ export class AgentIdentity {
|
|
|
530
506
|
}
|
|
531
507
|
_requireMailbox() {
|
|
532
508
|
if (!this._mailbox) {
|
|
533
|
-
throw new InkboxError(`Identity '${this.agentHandle}' has no mailbox
|
|
509
|
+
throw new InkboxError(`Identity '${this.agentHandle}' has no mailbox — this should only be reachable on a deleted identity.`);
|
|
534
510
|
}
|
|
535
511
|
}
|
|
536
512
|
_requirePhone() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_identity.js","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAkB,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoB/C,MAAM,OAAO,aAAa;IAChB,KAAK,CAAqB;IACjB,OAAO,CAAS;IACzB,QAAQ,CAAyB;IACjC,YAAY,CAA6B;IACzC,YAAY,GAAuB,IAAI,CAAC;IACxC,oBAAoB,GAAkB,IAAI,CAAC,CAAC,yCAAyC;IAE7F,YAAY,IAAwB,EAAE,MAAc;QAClD,IAAI,CAAC,KAAK,GAAgB,IAAI,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAc,MAAM,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAa,IAAI,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,YAAY,GAAS,IAAI,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"agent_identity.js","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAkB,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoB/C,MAAM,OAAO,aAAa;IAChB,KAAK,CAAqB;IACjB,OAAO,CAAS;IACzB,QAAQ,CAAyB;IACjC,YAAY,CAA6B;IACzC,OAAO,CAAgB;IACvB,YAAY,GAAuB,IAAI,CAAC;IACxC,oBAAoB,GAAkB,IAAI,CAAC,CAAC,yCAAyC;IAE7F,YAAY,IAAwB,EAAE,MAAc;QAClD,IAAI,CAAC,KAAK,GAAgB,IAAI,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAc,MAAM,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAa,IAAI,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,YAAY,GAAS,IAAI,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,O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,SAAS,KAAK,IAAI,EAAE,CAAC;YACnD,MAAM,IAAI,WAAW,CACnB,gGAAgG,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,WAAW,CACnB,aAAa,IAAI,CAAC,WAAW,yEAAyE,CACvG,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,WAAW,CACnB,aAAa,IAAI,CAAC,WAAW,6GAA6G,CAC3I,CAAC;QACJ,CAAC;IACH,CAAC;CAEF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-api_keys/resources/apiKeys.ts
|
|
3
|
+
*
|
|
4
|
+
* API key creation surface.
|
|
5
|
+
*
|
|
6
|
+
* The Inkbox server admits two auth types on `POST /api/v1/api-keys`:
|
|
7
|
+
* JWT (console) and admin-scoped API keys. Admin-scoped callers may only
|
|
8
|
+
* mint identity-scoped keys (`scopedIdentityId` required); attempting to
|
|
9
|
+
* mint another admin-scoped key returns HTTP 403.
|
|
10
|
+
*/
|
|
11
|
+
import { HttpTransport } from "../../_http.js";
|
|
12
|
+
import { CreatedApiKey } from "../types.js";
|
|
13
|
+
export interface CreateApiKeyOptions {
|
|
14
|
+
/** Required human-readable name (1–255 chars). */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Optional free-text description (≤1000 chars). */
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Scope this key to a specific agent identity (UUID string). Omit for
|
|
20
|
+
* an admin (unscoped) key with full org-wide authority — only allowed
|
|
21
|
+
* for JWT (console) callers.
|
|
22
|
+
*/
|
|
23
|
+
scopedIdentityId?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class ApiKeysResource {
|
|
26
|
+
private readonly http;
|
|
27
|
+
constructor(http: HttpTransport);
|
|
28
|
+
/**
|
|
29
|
+
* Create a new API key for the caller's organization.
|
|
30
|
+
*
|
|
31
|
+
* Admin-scoped API key callers must pass `scopedIdentityId` — the
|
|
32
|
+
* server rejects attempts to mint another admin-scoped key from an
|
|
33
|
+
* admin-scoped caller with HTTP 403.
|
|
34
|
+
*
|
|
35
|
+
* @returns the full API key string (shown once) and its public metadata.
|
|
36
|
+
*/
|
|
37
|
+
create(options: CreateApiKeyOptions): Promise<CreatedApiKey>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=apiKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeys.d.ts","sourceRoot":"","sources":["../../../src/api_keys/resources/apiKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,aAAa,EAGd,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,mBAAmB;IAClC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;;;;OAQG;IACG,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;CASnE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-api_keys/resources/apiKeys.ts
|
|
3
|
+
*
|
|
4
|
+
* API key creation surface.
|
|
5
|
+
*
|
|
6
|
+
* The Inkbox server admits two auth types on `POST /api/v1/api-keys`:
|
|
7
|
+
* JWT (console) and admin-scoped API keys. Admin-scoped callers may only
|
|
8
|
+
* mint identity-scoped keys (`scopedIdentityId` required); attempting to
|
|
9
|
+
* mint another admin-scoped key returns HTTP 403.
|
|
10
|
+
*/
|
|
11
|
+
import { parseCreatedApiKey, } from "../types.js";
|
|
12
|
+
const BASE = "/api-keys";
|
|
13
|
+
export class ApiKeysResource {
|
|
14
|
+
http;
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this.http = http;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a new API key for the caller's organization.
|
|
20
|
+
*
|
|
21
|
+
* Admin-scoped API key callers must pass `scopedIdentityId` — the
|
|
22
|
+
* server rejects attempts to mint another admin-scoped key from an
|
|
23
|
+
* admin-scoped caller with HTTP 403.
|
|
24
|
+
*
|
|
25
|
+
* @returns the full API key string (shown once) and its public metadata.
|
|
26
|
+
*/
|
|
27
|
+
async create(options) {
|
|
28
|
+
const body = { label: options.label };
|
|
29
|
+
if (options.description !== undefined)
|
|
30
|
+
body.description = options.description;
|
|
31
|
+
if (options.scopedIdentityId !== undefined) {
|
|
32
|
+
body.scoped_identity_id = options.scopedIdentityId;
|
|
33
|
+
}
|
|
34
|
+
const data = await this.http.post(BASE, body);
|
|
35
|
+
return parseCreatedApiKey(data);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=apiKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeys.js","sourceRoot":"","sources":["../../../src/api_keys/resources/apiKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAGL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,MAAM,IAAI,GAAG,WAAW,CAAC;AAezB,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CAAC,OAA4B;QACvC,MAAM,IAAI,GAA4B,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAC/D,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;YAAE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAC9E,IAAI,OAAO,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YAC3C,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACrD,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAmB,IAAI,EAAE,IAAI,CAAC,CAAC;QAChE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-api_keys TypeScript SDK — public types.
|
|
3
|
+
*/
|
|
4
|
+
/** Lifecycle state of an API key. */
|
|
5
|
+
export type ApiKeyStatus = "active" | "revoked";
|
|
6
|
+
/** Public representation of an API key (no secret material). */
|
|
7
|
+
export interface ApiKey {
|
|
8
|
+
/** API key identifier in `ApiKey_<uuid4>` format. */
|
|
9
|
+
id: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
/** Clerk user ID for humans, identity UUID for agents. */
|
|
12
|
+
createdBy: string;
|
|
13
|
+
/** `"human"` or `"agent"`. */
|
|
14
|
+
creatorType: string;
|
|
15
|
+
/**
|
|
16
|
+
* UUID of the agent identity this key is scoped to, or `null` for
|
|
17
|
+
* an admin (unscoped) key with full org-wide authority.
|
|
18
|
+
*/
|
|
19
|
+
scopedIdentityId: string | null;
|
|
20
|
+
label: string;
|
|
21
|
+
description: string | null;
|
|
22
|
+
status: ApiKeyStatus;
|
|
23
|
+
/** Last 4 characters of the secret, for display. */
|
|
24
|
+
last4: string;
|
|
25
|
+
/** Truncated key ID prefix for display. */
|
|
26
|
+
displayPrefix: string;
|
|
27
|
+
lastUsedAt: Date | null;
|
|
28
|
+
expiresAt: Date | null;
|
|
29
|
+
revokedAt: Date | null;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Result of {@link ApiKeysResource.create}.
|
|
35
|
+
*
|
|
36
|
+
* The `apiKey` secret is shown ONCE — persist it immediately; it cannot
|
|
37
|
+
* be retrieved later.
|
|
38
|
+
*/
|
|
39
|
+
export interface CreatedApiKey {
|
|
40
|
+
/** Full API key string (use as `X-API-Key`). */
|
|
41
|
+
apiKey: string;
|
|
42
|
+
/** Public metadata for the newly created key. */
|
|
43
|
+
record: ApiKey;
|
|
44
|
+
}
|
|
45
|
+
export interface RawApiKey {
|
|
46
|
+
id: string;
|
|
47
|
+
organization_id: string;
|
|
48
|
+
created_by: string;
|
|
49
|
+
creator_type: string;
|
|
50
|
+
scoped_identity_id: string | null;
|
|
51
|
+
label: string;
|
|
52
|
+
description: string | null;
|
|
53
|
+
status: ApiKeyStatus;
|
|
54
|
+
last4: string;
|
|
55
|
+
display_prefix: string;
|
|
56
|
+
last_used_at: string | null;
|
|
57
|
+
expires_at: string | null;
|
|
58
|
+
revoked_at: string | null;
|
|
59
|
+
created_at: string;
|
|
60
|
+
updated_at: string;
|
|
61
|
+
}
|
|
62
|
+
export interface RawCreatedApiKey {
|
|
63
|
+
api_key: string;
|
|
64
|
+
record: RawApiKey;
|
|
65
|
+
}
|
|
66
|
+
export declare function parseApiKey(r: RawApiKey): ApiKey;
|
|
67
|
+
export declare function parseCreatedApiKey(r: RawCreatedApiKey): CreatedApiKey;
|
|
68
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api_keys/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qCAAqC;AACrC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhD,gEAAgE;AAChE,MAAM,WAAW,MAAM;IACrB,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAA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AW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;CACnB;AAQD,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAkBhD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAErE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-api_keys TypeScript SDK — public types.
|
|
3
|
+
*/
|
|
4
|
+
// ---- parsers ----
|
|
5
|
+
function parseDateOrNull(value) {
|
|
6
|
+
return value === null ? null : new Date(value);
|
|
7
|
+
}
|
|
8
|
+
export function parseApiKey(r) {
|
|
9
|
+
return {
|
|
10
|
+
id: r.id,
|
|
11
|
+
organizationId: r.organization_id,
|
|
12
|
+
createdBy: r.created_by,
|
|
13
|
+
creatorType: r.creator_type,
|
|
14
|
+
scopedIdentityId: r.scoped_identity_id,
|
|
15
|
+
label: r.label,
|
|
16
|
+
description: r.description,
|
|
17
|
+
status: r.status,
|
|
18
|
+
last4: r.last4,
|
|
19
|
+
displayPrefix: r.display_prefix,
|
|
20
|
+
lastUsedAt: parseDateOrNull(r.last_used_at),
|
|
21
|
+
expiresAt: parseDateOrNull(r.expires_at),
|
|
22
|
+
revokedAt: parseDateOrNull(r.revoked_at),
|
|
23
|
+
createdAt: new Date(r.created_at),
|
|
24
|
+
updatedAt: new Date(r.updated_at),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function parseCreatedApiKey(r) {
|
|
28
|
+
return { apiKey: r.api_key, record: parseApiKey(r.record) };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api_keys/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuEH,oBAAoB;AAEpB,SAAS,eAAe,CAAC,KAAoB;IAC3C,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAY;IACtC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,cAAc,EAAE,CAAC,CAAC,eAAe;QACjC,SAAS,EAAE,CAAC,CAAC,UAAU;QACvB,WAAW,EAAE,CAAC,CAAC,YAAY;QAC3B,gBAAgB,EAAE,CAAC,CAAC,kBAAkB;QACtC,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,aAAa,EAAE,CAAC,CAAC,cAAc;QAC/B,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC;QAC3C,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC;QACxC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC;QACxC,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;QACjC,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,CAAmB;IACpD,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;AAC9D,CAAC"}
|