agor-live 0.6.8 → 0.6.9

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.
@@ -9,10 +9,6 @@ declare class Login extends Command {
9
9
  password: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
- /**
13
- * Prompt helper with proper typing
14
- */
15
- private prompt;
16
12
  }
17
13
 
18
14
  export { Login as default };
@@ -1,9 +1,9 @@
1
1
  // src/commands/auth/login.ts
2
- import * as readline from "readline";
3
2
  import { createRestClient, isDaemonRunning } from "@agor/core/api";
4
3
  import { getDaemonUrl } from "@agor/core/config";
5
4
  import { Command, Flags } from "@oclif/core";
6
5
  import chalk from "chalk";
6
+ import inquirer from "inquirer";
7
7
 
8
8
  // src/lib/auth.ts
9
9
  import { mkdir, readFile, unlink, writeFile } from "fs/promises";
@@ -45,14 +45,38 @@ var Login = class _Login extends Command {
45
45
  chalk.red("\u2717 Daemon not running") + "\n\n" + chalk.bold("To start the daemon:") + "\n " + chalk.cyan("cd apps/agor-daemon && pnpm dev")
46
46
  );
47
47
  }
48
- const email = flags.email || await this.prompt("Email", {
49
- type: "input",
50
- required: true
51
- });
52
- const password = flags.password || await this.prompt("Password", {
53
- type: "hide",
54
- required: true
55
- });
48
+ let email = flags.email;
49
+ let password = flags.password;
50
+ if (!email || !password) {
51
+ const answers = await inquirer.prompt([
52
+ {
53
+ type: "input",
54
+ name: "email",
55
+ message: "Email",
56
+ default: email,
57
+ validate: (input) => {
58
+ if (!input || !input.includes("@")) {
59
+ return "Please enter a valid email address";
60
+ }
61
+ return true;
62
+ }
63
+ },
64
+ {
65
+ type: "password",
66
+ name: "password",
67
+ message: "Password",
68
+ mask: "*",
69
+ validate: (input) => {
70
+ if (!input) {
71
+ return "Password is required";
72
+ }
73
+ return true;
74
+ }
75
+ }
76
+ ]);
77
+ email = answers.email;
78
+ password = answers.password;
79
+ }
56
80
  const client = await createRestClient(daemonUrl);
57
81
  try {
58
82
  this.log(chalk.dim("Authenticating..."));
@@ -104,29 +128,6 @@ var Login = class _Login extends Command {
104
128
  this.error(chalk.red(`\u2717 Authentication failed: ${errorMessage}`));
105
129
  }
106
130
  }
107
- /**
108
- * Prompt helper with proper typing
109
- */
110
- async prompt(message, options) {
111
- return new Promise((resolve) => {
112
- const rl = readline.createInterface({
113
- input: process.stdin,
114
- output: process.stdout
115
- });
116
- const hiddenOutput = options.type === "hide";
117
- if (hiddenOutput && process.stdin.isTTY) {
118
- process.stdin.setRawMode?.(true);
119
- }
120
- rl.question(`${message}: `, (answer) => {
121
- if (hiddenOutput && process.stdin.isTTY) {
122
- process.stdin.setRawMode?.(false);
123
- console.log("");
124
- }
125
- rl.close();
126
- resolve(answer.trim());
127
- });
128
- });
129
- }
130
131
  };
131
132
  export {
132
133
  Login as default
@@ -1,9 +1,9 @@
1
1
  // src/commands/auth/login.ts
2
- import * as readline from "readline";
3
2
  import { createRestClient, isDaemonRunning } from "@agor/core/api";
4
3
  import { getDaemonUrl } from "@agor/core/config";
5
4
  import { Command, Flags } from "@oclif/core";
6
5
  import chalk from "chalk";
6
+ import inquirer from "inquirer";
7
7
 
8
8
  // src/lib/auth.ts
9
9
  import { mkdir, readFile, unlink, writeFile } from "fs/promises";
@@ -45,14 +45,38 @@ var Login = class _Login extends Command {
45
45
  chalk.red("\u2717 Daemon not running") + "\n\n" + chalk.bold("To start the daemon:") + "\n " + chalk.cyan("cd apps/agor-daemon && pnpm dev")
46
46
  );
47
47
  }
