@ariso-ai/ari-hooks 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/login.js +8 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariso-ai/ari-hooks",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Set up Claude Code hooks that share your requests and their outcomes with Ari",
5
5
  "type": "module",
6
6
  "bin": {
package/src/login.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  const LOGIN_TIMEOUT_MS = 5 * 60 * 1000;
13
13
 
14
14
  const SUCCESS_HTML = `<!doctype html>
15
- <html><head><title>Ari Hooks</title></head>
15
+ <html><head><meta charset="utf-8"><title>Ari Hooks</title></head>
16
16
  <body style="font-family: sans-serif; text-align: center; padding-top: 4rem;">
17
17
  <h2>✓ Logged in</h2>
18
18
  <p>The Ari Hooks CLI received your token. You can close this window.</p>
@@ -36,7 +36,7 @@ function openBrowser(url) {
36
36
 
37
37
  /**
38
38
  * Browser login: start a one-shot loopback HTTP server, send the user to
39
- * the web app's /cli-auth page with our callback URL, and wait for the
39
+ * the web app's /cli-auth page with our callback port, and wait for the
40
40
  * page to redirect back with a freshly minted API token.
41
41
  */
42
42
  export async function login() {
@@ -45,7 +45,7 @@ export async function login() {
45
45
 
46
46
  const token = await new Promise((resolve, reject) => {
47
47
  const server = createServer((req, res) => {
48
- const url = new URL(req.url, 'http://127.0.0.1');
48
+ const url = new URL(req.url, 'http://localhost');
49
49
  if (url.pathname !== '/callback') {
50
50
  res.writeHead(404).end();
51
51
  return;
@@ -59,20 +59,20 @@ export async function login() {
59
59
  res.writeHead(400).end('Missing token.');
60
60
  return;
61
61
  }
62
- res.writeHead(200, { 'Content-Type': 'text/html' }).end(SUCCESS_HTML);
62
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }).end(SUCCESS_HTML);
63
63
  // Let the response flush before tearing the server down.
64
64
  setTimeout(() => server.close(), 100);
65
65
  resolve(received);
66
66
  });
67
67
 
68
68
  server.on('error', reject);
69
+ // Bind to 127.0.0.1 explicitly — the web app reconstructs the callback
70
+ // as http://127.0.0.1:<port>/callback from callback_port.
69
71
  server.listen(0, '127.0.0.1', () => {
70
72
  const { port } = server.address();
71
73
  const authUrl = new URL('/cli-auth', getWebUrl(config));
72
- authUrl.searchParams.set(
73
- 'callback',
74
- `http://127.0.0.1:${port}/callback`
75
- );
74
+ // Pass only the port; the full callback URL trips the WAF.
75
+ authUrl.searchParams.set('callback_port', String(port));
76
76
  authUrl.searchParams.set('state', state);
77
77
 
78
78
  console.log('Opening your browser to log in to Ari...');