osai-agent 4.0.7 → 4.1.1

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 CHANGED
@@ -128,6 +128,14 @@ osai-agent search list List configured search providers
128
128
 
129
129
  DuckDuckGo is always available with no API key required.
130
130
 
131
+ ### Pro Access
132
+
133
+ ```
134
+ osai-agent pro --key <code> Activate a pro access code
135
+ ```
136
+
137
+ When you reach the daily usage limit (free tier), enter your pro access code to unlock unlimited usage.
138
+
131
139
  ### Other Commands
132
140
 
133
141
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osai-agent",
3
- "version": "4.0.7",
3
+ "version": "4.1.1",
4
4
  "type": "module",
5
5
  "description": "OS AI Agent - YOUR AI AGENT",
6
6
  "main": "src/index.js",
@@ -0,0 +1,47 @@
1
+ import chalk from 'chalk';
2
+ import Conf from 'conf';
3
+ import ora from 'ora';
4
+ import { DEFAULT_SERVER_URL, toHttpUrl, toWsUrl } from '../services/server-url.js';
5
+
6
+ export const claimProKey = async ({ key, server: serverOverride } = {}) => {
7
+ const config = new Conf({ projectName: 'osai-agent' });
8
+ const token = config.get('token');
9
+ if (!token) {
10
+ console.log(chalk.yellow('You must be logged in first. Run: osai-agent register'));
11
+ process.exit(1);
12
+ }
13
+
14
+ const server = toWsUrl(serverOverride || config.get('server') || DEFAULT_SERVER_URL);
15
+ const httpUrl = toHttpUrl(server);
16
+
17
+ const spinner = ora('Claiming pro access code...').start();
18
+
19
+ try {
20
+ const res = await fetch(`${httpUrl}/pro/claim`, {
21
+ method: 'POST',
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ Authorization: `Bearer ${token}`
25
+ },
26
+ body: JSON.stringify({ key })
27
+ });
28
+
29
+ const data = await res.json();
30
+
31
+ if (!res.ok) {
32
+ spinner.fail('Failed to claim code');
33
+ console.log(chalk.red(` ${data.error || 'Error claiming pro access code'}`));
34
+ process.exit(1);
35
+ }
36
+
37
+ config.set({ token: data.token, plan: data.plan });
38
+
39
+ spinner.succeed('Pro access code activated!');
40
+ console.log(chalk.gray(` Plan: ${data.plan_type} (expires ${new Date(data.pro_expires_at).toLocaleDateString()})`));
41
+ console.log(chalk.green('\nYou now have unlimited access to OS AI Agent.'));
42
+ } catch (err) {
43
+ spinner.fail('Network error');
44
+ console.log(chalk.red(` Could not reach server: ${err.message}`));
45
+ process.exit(1);
46
+ }
47
+ };
package/src/index.js CHANGED
@@ -24,6 +24,7 @@ import { searchSet, searchList } from './commands/search.js';
24
24
  import { manageSkills } from './commands/skills.js';
25
25
  import { handleMcpCommand } from './commands/mcp.js';
26
26
  import { stopSubagent } from './commands/stop-subagent.js';
27
+ import { claimProKey } from './commands/pro.js';
27
28
  import minimist from 'minimist';
28
29
 
29
30
  const args = minimist(process.argv.slice(2));
@@ -119,6 +120,10 @@ switch (cmd) {
119
120
  await stopSubagent({ server: args.server });
120
121
  break;
121
122
 
123
+ case 'pro':
124
+ await claimProKey({ key: args.key || args._[1], server: args.server });
125
+ break;
126
+
122
127
  default:
123
128
  if (cmd) {
124
129
  console.error(`Unknown command: ${cmd}`);
@@ -141,6 +146,7 @@ switch (cmd) {
141
146
  console.log(' skills Manage skills');
142
147
  console.log(' mcp Manage MCP servers');
143
148
  console.log(' stop-subagent Stop a running subagent');
149
+ console.log(' pro Activate a pro access code');
144
150
  console.log();
145
151
  process.exit(cmd ? 1 : 0);
146
152
  }