48
- const email = flags.email || await this.prompt("Email", {
49
- type: "input",
50
- required: true
51
- });
52
- const password = flags.password || await this.prompt("Password", {
53
- type: "hide",
54
- required: true
55
- });
48
+ let email = flags.email;
49
+ let password = flags.password;
50
+ if (!email || !password) {
51
+ const answers = await inquirer.prompt([
52
+ {
53
+ type: "input",
54
+ name: "email",
55
+ message: "Email",
56
+ default: email,
57
+ validate: (input) => {
58
+ if (!input || !input.includes("@")) {
59
+ return "Please enter a valid email address";
60
+ }
61
+ return true;
62
+ }
63
+ },
64
+ {
65
+ type: "password",
66
+ name: "password",
67
+ message: "Password",
68
+ mask: "*",
69
+ validate: (input) => {
70
+ if (!input) {
71
+ return "Password is required";
72
+ }
73
+ return true;
74
+ }
75
+ }
76
+ ]);
77
+ email = answers.email;
78
+ password = answers.password;
79
+ }
56
80
  const client = await createRestClient(daemonUrl);
57
81
  try {
58
82
  this.log(chalk.dim("Authenticating..."));
@@ -104,29 +128,6 @@ var Login = class _Login extends Command {
104
128
  this.error(chalk.red(`\u2717 Authentication failed: ${errorMessage}`));
105
129
  }
106
130
  }
107
- /**
108
- * Prompt helper with proper typing
109
- */
110
- async prompt(message, options) {
111
- return new Promise((resolve) => {
112
- const rl = readline.createInterface({
113
- input: process.stdin,
114
- output: process.stdout
115
- });
116
- const hiddenOutput = options.type === "hide";
117
- if (hiddenOutput && process.stdin.isTTY) {
118
- process.stdin.setRawMode?.(true);
119
- }
120
- rl.question(`${message}: `, (answer) => {
121
- if (hiddenOutput && process.stdin.isTTY) {
122
- process.stdin.setRawMode?.(false);
123
- console.log("");
124
- }
125
- rl.close();
126
- resolve(answer.trim());
127
- });
128
- });
129
- }
130
131
  };
131
132
 
132
133
  // src/commands/login.ts
@@ -5019,7 +5019,9 @@ async function main() {
5019
5019
  bearerFormat: "JWT"
5020
5020
  }
5021
5021
  }
5022
- }
5022
+ },
5023
+ // Apply BearerAuth globally to all endpoints (except public endpoints like /health, /login)
5024
+ security: [{ BearerAuth: [] }]
5023
5025
  }
5024
5026
  })
5025
5027
  );
@@ -5497,9 +5499,16 @@ async function main() {
5497
5499
  60 * 60 * 1e3
5498
5500
  );
5499
5501
  app.use("/authentication", authentication);
5500
- app.service("authentication").hooks({
5502
+ const authService = app.service("authentication");
5503
+ authService.docs = {
5504
+ description: "Authentication service for user login and token management",
5505
+ // Override global security - login endpoint must be public
5506
+ security: []
5507
+ };
5508
+ authService.hooks({
5501
5509
  before: {
5502
5510
  create: [
5511
+ // biome-ignore lint/suspicious/noExplicitAny: FeathersJS context type not fully typed
5503
5512
  async (context) => {
5504
5513
  const data = Array.isArray(context.data) ? context.data[0] : context.data;
5505
5514
  if (context.params.provider) {
@@ -5522,6 +5531,7 @@ async function main() {
5522
5531
  },
5523
5532
  after: {
5524
5533
  create: [
5534
+ // biome-ignore lint/suspicious/noExplicitAny: FeathersJS context type not fully typed
5525
5535
  async (context) => {
5526
5536
  if (context.result?.user && context.result.user.user_id !== "anonymous") {
5527
5537
  const refreshToken = jwt.sign(
@@ -5590,6 +5600,12 @@ async function main() {
5590
5600
  }
5591
5601
  }
5592
5602
  });
5603
+ const refreshService = app.service("authentication/refresh");
5604
+ refreshService.docs = {
5605
+ description: "Token refresh endpoint - obtain a new access token using a refresh token",
5606
+ // Override global security - refresh endpoint must be public to obtain new tokens
5607
+ security: []
5608
+ };
5593
5609
  const messagesRepo = new MessagesRepository2(db);
5594
5610
  const sessionsRepo = new SessionRepository3(db);
5595
5611
  const sessionMCPRepo = new SessionMCPServerRepository2(db);
@@ -6359,6 +6375,12 @@ async function main() {
6359
6375
  return publicResponse;
6360
6376
  }
6361
6377
  });
6378
+ const healthService = app.service("health");
6379
+ healthService.docs = {
6380
+ description: "Health check endpoint (always public)",
6381
+ // Override global security to allow unauthenticated access
6382
+ security: []
6383
+ };
6362
6384
  if (config.daemon?.mcpEnabled !== false) {
6363
6385
  const { setupMCPRoutes: setupMCPRoutes2 } = await Promise.resolve().then(() => (init_routes(), routes_exports));
6364
6386
  setupMCPRoutes2(app);