@sente-labs/cli 0.9.0 → 0.10.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/dist/commands/identity.js +6 -3
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/inbox.js +44 -14
- package/dist/commands/inbox.js.map +1 -1
- package/dist/commands/webhook.js +5 -3
- package/dist/commands/webhook.js.map +1 -1
- package/dist/identityRef.js +26 -0
- package/dist/identityRef.js.map +1 -0
- package/dist/skill/SKILL.md +3 -2
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerIdentityCommands = registerIdentityCommands;
|
|
4
4
|
const client_1 = require("../client");
|
|
5
|
+
const identityRef_1 = require("../identityRef");
|
|
5
6
|
const output_1 = require("../output");
|
|
6
7
|
/**
|
|
7
8
|
* `sente identity …` — manage the agent's managed email identities (AgentAccount).
|
|
@@ -59,11 +60,13 @@ function registerIdentityCommands(program, globalOpts) {
|
|
|
59
60
|
identity
|
|
60
61
|
.command('show')
|
|
61
62
|
.description('Show one identity')
|
|
62
|
-
.argument('<
|
|
63
|
-
.action(async (
|
|
63
|
+
.argument('<ref>', 'identity id, email, or local-part')
|
|
64
|
+
.action(async (ref) => {
|
|
64
65
|
const opts = globalOpts();
|
|
65
66
|
try {
|
|
66
|
-
const
|
|
67
|
+
const client = new client_1.GatewayClient();
|
|
68
|
+
const id = await (0, identityRef_1.resolveIdentityId)(client, ref);
|
|
69
|
+
const idt = await client.request(`/v1/identities/${id}`);
|
|
67
70
|
(0, output_1.printSuccess)(idt, () => process.stdout.write(`${idt.email}\n id: ${idt.id}\n name: ${idt.name ?? '-'}\n description: ${idt.description ?? '-'}\n`), opts);
|
|
68
71
|
}
|
|
69
72
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/commands/identity.ts"],"names":[],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BAAmB,CAAC;SAChC,QAAQ,CAAC,OAAO,EAAE,mCAAmC,CAAC;SACtD,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,sBAAa,EAAE,CAAC;YACnC,MAAM,EAAE,GAAG,MAAM,IAAA,+BAAiB,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAChD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAW,kBAAkB,EAAE,EAAE,CAAC,CAAC;YACnE,IAAA,qBAAY,EACV,GAAG,EACH,GAAG,EAAE,CACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,GAAG,GAAG,CAAC,KAAK,oBAAoB,GAAG,CAAC,EAAE,oBAAoB,GAAG,CAAC,IAAI,IAAI,GAAG,oBAAoB,GAAG,CAAC,WAAW,IAAI,GAAG,IAAI,CACxH,EACH,IAAI,CACL,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/commands/inbox.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registerInboxCommands = registerInboxCommands;
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
const client_1 = require("../client");
|
|
6
|
+
const identityRef_1 = require("../identityRef");
|
|
6
7
|
const output_1 = require("../output");
|
|
7
8
|
function printMessages(msgs) {
|
|
8
9
|
if (msgs.length === 0) {
|
|
@@ -14,6 +15,7 @@ function printMessages(msgs) {
|
|
|
14
15
|
process.stdout.write(`${dir} ${m.fromAddr} "${m.subject ?? '(no subject)'}" ${m.createdAt} ${m.id}\n`);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
18
|
+
const IDENTITY_HELP = 'identity id, email, or local-part';
|
|
17
19
|
/**
|
|
18
20
|
* `sente inbox|wait|listen` — read and react to an identity's mail (AgentAccount).
|
|
19
21
|
* Targets the Sente API (`/v1/messages`) with the stored API key.
|
|
@@ -22,20 +24,17 @@ function registerInboxCommands(program, globalOpts) {
|
|
|
22
24
|
program
|
|
23
25
|
.command('inbox')
|
|
24
26
|
.description("List an identity's recent messages (returns immediately)")
|
|
25
|
-
.requiredOption('--identity <
|
|
27
|
+
.requiredOption('--identity <ref>', IDENTITY_HELP)
|
|
26
28
|
.option('--since <ts>', 'only messages after this ISO timestamp')
|
|
27
29
|
.option('--direction <dir>', 'inbound | outbound')
|
|
28
30
|
.option('--limit <n>', 'max messages', '50')
|
|
29
31
|
.action(async (cmdOpts) => {
|
|
30
32
|
const opts = globalOpts();
|
|
31
33
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
direction: cmdOpts.direction,
|
|
37
|
-
limit: cmdOpts.limit,
|
|
38
|
-
},
|
|
34
|
+
const client = new client_1.GatewayClient();
|
|
35
|
+
const identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
36
|
+
const msgs = await client.request('/v1/messages', {
|
|
37
|
+
query: { identityId, since: cmdOpts.since, direction: cmdOpts.direction, limit: cmdOpts.limit },
|
|
39
38
|
});
|
|
40
39
|
(0, output_1.printSuccess)(msgs, () => printMessages(msgs), opts);
|
|
41
40
|
}
|
|
@@ -46,14 +45,16 @@ function registerInboxCommands(program, globalOpts) {
|
|
|
46
45
|
program
|
|
47
46
|
.command('wait')
|
|
48
47
|
.description('Block until the next message arrives for an identity (long-poll)')
|
|
49
|
-
.requiredOption('--identity <
|
|
48
|
+
.requiredOption('--identity <ref>', IDENTITY_HELP)
|
|
50
49
|
.option('--since <ts>', 'wait for messages after this ISO timestamp')
|
|
51
50
|
.option('--timeout <s>', 'seconds to wait before giving up', '25')
|
|
52
51
|
.action(async (cmdOpts) => {
|
|
53
52
|
const opts = globalOpts();
|
|
54
53
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
const client = new client_1.GatewayClient();
|
|
55
|
+
const identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
56
|
+
const msg = await client.request('/v1/messages/wait', {
|
|
57
|
+
query: { identityId, since: cmdOpts.since, timeout: cmdOpts.timeout },
|
|
57
58
|
});
|
|
58
59
|
if (!msg) {
|
|
59
60
|
if (!opts.json)
|
|
@@ -70,12 +71,18 @@ function registerInboxCommands(program, globalOpts) {
|
|
|
70
71
|
program
|
|
71
72
|
.command('listen')
|
|
72
73
|
.description('Stream messages as they arrive (long-poll loop). Ctrl-C to stop.')
|
|
73
|
-
.requiredOption('--identity <
|
|
74
|
+
.requiredOption('--identity <ref>', IDENTITY_HELP)
|
|
74
75
|
.option('--since <ts>', 'start after this ISO timestamp')
|
|
75
76
|
.option('--exec <cmd>', 'run this shell command per message (message JSON on stdin)')
|
|
76
77
|
.action(async (cmdOpts) => {
|
|
77
|
-
const opts = globalOpts();
|
|
78
78
|
const client = new client_1.GatewayClient();
|
|
79
|
+
let identityId;
|
|
80
|
+
try {
|
|
81
|
+
identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
process.exit((0, output_1.printError)(err, globalOpts()));
|
|
85
|
+
}
|
|
79
86
|
let since = cmdOpts.since;
|
|
80
87
|
process.stderr.write(`Listening on ${cmdOpts.identity}… (Ctrl-C to stop)\n`);
|
|
81
88
|
// Long-poll loop. Retry transient errors rather than dying — this is a daemon.
|
|
@@ -83,7 +90,7 @@ function registerInboxCommands(program, globalOpts) {
|
|
|
83
90
|
let msg;
|
|
84
91
|
try {
|
|
85
92
|
msg = await client.request('/v1/messages/wait', {
|
|
86
|
-
query: { identityId
|
|
93
|
+
query: { identityId, since, timeout: '25' },
|
|
87
94
|
});
|
|
88
95
|
}
|
|
89
96
|
catch (err) {
|
|
@@ -104,5 +111,28 @@ function registerInboxCommands(program, globalOpts) {
|
|
|
104
111
|
since = msg.createdAt;
|
|
105
112
|
}
|
|
106
113
|
});
|
|
114
|
+
program
|
|
115
|
+
.command('send')
|
|
116
|
+
.description('Send an email from an identity')
|
|
117
|
+
.requiredOption('--identity <ref>', IDENTITY_HELP)
|
|
118
|
+
.requiredOption('--to <email>', 'recipient email')
|
|
119
|
+
.requiredOption('--subject <subject>', 'subject line')
|
|
120
|
+
.option('--text <text>', 'plain-text body')
|
|
121
|
+
.option('--html <html>', 'HTML body')
|
|
122
|
+
.action(async (cmdOpts) => {
|
|
123
|
+
const opts = globalOpts();
|
|
124
|
+
try {
|
|
125
|
+
const client = new client_1.GatewayClient();
|
|
126
|
+
const identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
127
|
+
const msg = await client.request('/v1/messages', {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
body: { identityId, to: cmdOpts.to, subject: cmdOpts.subject, text: cmdOpts.text, html: cmdOpts.html },
|
|
130
|
+
});
|
|
131
|
+
(0, output_1.printSuccess)(msg, `Sent to ${cmdOpts.to} (${msg.id})`, opts);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
107
137
|
}
|
|
108
138
|
//# sourceMappingURL=inbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":";;AAkCA,sDAiHC;AAnJD,2DAA2C;AAE3C,sCAA0C;AAC1C,gDAAmD;AACnD,sCAAiE;AAajE,SAAS,aAAa,CAAC,IAAe;IACpC,I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,EAAE,OAAwF,EAAE,EAAE;QACjG,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,sBAAa,EAAE,CAAC;YACnC,MAAM,UAAU,GAAG,MAAM,IAAA,+BAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;YACrE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAU,cAAc,EAAE;gBACxD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;aACvG,CAAC,CAAC;YACH,IAAA,qBAAY,EAAC,GAAG,EAAE,WAAW,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
package/dist/commands/webhook.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerWebhookCommands = registerWebhookCommands;
|
|
4
4
|
const client_1 = require("../client");
|
|
5
|
+
const identityRef_1 = require("../identityRef");
|
|
5
6
|
const output_1 = require("../output");
|
|
6
7
|
/**
|
|
7
8
|
* `sente webhook …` — register YOUR endpoint so Sente pushes message events to it.
|
|
@@ -13,18 +14,19 @@ function registerWebhookCommands(program, globalOpts) {
|
|
|
13
14
|
.command('register')
|
|
14
15
|
.description('Point Sente at your HTTPS endpoint (idempotent per url+identity)')
|
|
15
16
|
.requiredOption('--url <url>', 'your HTTPS endpoint')
|
|
16
|
-
.option('--identity <
|
|
17
|
+
.option('--identity <ref>', 'scope to one identity — id, email, or local-part (default: all of the org)')
|
|
17
18
|
.option('--events <list>', 'comma-separated events', 'message.received')
|
|
18
19
|
.action(async (cmdOpts) => {
|
|
19
20
|
const opts = globalOpts();
|
|
20
21
|
try {
|
|
22
|
+
const client = new client_1.GatewayClient();
|
|
21
23
|
const body = {
|
|
22
24
|
url: cmdOpts.url,
|
|
23
25
|
events: (cmdOpts.events ?? 'message.received').split(',').map((e) => e.trim()).filter(Boolean),
|
|
24
26
|
};
|
|
25
27
|
if (cmdOpts.identity)
|
|
26
|
-
body.identityId = cmdOpts.identity;
|
|
27
|
-
const w = await
|
|
28
|
+
body.identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
29
|
+
const w = await client.request('/v1/webhooks', { method: 'POST', body });
|
|
28
30
|
(0, output_1.printSuccess)(w, () => process.stdout.write(`Registered webhook ${w.id} → ${w.url}\nSecret: ${w.secret ?? '(unchanged)'}\nVerify the X-Sente-Secret header on each delivery.\n`), opts);
|
|
29
31
|
}
|
|
30
32
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/commands/webhook.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/commands/webhook.ts"],"names":[],"mappings":";;AAkBA,0DAsEC;AAvFD,sCAA0C;AAC1C,gDAAmD;AACnD,sCAAiE;AAWjE;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,OAAgB,EAAE,UAA4B;IACpF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAEhG,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,kEAAkE,CAAC;SAC/E,cAAc,CAAC,aAAa,E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AE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;YACpF,IAAA,qBAAY,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveIdentityId = resolveIdentityId;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
/**
|
|
6
|
+
* Resolve an `--identity` value to the `idt_…` id. Accepts:
|
|
7
|
+
* - the id itself (`idt_…`) → returned as-is
|
|
8
|
+
* - the full email (`x@agents…`) → looked up
|
|
9
|
+
* - the local-part (`x`) → looked up (matched against the email's local-part)
|
|
10
|
+
* Names are NOT accepted — they aren't unique. One list call; cached per process.
|
|
11
|
+
*/
|
|
12
|
+
let cache = null;
|
|
13
|
+
async function resolveIdentityId(client, value) {
|
|
14
|
+
const v = value.trim();
|
|
15
|
+
if (/^idt_/.test(v))
|
|
16
|
+
return v;
|
|
17
|
+
if (!cache)
|
|
18
|
+
cache = await client.request('/v1/identities');
|
|
19
|
+
const needle = v.toLowerCase();
|
|
20
|
+
const match = cache.find((r) => r.email.toLowerCase() === needle || r.email.toLowerCase().split('@')[0] === needle);
|
|
21
|
+
if (!match) {
|
|
22
|
+
throw new client_1.ApiError(404, 'IDENTITY_NOT_FOUND', `No identity matching "${value}". Use its local-part, email, or id — see \`sente identity list\`.`);
|
|
23
|
+
}
|
|
24
|
+
return match.id;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=identityRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityRef.js","sourceRoot":"","sources":["../src/identityRef.ts"],"names":[],"mappings":";;AAgBA,8CAgBC;AAhCD,qCAAmD;AAOnD;;;;;;GAMG;AACH,IAAI,KAAK,GAAyB,IAAI,CAAC;AAEhC,KAAK,UAAU,iBAAiB,CAAC,MAAqB,EAAE,KAAa;IAC1E,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACvB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK;QAAE,KAAK,GAAG,MAAM,MAAM,CAAC,OAAO,CAAgB,gBAAgB,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACtB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAC1F,CAAC;IACF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,iBAAQ,CAChB,GAAG,EACH,oBAAoB,EACpB,yBAAyB,KAAK,oEAAoE,CACnG,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC;AAClB,CAAC"}
|
package/dist/skill/SKILL.md
CHANGED
|
@@ -70,11 +70,12 @@ Discover live options with `sente --help` and `sente <command> --help`. Canonica
|
|
|
70
70
|
| `sente identity show <id>` | Show one identity |
|
|
71
71
|
| `sente inbox --identity <id> [--since <ts>] [--limit <n>]` | List recent messages (returns immediately) |
|
|
72
72
|
| `sente wait --identity <id> [--since <ts>] [--timeout <s>]` | Block until the next matching message (long-poll) |
|
|
73
|
-
| `sente listen --identity <
|
|
73
|
+
| `sente listen --identity <ref> [--exec <cmd>]` | Stream messages as they arrive; optionally run a command per message |
|
|
74
|
+
| `sente send --identity <ref> --to <email> --subject <s> [--text <t>] [--html <h>]` | Send an email **from** the identity (reply or new message) |
|
|
74
75
|
| `sente webhook register --url <url> [--identity <id>] [--events <list>]` | Point Sente at your HTTPS endpoint; returns the org webhook secret. Idempotent per (url, identity) |
|
|
75
76
|
| `sente webhook list` / `sente webhook delete <id>` | Manage webhooks |
|
|
76
77
|
|
|
77
|
-
`--json` on any command emits machine-readable output.
|
|
78
|
+
Anywhere a command takes `--identity`, pass the **id, email, or local-part** — all resolve to the same identity. `--json` on any command emits machine-readable output.
|
|
78
79
|
|
|
79
80
|
## Rules (important)
|
|
80
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sente-labs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Sente CLI -- give your AI agents managed email identities: create identities, receive and react to email, manage webhooks, from your terminal and Claude Code.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sente": "dist/index.js"
|