@sente-labs/cli 0.11.0 → 0.14.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 +73 -46
- package/dist/client.js +12 -3
- package/dist/client.js.map +1 -1
- package/dist/commands/inbox.js +30 -4
- package/dist/commands/inbox.js.map +1 -1
- package/dist/commands/registration.js +211 -0
- package/dist/commands/registration.js.map +1 -0
- package/dist/config.js +0 -27
- package/dist/config.js.map +1 -1
- package/dist/index.js +5 -27
- package/dist/index.js.map +1 -1
- package/dist/{skill/autoupdate.js → update.js} +10 -47
- package/dist/update.js.map +1 -0
- package/package.json +3 -3
- package/dist/commands/appGraph.js +0 -110
- package/dist/commands/appGraph.js.map +0 -1
- package/dist/commands/auth.js +0 -54
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/deployWebhook.js +0 -94
- package/dist/commands/deployWebhook.js.map +0 -1
- package/dist/commands/init.js +0 -209
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/project.js +0 -283
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/schedule.js +0 -188
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/secret.js +0 -245
- package/dist/commands/secret.js.map +0 -1
- package/dist/commands/task.js +0 -425
- package/dist/commands/task.js.map +0 -1
- package/dist/commands/workflow.js +0 -69
- package/dist/commands/workflow.js.map +0 -1
- package/dist/skill/SKILL.md +0 -93
- package/dist/skill/autoupdate.js.map +0 -1
- package/dist/skill/template.js +0 -68
- package/dist/skill/template.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# @sente-labs/cli
|
|
2
2
|
|
|
3
|
-
The Sente CLI --
|
|
3
|
+
The Sente CLI -- give your AI agents **managed email identities** (AgentAccount).
|
|
4
|
+
Create an email address your agent owns on `agents.sente.run`, then send,
|
|
5
|
+
receive, and react to mail -- verification links, OTPs, replies -- from your
|
|
6
|
+
terminal, scripts, or Claude Code.
|
|
4
7
|
|
|
5
8
|
## Install
|
|
6
9
|
|
|
@@ -10,79 +13,103 @@ npm install -g @sente-labs/cli
|
|
|
10
13
|
|
|
11
14
|
Requires Node.js 18+.
|
|
12
15
|
|
|
16
|
+
Building an agent that should set this up itself? Point it at the onboarding
|
|
17
|
+
skill: <https://sente.run/skill.md>.
|
|
18
|
+
|
|
13
19
|
## Quickstart
|
|
14
20
|
|
|
15
21
|
```bash
|
|
16
|
-
# 1.
|
|
22
|
+
# 1. Sign in (opens the browser, stores an API key in ~/.sente/credentials)
|
|
17
23
|
sente login
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
sente
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
sente whoami
|
|
25
|
+
|
|
26
|
+
# 2. Give your agent an identity -- a real, reusable email address
|
|
27
|
+
sente identity create --name "Support Bot" --local-part support-bot
|
|
28
|
+
# -> support-bot@agents.sente.run
|
|
29
|
+
|
|
30
|
+
# 3. Read its mail
|
|
31
|
+
sente inbox --identity support-bot # recent messages
|
|
32
|
+
sente wait --identity support-bot --timeout 60 # block until the next message
|
|
33
|
+
sente listen --identity support-bot # stream messages as they arrive
|
|
34
|
+
|
|
35
|
+
# Verification emails: --otp / --magic-link block for the verification message
|
|
36
|
+
# and print JUST the extracted code / link (pipeable):
|
|
37
|
+
CODE=$(sente wait --identity support-bot --otp --timeout 60)
|
|
38
|
+
|
|
39
|
+
# 4. Send from it
|
|
40
|
+
sente send --identity support-bot --to user@example.com \
|
|
41
|
+
--subject "Hello" --text "It works."
|
|
42
|
+
# Reply in-thread to an inbound message:
|
|
43
|
+
sente send --identity support-bot --to user@example.com \
|
|
44
|
+
--subject "Re: Hello" --text "Following up." --reply-to <messageId>
|
|
28
45
|
```
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
with `sente install-skill`.
|
|
47
|
+
Use `--json` on any command for machine-readable output.
|
|
32
48
|
|
|
33
|
-
##
|
|
49
|
+
## Webhooks (push delivery)
|
|
34
50
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
preview deploys (Vercel, Netlify) all work. `localhost` and non-public PR
|
|
38
|
-
previews do not.
|
|
51
|
+
Register your HTTPS endpoint and Sente POSTs a `message.received` event for
|
|
52
|
+
each inbound email. Verify the `X-Sente-Secret` header on every delivery.
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
webhook
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```yaml
|
|
45
|
-
- run: |
|
|
46
|
-
curl -X POST $SENTE_DEPLOY_ENDPOINT \
|
|
47
|
-
-H "X-Sente-Secret: ${{ secrets.SENTE_WEBHOOK_SECRET }}" \
|
|
48
|
-
-d '{"environment":"staging","commitSha":"'"$GITHUB_SHA"'"}'
|
|
54
|
+
```bash
|
|
55
|
+
sente webhook register --url https://my-app.com/hooks/sente --identity support-bot
|
|
56
|
+
sente webhook list
|
|
57
|
+
sente webhook delete <id>
|
|
49
58
|
```
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
Developing the handler locally? Relay live inbound mail to it with no public
|
|
61
|
+
URL -- `listen --forward` POSTs each message in the exact webhook envelope
|
|
62
|
+
(with `x-sente-secret` taken from `SENTE_WEBHOOK_SECRET`, if set):
|
|
52
63
|
|
|
53
64
|
```bash
|
|
54
|
-
sente
|
|
55
|
-
sente project show # show project bound to this repo
|
|
56
|
-
sente task list --json # list tasks
|
|
57
|
-
sente task show <id> # task details
|
|
58
|
-
sente task results <id> --failed-step --json # focused failure payload
|
|
59
|
-
sente task create --workflow <id> --name "..." --instruction "..." \
|
|
60
|
-
--steps-from steps.json
|
|
61
|
-
sente task update <id> --steps-from steps.json
|
|
62
|
-
sente task delete <id>
|
|
63
|
-
sente sync # regenerate .sente/tasks.json
|
|
65
|
+
sente listen --identity support-bot --forward http://localhost:3000/hooks/sente
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
Or run a shell command per message (message JSON on stdin):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
sente listen --identity support-bot --exec './handle-message.sh'
|
|
72
|
+
```
|
|
68
73
|
|
|
69
74
|
## Auth
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
`sente login` stores the API key in `~/.sente/credentials` (mode 0600). The
|
|
77
|
+
key authenticates as your whole organization -- don't paste it into chats or
|
|
78
|
+
commit it. To hand it to your app without echoing it:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
echo "SENTE_API_TOKEN=$(sente token)" >> .env
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For CI or non-interactive use, set env vars instead of logging in:
|
|
73
85
|
|
|
74
86
|
```bash
|
|
75
87
|
export SENTE_API_TOKEN=sk_sente_...
|
|
76
|
-
export SENTE_GATEWAY_URL=https://api.sente.run
|
|
88
|
+
export SENTE_GATEWAY_URL=https://api.sente.run # optional override
|
|
77
89
|
```
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
## Commands
|
|
92
|
+
|
|
93
|
+
| Command | What it does |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `sente login` | Browser sign-in; mints and stores an API key |
|
|
96
|
+
| `sente whoami` | Show the logged-in account + organization |
|
|
97
|
+
| `sente token` | Print the stored API key (for piping into `.env`) |
|
|
98
|
+
| `sente identity create\|list\|show` | Manage email identities |
|
|
99
|
+
| `sente inbox --identity <ref>` | List recent messages |
|
|
100
|
+
| `sente wait --identity <ref>` | Block until the next message (long-poll); `--otp` / `--magic-link` print just the code / link |
|
|
101
|
+
| `sente listen --identity <ref>` | Stream messages; `--exec` / `--forward` to react |
|
|
102
|
+
| `sente send --identity <ref>` | Send email (`--reply-to` threads replies) |
|
|
103
|
+
| `sente webhook register\|list\|delete` | Manage push delivery to your endpoint |
|
|
104
|
+
|
|
105
|
+
`<ref>` is an identity id, email, or local-part.
|
|
80
106
|
|
|
81
107
|
## Documentation
|
|
82
108
|
|
|
83
109
|
- Home: <https://sente.run>
|
|
110
|
+
- Agent onboarding skill: <https://sente.run/skill.md>
|
|
84
111
|
- Issues: <https://github.com/sente-labs/agentic-browser/issues>
|
|
85
112
|
|
|
86
113
|
## License
|
|
87
114
|
|
|
88
|
-
|
|
115
|
+
MIT
|
package/dist/client.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GatewayClient = exports.ApiError = void 0;
|
|
4
4
|
const credentials_1 = require("./credentials");
|
|
5
|
+
const update_1 = require("./update");
|
|
5
6
|
/**
|
|
6
7
|
* Domain-specific error. Surfaces structured failure modes so commands can
|
|
7
8
|
* print clean messages without leaking HTTP internals.
|
|
@@ -45,7 +46,7 @@ class GatewayClient {
|
|
|
45
46
|
headers: {
|
|
46
47
|
Authorization: `Bearer ${this.creds.token}`,
|
|
47
48
|
'Content-Type': 'application/json',
|
|
48
|
-
'User-Agent':
|
|
49
|
+
'User-Agent': `sente-cli/${update_1.CLI_VERSION}`,
|
|
49
50
|
},
|
|
50
51
|
};
|
|
51
52
|
if (opts.body !== undefined) {
|
|
@@ -98,8 +99,16 @@ async function parseResponse(res) {
|
|
|
98
99
|
}
|
|
99
100
|
if (!res.ok) {
|
|
100
101
|
const code = (body && body.code) || `HTTP_${res.status}`;
|
|
101
|
-
const
|
|
102
|
-
|
|
102
|
+
const rawError = body && body.error;
|
|
103
|
+
// `error` may be a string, or a structured value (e.g. an array of zod issues on a 400).
|
|
104
|
+
// Stringify non-strings so the message is readable instead of "[object Object]".
|
|
105
|
+
const message = typeof rawError === 'string'
|
|
106
|
+
? rawError
|
|
107
|
+
: rawError !== undefined
|
|
108
|
+
? JSON.stringify(rawError)
|
|
109
|
+
: typeof body === 'string'
|
|
110
|
+
? body
|
|
111
|
+
: `Request failed with status ${res.status}`;
|
|
103
112
|
throw new ApiError(res.status, code, message, body);
|
|
104
113
|
}
|
|
105
114
|
return body;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,qCAAuC;AAEvC;;;GAGG;AACH,MAAa,QAAS,SAAQ,KAAK;IAEf;IACA;IAEA;IAJlB,YACkB,MAAc,EACd,IAAY,EAC5B,OAAe,EACC,IAAc;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QALC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,SAAI,GAAJ,IAAI,CAAU;QAG9B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAVD,4BAUC;AAeD,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;;;;GAMG;AACH,MAAa,aAAa;IACP,KAAK,CAAc;IACnB,UAAU,CAAS;IAEpC,YAAY,OAAsB,EAAE;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,IAAA,6BAAe,GAAE,CAAC;QACpD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,QAAQ,CAChB,GAAG,EACH,eAAe,EACf,iEAAiE,CAClE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,mBAAmB,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,OAAO,CAAI,IAAY,EAAE,OAAuB,EAAE;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAgB;YACxB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;YAC5B,OAAO,EAAE;gBACP,aAAa,EAAE,UAA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AAQ,KAAK,SAAS;gBACtB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBAC1B,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;oBACxB,CAAC,CAAC,IAAI;oBACN,CAAC,CAAC,8BAA8B,GAAG,CAAC,MAAM,EAAE,CAAC;QACrD,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAS,CAAC;AACnB,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,2BAA2B;IAC3B,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/commands/inbox.js
CHANGED
|
@@ -76,24 +76,50 @@ function registerInboxCommands(program, globalOpts) {
|
|
|
76
76
|
});
|
|
77
77
|
program
|
|
78
78
|
.command('wait')
|
|
79
|
-
.description('Block until the next message arrives for an identity (long-poll)'
|
|
79
|
+
.description('Block until the next message arrives for an identity (long-poll). ' +
|
|
80
|
+
'With --otp / --magic-link, wait for a verification email and print just the code / link (pipeable).')
|
|
80
81
|
.requiredOption('--identity <ref>', IDENTITY_HELP)
|
|
81
82
|
.option('--since <ts>', 'wait for messages after this ISO timestamp')
|
|
82
83
|
.option('--timeout <s>', 'seconds to wait before giving up', '25')
|
|
84
|
+
.option('--otp', 'wait for a verification-code email; print just the code')
|
|
85
|
+
.option('--magic-link', 'wait for a magic-link email; print just the link')
|
|
83
86
|
.action(async (cmdOpts) => {
|
|
84
87
|
const opts = globalOpts();
|
|
88
|
+
if (cmdOpts.otp && cmdOpts.magicLink) {
|
|
89
|
+
process.exit((0, output_1.printError)(new Error('--otp and --magic-link are mutually exclusive'), opts));
|
|
90
|
+
}
|
|
91
|
+
const kind = cmdOpts.otp ? 'otp' : cmdOpts.magicLink ? 'magic_link' : undefined;
|
|
85
92
|
try {
|
|
86
93
|
const client = new client_1.GatewayClient();
|
|
87
94
|
const identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
// The server long-poll caps at 60s per call; loop ≤60s chunks so any --timeout works
|
|
96
|
+
// (verification emails can take up to ~2 min). Anchor `since` once so no message slips
|
|
97
|
+
// through the gap between chunks.
|
|
98
|
+
const deadline = Date.now() + Number(cmdOpts.timeout ?? '25') * 1000;
|
|
99
|
+
// Default to a 60s lookback (matches the server) so a just-arrived email isn't missed;
|
|
100
|
+
// anchored once so the chunked loop below can't skip it between chunks.
|
|
101
|
+
let since = cmdOpts.since ?? new Date(Date.now() - 60_000).toISOString();
|
|
102
|
+
let msg;
|
|
103
|
+
do {
|
|
104
|
+
const remaining = Math.min(60, Math.ceil((deadline - Date.now()) / 1000));
|
|
105
|
+
if (remaining <= 0)
|
|
106
|
+
break;
|
|
107
|
+
msg = await client.request('/v1/messages/wait', {
|
|
108
|
+
query: { identityId, since, timeout: String(remaining), kind },
|
|
109
|
+
});
|
|
110
|
+
} while (!msg && Date.now() < deadline);
|
|
91
111
|
if (!msg) {
|
|
92
112
|
if (!opts.json)
|
|
93
113
|
process.stderr.write('Timed out — no message.\n');
|
|
94
114
|
(0, output_1.printSuccess)(null, () => { }, opts);
|
|
95
115
|
return;
|
|
96
116
|
}
|
|
117
|
+
if (kind && !opts.json) {
|
|
118
|
+
// Bare artifact on stdout so it's pipeable: CODE=$(sente wait --identity x --otp)
|
|
119
|
+
const value = kind === 'otp' ? msg.annotation?.code : msg.annotation?.link;
|
|
120
|
+
process.stdout.write((value ?? '') + '\n');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
97
123
|
(0, output_1.printSuccess)(msg, () => printMessages([msg]), opts);
|
|
98
124
|
}
|
|
99
125
|
catch (err) {
|
|
@@ -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":";;AA8EA,sDA2KC;AAzPD,2DAA2C;AAE3C,sCAA0C;AAC1C,gDAAmD;AACnD,sCAAiE;AAejE,SAAS,aAAa,CAAC,IAAe;IACpC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,CAAC,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,OAAO,IAAI,cAAc,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5G,CAAC;AACH,CAAC;AAED,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAQ1D;;;;;;;GAOG;AACH,KAAK,UAAU,gBAAgB,CAC7B,GAAW,EACX,GAAY,EACZ,QAAyB,EACzB,MAA0B;IAE1B,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE;YACP,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ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MAAM,CAAC,oBAAoB,EAAE,gEAAgE,CAAC;SAC9F,MAAM,CACL,KAAK,EAAE,OAON,EAAE,EAAE;QACH,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;oBACJ,UAAU;oBACV,EAAE,EAAE,OAAO,CAAC,EAAE;oBACd,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,SAAS,EAAE,OAAO,CAAC,OAAO;iBAC3B;aACF,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"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerRegistrationCommands = registerRegistrationCommands;
|
|
4
|
+
const client_1 = require("../client");
|
|
5
|
+
const identityRef_1 = require("../identityRef");
|
|
6
|
+
const output_1 = require("../output");
|
|
7
|
+
const TERMINAL = new Set(['completed', 'failed']);
|
|
8
|
+
const POLL_INTERVAL_MS = 3000;
|
|
9
|
+
// Cap the client-side wait so `register`/`relogin` can't hang forever if a run wedges. The run
|
|
10
|
+
// controller enforces its own wall-clock (RUN_TIMEOUT_MINUTES+2), so this is a safety net above it;
|
|
11
|
+
// on timeout we return the last-polled (non-terminal) run and tell the user to poll `sente run <id>`.
|
|
12
|
+
const MAX_WAIT_MS = 10 * 60 * 1000;
|
|
13
|
+
/**
|
|
14
|
+
* Poll a run to a terminal (completed/failed) or blocked state, printing a
|
|
15
|
+
* live status line to stderr. Returns the final run — or, on timeout, the
|
|
16
|
+
* last-polled (still-running) run. `--json` suppresses the status line.
|
|
17
|
+
*/
|
|
18
|
+
async function waitForRun(client, runId, opts) {
|
|
19
|
+
const deadline = Date.now() + MAX_WAIT_MS;
|
|
20
|
+
let run = await client.request(`/v1/runs/${runId}`);
|
|
21
|
+
let last = '';
|
|
22
|
+
for (;;) {
|
|
23
|
+
if (!opts.json && run.status !== last) {
|
|
24
|
+
process.stderr.write(` ${run.status}…\n`);
|
|
25
|
+
last = run.status;
|
|
26
|
+
}
|
|
27
|
+
if (TERMINAL.has(run.status) || run.status === 'blocked')
|
|
28
|
+
return run;
|
|
29
|
+
if (Date.now() >= deadline)
|
|
30
|
+
return run; // timed out — caller renders "still running"
|
|
31
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
32
|
+
run = await client.request(`/v1/runs/${runId}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Render the outcome of a finished/blocked run to stderr, and exit non-zero on
|
|
37
|
+
* failure. Shared by `register` and `relogin` (same wait/poll UX). `--json`
|
|
38
|
+
* already emitted the full object, so this only handles the human path.
|
|
39
|
+
*/
|
|
40
|
+
function renderRunOutcome(reg, run, opts) {
|
|
41
|
+
(0, output_1.printSuccess)({ registration: reg, run }, () => {
|
|
42
|
+
if (run.status === 'completed') {
|
|
43
|
+
process.stdout.write(`Account ready.\n registration: ${reg.id}\n username: ${reg.username ?? '-'}\n`);
|
|
44
|
+
}
|
|
45
|
+
else if (run.status === 'blocked') {
|
|
46
|
+
process.stderr.write(`Run blocked (${run.error?.code ?? 'unknown'}) — human takeover needed.\n` +
|
|
47
|
+
(run.liveViewUrl ? ` live view: ${run.liveViewUrl}\n` : '') +
|
|
48
|
+
` resume: sente run resume ${run.id}\n`);
|
|
49
|
+
}
|
|
50
|
+
else if (run.status === 'failed') {
|
|
51
|
+
process.stderr.write(`Run failed: ${run.error?.code ?? 'unknown'}${run.error?.detail ? ` — ${run.error.detail}` : ''}\n`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Non-terminal (still running/awaiting_verification) — the client wait timed out, not the run.
|
|
55
|
+
process.stderr.write(`Run still ${run.status} after waiting — check later with:\n sente run ${run.id}\n`);
|
|
56
|
+
}
|
|
57
|
+
}, opts);
|
|
58
|
+
if (run.status !== 'completed')
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* `sente register|registrations|relogin|credentials|run` — drive the
|
|
63
|
+
* register/login loop: create third-party accounts under an identity's email
|
|
64
|
+
* and re-auth them (AgentAccount Slice 1). Targets the Sente API
|
|
65
|
+
* (`/v1/registrations`, `/v1/runs`) with the stored API key.
|
|
66
|
+
*
|
|
67
|
+
* Note: `register` is the third-party signup — distinct from `sente login`,
|
|
68
|
+
* which is Auth0 sign-in to Sente itself. Re-auth of a third-party account is
|
|
69
|
+
* `relogin`.
|
|
70
|
+
*/
|
|
71
|
+
function registerRegistrationCommands(program, globalOpts) {
|
|
72
|
+
program
|
|
73
|
+
.command('register')
|
|
74
|
+
.description('Register a third-party account under an identity (drives the browser + email verification)')
|
|
75
|
+
.argument('<appUrl>', 'signup URL of the third-party app')
|
|
76
|
+
.requiredOption('--identity <ref>', 'identity id, email, or local-part')
|
|
77
|
+
.option('--username <u>', 'desired username (default: derived server-side)')
|
|
78
|
+
.option('--password <p>', 'desired password (default: generated server-side)')
|
|
79
|
+
.option('--no-wait', "return the run id immediately instead of waiting for it to finish")
|
|
80
|
+
.action(async (appUrl, cmdOpts) => {
|
|
81
|
+
const opts = globalOpts();
|
|
82
|
+
try {
|
|
83
|
+
const client = new client_1.GatewayClient();
|
|
84
|
+
const identityId = await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity);
|
|
85
|
+
const credentials = {};
|
|
86
|
+
if (cmdOpts.username)
|
|
87
|
+
credentials.username = cmdOpts.username;
|
|
88
|
+
if (cmdOpts.password)
|
|
89
|
+
credentials.password = cmdOpts.password;
|
|
90
|
+
const { registration, run } = await client.request('/v1/registrations', {
|
|
91
|
+
method: 'POST',
|
|
92
|
+
body: { identityId, appUrl, ...(Object.keys(credentials).length ? { credentials } : {}) },
|
|
93
|
+
});
|
|
94
|
+
if (cmdOpts.wait === false) {
|
|
95
|
+
(0, output_1.printSuccess)({ registration, run }, `Started run ${run.id} (registration ${registration.id})`, opts);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const final = await waitForRun(client, run.id, opts);
|
|
99
|
+
renderRunOutcome(registration, final, opts);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
program
|
|
106
|
+
.command('registrations')
|
|
107
|
+
.description('List third-party accounts and their latest run status')
|
|
108
|
+
.option('--identity <ref>', 'filter to one identity (id, email, or local-part)')
|
|
109
|
+
.action(async (cmdOpts) => {
|
|
110
|
+
const opts = globalOpts();
|
|
111
|
+
try {
|
|
112
|
+
const client = new client_1.GatewayClient();
|
|
113
|
+
const identityId = cmdOpts.identity ? await (0, identityRef_1.resolveIdentityId)(client, cmdOpts.identity) : undefined;
|
|
114
|
+
const rows = await client.request('/v1/registrations', {
|
|
115
|
+
query: { identityId },
|
|
116
|
+
});
|
|
117
|
+
(0, output_1.printSuccess)(rows, () => {
|
|
118
|
+
if (rows.length === 0) {
|
|
119
|
+
process.stdout.write('No registrations yet. Create one with `sente register <appUrl> --identity <ref>`.\n');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const r of rows) {
|
|
123
|
+
const runStatus = r.latestRun ? r.latestRun.status : '-';
|
|
124
|
+
process.stdout.write(`${r.appUrl} ${r.status} run:${runStatus} ${r.id}\n`);
|
|
125
|
+
}
|
|
126
|
+
}, opts);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
program
|
|
133
|
+
.command('relogin')
|
|
134
|
+
.description('Re-authenticate an existing third-party account (F4) — not `sente login`, which is Sente sign-in')
|
|
135
|
+
.argument('<registrationId>', 'registration id (reg_…)')
|
|
136
|
+
.option('--no-wait', 'return the run id immediately instead of waiting for it to finish')
|
|
137
|
+
.action(async (registrationId, cmdOpts) => {
|
|
138
|
+
const opts = globalOpts();
|
|
139
|
+
try {
|
|
140
|
+
const client = new client_1.GatewayClient();
|
|
141
|
+
const { registration, run } = await client.request(`/v1/registrations/${registrationId}/login`, { method: 'POST' });
|
|
142
|
+
if (cmdOpts.wait === false) {
|
|
143
|
+
(0, output_1.printSuccess)({ registration, run }, `Started run ${run.id} (registration ${registration.id})`, opts);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const final = await waitForRun(client, run.id, opts);
|
|
147
|
+
renderRunOutcome(registration, final, opts);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
program
|
|
154
|
+
.command('credentials')
|
|
155
|
+
.description("Print an account's vaulted username/password/origin (for handoff; audited server-side)")
|
|
156
|
+
.argument('<registrationId>', 'registration id (reg_…)')
|
|
157
|
+
.action(async (registrationId) => {
|
|
158
|
+
const opts = globalOpts();
|
|
159
|
+
try {
|
|
160
|
+
const creds = await new client_1.GatewayClient().request(`/v1/registrations/${registrationId}/credentials`);
|
|
161
|
+
(0, output_1.printSuccess)(creds, () => process.stdout.write(`username: ${creds.username}\npassword: ${creds.password}\norigin: ${creds.origin}\n`), opts);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const run = program.command('run').description('Inspect and control register/login runs');
|
|
168
|
+
run
|
|
169
|
+
.command('show', { isDefault: true })
|
|
170
|
+
.description("Show a run's status, error, and live-view URL")
|
|
171
|
+
.argument('<runId>', 'run id (run_…)')
|
|
172
|
+
.action(async (runId) => {
|
|
173
|
+
const opts = globalOpts();
|
|
174
|
+
try {
|
|
175
|
+
const r = await new client_1.GatewayClient().request(`/v1/runs/${runId}`);
|
|
176
|
+
(0, output_1.printSuccess)(r, () => process.stdout.write(`${r.type} run ${r.id}\n status: ${r.status}\n error: ${r.error ? `${r.error.code}${r.error.detail ? ` — ${r.error.detail}` : ''}` : '-'}\n live view: ${r.liveViewUrl ?? '-'}\n`), opts);
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
run
|
|
183
|
+
.command('resume')
|
|
184
|
+
.description('Resume a blocked run after human takeover in the live view')
|
|
185
|
+
.argument('<runId>', 'run id (run_…)')
|
|
186
|
+
.action(async (runId) => {
|
|
187
|
+
const opts = globalOpts();
|
|
188
|
+
try {
|
|
189
|
+
const r = await new client_1.GatewayClient().request(`/v1/runs/${runId}/resume`, { method: 'POST' });
|
|
190
|
+
(0, output_1.printSuccess)(r, `Resumed run ${r.id} (${r.status})`, opts);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
run
|
|
197
|
+
.command('abort')
|
|
198
|
+
.description('Abort a non-terminal run')
|
|
199
|
+
.argument('<runId>', 'run id (run_…)')
|
|
200
|
+
.action(async (runId) => {
|
|
201
|
+
const opts = globalOpts();
|
|
202
|
+
try {
|
|
203
|
+
const r = await new client_1.GatewayClient().request(`/v1/runs/${runId}/abort`, { method: 'POST' });
|
|
204
|
+
(0, output_1.printSuccess)(r, `Aborted run ${r.id} (${r.status})`, opts);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
process.exit((0, output_1.printError)(err, opts));
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../src/commands/registration.ts"],"names":[],"mappings":";;AAiGA,oEAwKC;AAxQD,sCAA0C;AAC1C,gDAAmD;AACnD,sCAAiE;AAyBjE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,+FAA+F;AAC/F,oGAAoG;AACpG,sGAAsG;AACtG,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC;;;;GAIG;AACH,KAAK,UAAU,UAAU,CAAC,MAAqB,EAAE,KAAa,EAAE,IAAgB;IAC9E,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;IAC1C,IAAI,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAM,YAAY,KAAK,EAAE,CAAC,CAAC;IACzD,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,SAAS,CAAC;QACR,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;YAC3C,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC;QACpB,CAAC;QAC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,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/config.js
CHANGED
|
@@ -37,14 +37,12 @@ exports.DEFAULT_AUTH0_AUDIENCE = exports.DEFAULT_AUTH0_CLIENT_ID = exports.DEFAU
|
|
|
37
37
|
exports.gatewayUrl = gatewayUrl;
|
|
38
38
|
exports.envToken = envToken;
|
|
39
39
|
exports.auth0Config = auth0Config;
|
|
40
|
-
exports.readLocalProjectId = readLocalProjectId;
|
|
41
40
|
/**
|
|
42
41
|
* CLI runtime configuration. Env vars take precedence over defaults.
|
|
43
42
|
*
|
|
44
43
|
* SENTE_GATEWAY_URL -- override the gateway base URL
|
|
45
44
|
* SENTE_API_TOKEN -- override the stored PAT (CI use)
|
|
46
45
|
*/
|
|
47
|
-
const fs = __importStar(require("fs"));
|
|
48
46
|
const os = __importStar(require("os"));
|
|
49
47
|
const path = __importStar(require("path"));
|
|
50
48
|
exports.DEFAULT_GATEWAY_URL = 'https://api.sente.run';
|
|
@@ -68,29 +66,4 @@ function auth0Config() {
|
|
|
68
66
|
audience: process.env.SENTE_AUTH0_AUDIENCE || exports.DEFAULT_AUTH0_AUDIENCE,
|
|
69
67
|
};
|
|
70
68
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Read the project id from the local .sente/config.json, walking up from the
|
|
73
|
-
* cwd (same discovery as git/node_modules). Returns null if none is found.
|
|
74
|
-
* Canonical home for this lookup; commands that need a project default to it.
|
|
75
|
-
*/
|
|
76
|
-
function readLocalProjectId() {
|
|
77
|
-
let dir = process.cwd();
|
|
78
|
-
while (true) {
|
|
79
|
-
const candidate = path.join(dir, '.sente', 'config.json');
|
|
80
|
-
if (fs.existsSync(candidate)) {
|
|
81
|
-
try {
|
|
82
|
-
const parsed = JSON.parse(fs.readFileSync(candidate, 'utf8'));
|
|
83
|
-
if (typeof parsed.projectId === 'string')
|
|
84
|
-
return parsed.projectId;
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const parent = path.dirname(dir);
|
|
91
|
-
if (parent === dir)
|
|
92
|
-
return null;
|
|
93
|
-
dir = parent;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
69
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,gCAEC;AAED,4BAEC;AAQD,kCAMC;AAjCD;;;;;GAKG;AACH,uCAAyB;AACzB,2CAA6B;AAEhB,QAAA,mBAAmB,GAAG,uBAAuB,CAAC;AAC9C,QAAA,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACpD,QAAA,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,uBAAe,EAAE,aAAa,CAAC,CAAC;AAE1E,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,2BAAmB,CAAC;AAC9D,CAAC;AAED,SAAgB,QAAQ;IACtB,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,SAAS,CAAC;AAClD,CAAC;AAED,yFAAyF;AACzF,gEAAgE;AACnD,QAAA,oBAAoB,GAAG,mCAAmC,CAAC;AAC3D,QAAA,uBAAuB,GAAG,kCAAkC,CAAC;AAC7D,QAAA,sBAAsB,GAAG,qBAAqB,CAAC;AAE5D,SAAgB,WAAW;IACzB,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,4BAAoB;QAC9D,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,+BAAuB;QACtE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,8BAAsB;KACrE,CAAC;AACJ,CAAC"}
|