@agentage/cli 0.0.2
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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/setup.d.ts +19 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +102 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +36 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +12 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +43 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/callback-server.d.ts +7 -0
- package/dist/lib/callback-server.d.ts.map +1 -0
- package/dist/lib/callback-server.js +72 -0
- package/dist/lib/callback-server.js.map +1 -0
- package/dist/lib/config.d.ts +20 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +34 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/oauth.d.ts +31 -0
- package/dist/lib/oauth.d.ts.map +1 -0
- package/dist/lib/oauth.js +77 -0
- package/dist/lib/oauth.js.map +1 -0
- package/dist/lib/origins.d.ts +12 -0
- package/dist/lib/origins.d.ts.map +1 -0
- package/dist/lib/origins.js +26 -0
- package/dist/lib/origins.js.map +1 -0
- package/dist/lib/status-info.d.ts +18 -0
- package/dist/lib/status-info.d.ts.map +1 -0
- package/dist/lib/status-info.js +39 -0
- package/dist/lib/status-info.js.map +1 -0
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +5 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Agentage Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @agentage/cli
|
|
2
|
+
|
|
3
|
+
[](https://github.com/agentage/cli/actions/workflows/ci.yml)
|
|
4
|
+
[](https://badge.fury.io/js/%40agentage%2Fcli)
|
|
5
|
+
|
|
6
|
+
The [agentage](https://agentage.io) command line.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @agentage/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requires Node.js >= 22.
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
### `agentage setup`
|
|
19
|
+
|
|
20
|
+
Signs this machine in to your agentage account. Opens a browser for OAuth 2.1
|
|
21
|
+
sign-in (PKCE) and stores the resulting tokens in `~/.agentage/auth.json`
|
|
22
|
+
(mode 0600). No passwords ever touch the terminal.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
agentage setup # browser sign-in, then prints status
|
|
26
|
+
agentage setup --no-browser # print the sign-in URL instead of opening a browser
|
|
27
|
+
agentage setup --reauth # force a fresh sign-in
|
|
28
|
+
agentage setup --disconnect # sign out and remove local credentials
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### `agentage status`
|
|
32
|
+
|
|
33
|
+
Shows this machine's connection, one line per fact: CLI version, target,
|
|
34
|
+
sign-in state, and endpoint reachability.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
agentage status
|
|
38
|
+
agentage status --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Environment
|
|
42
|
+
|
|
43
|
+
| Variable | Purpose | Default |
|
|
44
|
+
| --------------------- | --------------------------- | ------------- |
|
|
45
|
+
| `AGENTAGE_SITE_FQDN` | Target host | `agentage.io` |
|
|
46
|
+
| `AGENTAGE_CONFIG_DIR` | Credential/config directory | `~/.agentage` |
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm ci
|
|
52
|
+
npm run verify # type-check + lint + format + unit tests + build
|
|
53
|
+
npm run build && npm run test:e2e # live e2e (Playwright) against the dev stack
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { registerSetup } from './commands/setup.js';
|
|
4
|
+
import { registerStatus } from './commands/status.js';
|
|
5
|
+
import { VERSION } from './utils/version.js';
|
|
6
|
+
const program = new Command();
|
|
7
|
+
program.name('agentage').description('The agentage CLI').version(VERSION);
|
|
8
|
+
registerSetup(program);
|
|
9
|
+
registerStatus(program);
|
|
10
|
+
program.parseAsync().catch((err) => {
|
|
11
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE1E,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,cAAc,CAAC,OAAO,CAAC,CAAC;AAExB,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC1C,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Command } from 'commander';
|
|
2
|
+
import { startCallbackServer } from '../lib/callback-server.js';
|
|
3
|
+
import { exchangeCode, registerClient, revokeToken } from '../lib/oauth.js';
|
|
4
|
+
export interface SetupOptions {
|
|
5
|
+
disconnect?: boolean;
|
|
6
|
+
reauth?: boolean;
|
|
7
|
+
browser?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SetupDeps {
|
|
10
|
+
register: typeof registerClient;
|
|
11
|
+
exchange: typeof exchangeCode;
|
|
12
|
+
revoke: typeof revokeToken;
|
|
13
|
+
startServer: typeof startCallbackServer;
|
|
14
|
+
openBrowser: (url: string) => Promise<void>;
|
|
15
|
+
printStatus: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare const runSetup: (opts: SetupOptions, deps?: SetupDeps) => Promise<void>;
|
|
18
|
+
export declare const registerSetup: (program: Command) => void;
|
|
19
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAEL,YAAY,EAGZ,cAAc,EACd,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AAIzB,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,OAAO,cAAc,CAAC;IAChC,QAAQ,EAAE,OAAO,YAAY,CAAC;IAC9B,MAAM,EAAE,OAAO,WAAW,CAAC;IAC3B,WAAW,EAAE,OAAO,mBAAmB,CAAC;IACxC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAmCD,eAAO,MAAM,QAAQ,GACnB,MAAM,YAAY,EAClB,OAAM,SAAuB,KAC5B,OAAO,CAAC,IAAI,CA8Cd,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,IAgBhD,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { startCallbackServer } from '../lib/callback-server.js';
|
|
3
|
+
import { deleteAuth, ensureConfigDir, readAuth, saveAuth } from '../lib/config.js';
|
|
4
|
+
import { buildAuthorizeUrl, exchangeCode, pkcePair, randomState, registerClient, revokeToken, } from '../lib/oauth.js';
|
|
5
|
+
import { links, siteFqdn } from '../lib/origins.js';
|
|
6
|
+
import { runStatus } from './status.js';
|
|
7
|
+
const defaultDeps = {
|
|
8
|
+
register: registerClient,
|
|
9
|
+
exchange: exchangeCode,
|
|
10
|
+
revoke: revokeToken,
|
|
11
|
+
startServer: startCallbackServer,
|
|
12
|
+
openBrowser: async (url) => {
|
|
13
|
+
const { default: open } = await import('open');
|
|
14
|
+
await open(url);
|
|
15
|
+
},
|
|
16
|
+
printStatus: () => runStatus({}),
|
|
17
|
+
};
|
|
18
|
+
const toAuthState = (fqdn, clientId, tokens) => ({
|
|
19
|
+
siteFqdn: fqdn,
|
|
20
|
+
clientId,
|
|
21
|
+
tokens: {
|
|
22
|
+
accessToken: tokens.access_token,
|
|
23
|
+
refreshToken: tokens.refresh_token,
|
|
24
|
+
expiresAt: tokens.expires_in ? Date.now() + tokens.expires_in * 1000 : undefined,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const disconnect = async (deps) => {
|
|
28
|
+
const auth = readAuth();
|
|
29
|
+
if (!auth) {
|
|
30
|
+
console.log('Nothing to disconnect.');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await deps.revoke(links(auth.siteFqdn).auth, auth.tokens.accessToken);
|
|
34
|
+
deleteAuth();
|
|
35
|
+
console.log('Disconnected - local credentials removed.');
|
|
36
|
+
};
|
|
37
|
+
export const runSetup = async (opts, deps = defaultDeps) => {
|
|
38
|
+
if (opts.disconnect) {
|
|
39
|
+
await disconnect(deps);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (readAuth() && !opts.reauth) {
|
|
43
|
+
console.log(`Already signed in. Run ${chalk.white('agentage setup --reauth')} to sign in again.\n`);
|
|
44
|
+
await deps.printStatus();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const fqdn = siteFqdn();
|
|
48
|
+
const target = links(fqdn);
|
|
49
|
+
ensureConfigDir();
|
|
50
|
+
const { verifier, challenge } = pkcePair();
|
|
51
|
+
const state = randomState();
|
|
52
|
+
const server = await deps.startServer(state);
|
|
53
|
+
try {
|
|
54
|
+
const clientId = await deps.register(target.auth, server.redirectUri);
|
|
55
|
+
const url = buildAuthorizeUrl(target.auth, {
|
|
56
|
+
clientId,
|
|
57
|
+
redirectUri: server.redirectUri,
|
|
58
|
+
challenge,
|
|
59
|
+
state,
|
|
60
|
+
});
|
|
61
|
+
console.log(`\nSign in to agentage (${fqdn}):\n\n ${url}\n`);
|
|
62
|
+
if (opts.browser === false)
|
|
63
|
+
console.log('Open the URL above in a browser to continue.');
|
|
64
|
+
else
|
|
65
|
+
await deps
|
|
66
|
+
.openBrowser(url)
|
|
67
|
+
.catch(() => console.log('Could not open a browser - use the URL above.'));
|
|
68
|
+
console.log('Waiting for sign-in to complete...');
|
|
69
|
+
const code = await server.waitForCode();
|
|
70
|
+
const tokens = await deps.exchange(target.auth, {
|
|
71
|
+
clientId,
|
|
72
|
+
code,
|
|
73
|
+
redirectUri: server.redirectUri,
|
|
74
|
+
verifier,
|
|
75
|
+
});
|
|
76
|
+
saveAuth(toAuthState(fqdn, clientId, tokens));
|
|
77
|
+
console.log(chalk.green('\nSigned in.\n'));
|
|
78
|
+
await deps.printStatus();
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
server.close();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export const registerSetup = (program) => {
|
|
85
|
+
program
|
|
86
|
+
.command('setup')
|
|
87
|
+
.description('Sign in and connect this machine to your agentage account')
|
|
88
|
+
.option('--disconnect', 'sign out and remove local credentials')
|
|
89
|
+
.option('--reauth', 'force a fresh sign-in')
|
|
90
|
+
.option('--no-browser', 'print the sign-in URL instead of opening a browser')
|
|
91
|
+
.action(async (opts) => {
|
|
92
|
+
try {
|
|
93
|
+
await runSetup(opts);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
97
|
+
console.error(chalk.red(`Setup failed: ${message}`));
|
|
98
|
+
process.exitCode = 1;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AACnG,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,GAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiBxC,MAAM,WAAW,GAAc;IAC7B,QAAQ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OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Command } from 'commander';
|
|
2
|
+
import { type StatusReport } from '../lib/status-info.js';
|
|
3
|
+
export declare const printStatus: (report: StatusReport) => void;
|
|
4
|
+
export declare const runStatus: (opts?: {
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
export declare const registerStatus: (program: Command) => void;
|
|
8
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAcxE,eAAO,MAAM,WAAW,GAAI,QAAQ,YAAY,KAAG,IASlD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,OAAM;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,OAAO,CAAC,IAAI,CAI3E,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,IAMjD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { readAuth } from '../lib/config.js';
|
|
3
|
+
import { siteFqdn } from '../lib/origins.js';
|
|
4
|
+
import { gatherStatus } from '../lib/status-info.js';
|
|
5
|
+
const mark = (good) => (good ? chalk.green('✓') : chalk.red('✗'));
|
|
6
|
+
const row = (label, value) => {
|
|
7
|
+
console.log(`${label.padEnd(10)} ${value}`);
|
|
8
|
+
};
|
|
9
|
+
const authLine = (auth) => {
|
|
10
|
+
if (!auth.signedIn)
|
|
11
|
+
return `${mark(false)} ${auth.note ?? 'not signed in'}`;
|
|
12
|
+
const until = auth.tokenExpiresAt ? ` (token valid until ${auth.tokenExpiresAt})` : '';
|
|
13
|
+
return `${mark(true)} signed in${until}`;
|
|
14
|
+
};
|
|
15
|
+
export const printStatus = (report) => {
|
|
16
|
+
row('version', report.version);
|
|
17
|
+
row('target', `${report.fqdn} (${report.env})`);
|
|
18
|
+
row('auth', authLine(report.auth));
|
|
19
|
+
row('endpoint', `${mark(report.endpoint.reachable)} ${report.endpoint.url} ` +
|
|
20
|
+
(report.endpoint.reachable ? 'reachable' : 'unreachable'));
|
|
21
|
+
};
|
|
22
|
+
export const runStatus = async (opts = {}) => {
|
|
23
|
+
const report = await gatherStatus(readAuth(), siteFqdn());
|
|
24
|
+
if (opts.json)
|
|
25
|
+
console.log(JSON.stringify(report, null, 2));
|
|
26
|
+
else
|
|
27
|
+
printStatus(report);
|
|
28
|
+
};
|
|
29
|
+
export const registerStatus = (program) => {
|
|
30
|
+
program
|
|
31
|
+
.command('status')
|
|
32
|
+
.description('Show CLI, account, and endpoint status')
|
|
33
|
+
.option('--json', 'machine-readable output')
|
|
34
|
+
.action(runStatus);
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAqB,MAAM,uBAAuB,CAAC;AAExE,MAAM,IAAI,GAAG,CAAC,IAAa,EAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEnF,MAAM,GAAG,GAAG,CAA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AAE,QAAQ,EAAE,CAAC,CAAC;IAC1D,IAAI,IAAI,CAAC,IAAI;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;;QACvD,WAAW,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAQ,EAAE;IACvD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,wCAAwC,CAAC;SACrD,MAAM,CAAC,QAAQ,EAAE,yBAAyB,CAAC;SAC3C,MAAM,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AuthState } from './config.js';
|
|
2
|
+
import { type Links } from './origins.js';
|
|
3
|
+
export declare class AuthRequiredError extends Error {
|
|
4
|
+
constructor(message?: string);
|
|
5
|
+
}
|
|
6
|
+
export declare const authedGet: <T>(auth: AuthState, links: Links, url: string) => Promise<T>;
|
|
7
|
+
export interface TokenSession {
|
|
8
|
+
userId?: string;
|
|
9
|
+
expiresAt?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const introspectToken: (auth: AuthState, links: Links) => Promise<TokenSession>;
|
|
12
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,SAAkB;CAItC;AAkBD,eAAO,MAAM,SAAS,GAAU,CAAC,EAAE,MAAM,SAAS,EAAE,OAAO,KAAK,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,CAAC,CAQxF,CAAC;AAOF,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,eAAO,MAAM,eAAe,GAAU,MAAM,SAAS,EAAE,OAAO,KAAK,KAAG,OAAO,CAAC,YAAY,CAOzF,CAAC"}
|
package/dist/lib/api.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { saveAuth } from './config.js';
|
|
2
|
+
import { refreshTokens } from './oauth.js';
|
|
3
|
+
export class AuthRequiredError extends Error {
|
|
4
|
+
constructor(message = 'not signed in') {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'AuthRequiredError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const tryRefresh = async (auth, links) => {
|
|
10
|
+
if (!auth.tokens.refreshToken)
|
|
11
|
+
return false;
|
|
12
|
+
try {
|
|
13
|
+
const fresh = await refreshTokens(links.auth, auth.clientId, auth.tokens.refreshToken);
|
|
14
|
+
auth.tokens = {
|
|
15
|
+
accessToken: fresh.access_token,
|
|
16
|
+
refreshToken: fresh.refresh_token ?? auth.tokens.refreshToken,
|
|
17
|
+
expiresAt: fresh.expires_in ? Date.now() + fresh.expires_in * 1000 : undefined,
|
|
18
|
+
};
|
|
19
|
+
saveAuth(auth);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const authedGet = async (auth, links, url) => {
|
|
27
|
+
const call = () => fetch(url, { headers: { authorization: `Bearer ${auth.tokens.accessToken}` } });
|
|
28
|
+
let res = await call();
|
|
29
|
+
if (res.status === 401 && (await tryRefresh(auth, links)))
|
|
30
|
+
res = await call();
|
|
31
|
+
if (res.status === 401)
|
|
32
|
+
throw new AuthRequiredError('session expired');
|
|
33
|
+
if (!res.ok)
|
|
34
|
+
throw new Error(`GET ${url} failed (${res.status})`);
|
|
35
|
+
return (await res.json());
|
|
36
|
+
};
|
|
37
|
+
// The OAuth introspection endpoint: the only live surface that validates the
|
|
38
|
+
// CLI's bearer token today (backend REST accepts session cookies only).
|
|
39
|
+
export const introspectToken = async (auth, links) => {
|
|
40
|
+
const body = await authedGet(auth, links, `${links.auth}/api/auth/mcp/get-session`);
|
|
41
|
+
return { userId: body.userId, expiresAt: body.accessTokenExpiresAt };
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,GAAG,eAAe;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,UAAU,GAAG,KAAK,EAAE,IAAe,EAAE,KAAY,EAAoB,EAAE;IAC3E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI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AC,CAAC;AAYF,6EAA6E;AAC7E,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAe,EAAE,KAAY,EAAyB,EAAE;IAC5F,MAAM,IAAI,GAAG,MAAM,SAAS,CAC1B,IAAI,EACJ,KAAK,EACL,GAAG,KAAK,CAAC,IAAI,2BAA2B,CACzC,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC;AACvE,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface CallbackServer {
|
|
2
|
+
redirectUri: string;
|
|
3
|
+
waitForCode: (timeoutMs?: number) => Promise<string>;
|
|
4
|
+
close: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const startCallbackServer: (expectedState: string) => Promise<CallbackServer>;
|
|
7
|
+
//# sourceMappingURL=callback-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback-server.d.ts","sourceRoot":"","sources":["../../src/lib/callback-server.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAaD,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAoE9E,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
const page = (ok, detail) => '<!doctype html><html><head><meta charset="utf-8"><title>agentage</title></head>' +
|
|
3
|
+
'<body style="font-family:system-ui;display:grid;place-items:center;min-height:80vh">' +
|
|
4
|
+
`<div style="text-align:center"><h1>${ok ? 'Signed in' : 'Sign-in failed'}</h1>` +
|
|
5
|
+
`<p>${detail}</p></div></body></html>`;
|
|
6
|
+
export const startCallbackServer = (expectedState) => new Promise((resolveServer) => {
|
|
7
|
+
let settle = null;
|
|
8
|
+
let result = null;
|
|
9
|
+
const finish = (code, error) => {
|
|
10
|
+
if (result)
|
|
11
|
+
return;
|
|
12
|
+
result = { code, error };
|
|
13
|
+
if (settle && code)
|
|
14
|
+
settle.resolve(code);
|
|
15
|
+
else if (settle && error)
|
|
16
|
+
settle.reject(error);
|
|
17
|
+
};
|
|
18
|
+
const server = createServer((req, res) => {
|
|
19
|
+
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
20
|
+
if (url.pathname !== '/callback') {
|
|
21
|
+
res.writeHead(404).end();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const code = url.searchParams.get('code');
|
|
25
|
+
const state = url.searchParams.get('state');
|
|
26
|
+
const error = url.searchParams.get('error');
|
|
27
|
+
if (error) {
|
|
28
|
+
res.writeHead(200, { 'content-type': 'text/html' }).end(page(false, error));
|
|
29
|
+
finish(undefined, new Error(`authorization failed: ${error}`));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!code || state !== expectedState) {
|
|
33
|
+
res.writeHead(400, { 'content-type': 'text/html' }).end(page(false, 'Invalid callback.'));
|
|
34
|
+
finish(undefined, new Error('invalid callback (state mismatch)'));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
res
|
|
38
|
+
.writeHead(200, { 'content-type': 'text/html' })
|
|
39
|
+
.end(page(true, 'You can return to the terminal.'));
|
|
40
|
+
finish(code);
|
|
41
|
+
});
|
|
42
|
+
server.listen(0, () => {
|
|
43
|
+
const address = server.address();
|
|
44
|
+
const port = typeof address === 'object' && address ? address.port : 0;
|
|
45
|
+
resolveServer({
|
|
46
|
+
redirectUri: `http://localhost:${port}/callback`,
|
|
47
|
+
waitForCode: (timeoutMs = 300_000) => new Promise((resolve, reject) => {
|
|
48
|
+
if (result) {
|
|
49
|
+
if (result.code)
|
|
50
|
+
resolve(result.code);
|
|
51
|
+
else
|
|
52
|
+
reject(result.error ?? new Error('sign-in failed'));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const timer = setTimeout(() => reject(new Error('timed out waiting for sign-in')), timeoutMs);
|
|
56
|
+
timer.unref();
|
|
57
|
+
settle = {
|
|
58
|
+
resolve: (code) => {
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
resolve(code);
|
|
61
|
+
},
|
|
62
|
+
reject: (err) => {
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
reject(err);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
close: () => server.close(),
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=callback-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback-server.js","sourceRoot":"","sources":["../../src/lib/callback-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAQzC,MAAM,IAAI,GAAG,CAAC,EAAW,EAAE,MAAc,EAAU,EAAE,CACnD,iFAAiF;IACjF,sFAAsF;IACtF,sCAAsC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,OAAO;IAChF,MAAM,MAAM,0BAA0B,CAAC;AAOzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAqB,EAA2B,EAAE,CACpF,IAAI,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;IAC5B,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,IAAI,MAAM,GAA4C,IAAI,CAAC;IAE3D,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,KAAa,EAAQ,EAAE;QACpD,IAAI,MAAM;YAAE,OAAO;QACnB,MAAM,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACzB,IAAI,MAAM,IAAI,IAAI;YAAE,MAAM,CAAC,O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AAY,CAAC,KAAK,CAAC,CAAC;wBACpB,MAAM,CAAC,GAAG,CAAC,CAAC;oBACd,CAAC;iBACF,CAAC;YACJ,CAAC,CAAC;YACJ,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface StoredTokens {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken?: string;
|
|
4
|
+
expiresAt?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface AuthState {
|
|
7
|
+
siteFqdn: string;
|
|
8
|
+
clientId: string;
|
|
9
|
+
tokens: StoredTokens;
|
|
10
|
+
user?: {
|
|
11
|
+
id: string;
|
|
12
|
+
email: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const getConfigDir: () => string;
|
|
16
|
+
export declare const ensureConfigDir: () => string;
|
|
17
|
+
export declare const readAuth: () => AuthState | null;
|
|
18
|
+
export declare const saveAuth: (state: AuthState) => void;
|
|
19
|
+
export declare const deleteAuth: () => void;
|
|
20
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,QAAO,MAC2D,CAAC;AAE5F,eAAO,MAAM,eAAe,QAAO,MAIlC,CAAC;AAIF,eAAO,MAAM,QAAQ,QAAO,SAAS,GAAG,IAQvC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,KAAG,IAK3C,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,IAG7B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
export const getConfigDir = () => process.env['AGENTAGE_CONFIG_DIR'] || join(process.env['HOME'] || homedir(), '.agentage');
|
|
5
|
+
export const ensureConfigDir = () => {
|
|
6
|
+
const dir = getConfigDir();
|
|
7
|
+
if (!existsSync(dir))
|
|
8
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
9
|
+
return dir;
|
|
10
|
+
};
|
|
11
|
+
const authPath = () => join(getConfigDir(), 'auth.json');
|
|
12
|
+
export const readAuth = () => {
|
|
13
|
+
const path = authPath();
|
|
14
|
+
if (!existsSync(path))
|
|
15
|
+
return null;
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export const saveAuth = (state) => {
|
|
24
|
+
ensureConfigDir();
|
|
25
|
+
const path = authPath();
|
|
26
|
+
writeFileSync(path, JSON.stringify(state, null, 2) + '\n', { encoding: 'utf-8', mode: 0o600 });
|
|
27
|
+
chmodSync(path, 0o600);
|
|
28
|
+
};
|
|
29
|
+
export const deleteAuth = () => {
|
|
30
|
+
const path = authPath();
|
|
31
|
+
if (existsSync(path))
|
|
32
|
+
unlinkSync(path);
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=config.js.map
|
|
@@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AC,KAAgB,EAAQ,EAAE;IACjD,eAAe,EAAE,CAAC;IAClB,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/F,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAS,EAAE;IACnC,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,UAAU,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface PkcePair {
|
|
2
|
+
verifier: string;
|
|
3
|
+
challenge: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TokenResponse {
|
|
6
|
+
access_token: string;
|
|
7
|
+
refresh_token?: string;
|
|
8
|
+
expires_in?: number;
|
|
9
|
+
token_type?: string;
|
|
10
|
+
scope?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_SCOPE = "memory:read memory:write offline_access";
|
|
13
|
+
export declare const pkcePair: () => PkcePair;
|
|
14
|
+
export declare const randomState: () => string;
|
|
15
|
+
export declare const registerClient: (authUrl: string, redirectUri: string) => Promise<string>;
|
|
16
|
+
export declare const buildAuthorizeUrl: (authUrl: string, params: {
|
|
17
|
+
clientId: string;
|
|
18
|
+
redirectUri: string;
|
|
19
|
+
challenge: string;
|
|
20
|
+
state: string;
|
|
21
|
+
scope?: string;
|
|
22
|
+
}) => string;
|
|
23
|
+
export declare const exchangeCode: (authUrl: string, params: {
|
|
24
|
+
clientId: string;
|
|
25
|
+
code: string;
|
|
26
|
+
redirectUri: string;
|
|
27
|
+
verifier: string;
|
|
28
|
+
}) => Promise<TokenResponse>;
|
|
29
|
+
export declare const refreshTokens: (authUrl: string, clientId: string, refreshToken: string) => Promise<TokenResponse>;
|
|
30
|
+
export declare const revokeToken: (authUrl: string, token: string) => Promise<void>;
|
|
31
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/lib/oauth.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAOD,eAAO,MAAM,aAAa,4CAA4C,CAAC;AAEvE,eAAO,MAAM,QAAQ,QAAO,QAI3B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAA+C,CAAC;AAE/E,eAAO,MAAM,cAAc,GAAU,SAAS,MAAM,EAAE,aAAa,MAAM,KAAG,OAAO,CAAC,MAAM,CAgBzF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,QAAQ;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KACA,MAUF,CAAC;AAYF,eAAO,MAAM,YAAY,GACvB,SAAS,MAAM,EACf,QAAQ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAChF,OAAO,CAAC,aAAa,CAOpB,CAAC;AAEL,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,EACf,UAAU,MAAM,EAChB,cAAc,MAAM,KACnB,OAAO,CAAC,aAAa,CAKpB,CAAC;AAEL,eAAO,MAAM,WAAW,GAAU,SAAS,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,IAAI,CAU9E,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
2
|
+
const REGISTER_PATH = '/api/auth/mcp/register';
|
|
3
|
+
const AUTHORIZE_PATH = '/api/auth/mcp/authorize';
|
|
4
|
+
const TOKEN_PATH = '/api/auth/mcp/token';
|
|
5
|
+
const REVOKE_PATH = '/api/auth/mcp/revoke';
|
|
6
|
+
export const DEFAULT_SCOPE = 'memory:read memory:write offline_access';
|
|
7
|
+
export const pkcePair = () => {
|
|
8
|
+
const verifier = randomBytes(32).toString('base64url');
|
|
9
|
+
const challenge = createHash('sha256').update(verifier).digest('base64url');
|
|
10
|
+
return { verifier, challenge };
|
|
11
|
+
};
|
|
12
|
+
export const randomState = () => randomBytes(16).toString('base64url');
|
|
13
|
+
export const registerClient = async (authUrl, redirectUri) => {
|
|
14
|
+
const res = await fetch(`${authUrl}${REGISTER_PATH}`, {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: { 'content-type': 'application/json' },
|
|
17
|
+
body: JSON.stringify({
|
|
18
|
+
client_name: 'agentage CLI',
|
|
19
|
+
redirect_uris: [redirectUri],
|
|
20
|
+
token_endpoint_auth_method: 'none',
|
|
21
|
+
grant_types: ['authorization_code', 'refresh_token'],
|
|
22
|
+
response_types: ['code'],
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok)
|
|
26
|
+
throw new Error(`client registration failed (${res.status})`);
|
|
27
|
+
const body = (await res.json());
|
|
28
|
+
if (!body.client_id)
|
|
29
|
+
throw new Error('client registration returned no client_id');
|
|
30
|
+
return body.client_id;
|
|
31
|
+
};
|
|
32
|
+
export const buildAuthorizeUrl = (authUrl, params) => {
|
|
33
|
+
const url = new URL(`${authUrl}${AUTHORIZE_PATH}`);
|
|
34
|
+
url.searchParams.set('response_type', 'code');
|
|
35
|
+
url.searchParams.set('client_id', params.clientId);
|
|
36
|
+
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
37
|
+
url.searchParams.set('code_challenge', params.challenge);
|
|
38
|
+
url.searchParams.set('code_challenge_method', 'S256');
|
|
39
|
+
url.searchParams.set('state', params.state);
|
|
40
|
+
url.searchParams.set('scope', params.scope ?? DEFAULT_SCOPE);
|
|
41
|
+
return url.toString();
|
|
42
|
+
};
|
|
43
|
+
const postForm = async (url, form) => {
|
|
44
|
+
const res = await fetch(url, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
47
|
+
body: new URLSearchParams(form).toString(),
|
|
48
|
+
});
|
|
49
|
+
if (!res.ok)
|
|
50
|
+
throw new Error(`token request failed (${res.status})`);
|
|
51
|
+
return (await res.json());
|
|
52
|
+
};
|
|
53
|
+
export const exchangeCode = (authUrl, params) => postForm(`${authUrl}${TOKEN_PATH}`, {
|
|
54
|
+
grant_type: 'authorization_code',
|
|
55
|
+
code: params.code,
|
|
56
|
+
redirect_uri: params.redirectUri,
|
|
57
|
+
client_id: params.clientId,
|
|
58
|
+
code_verifier: params.verifier,
|
|
59
|
+
});
|
|
60
|
+
export const refreshTokens = (authUrl, clientId, refreshToken) => postForm(`${authUrl}${TOKEN_PATH}`, {
|
|
61
|
+
grant_type: 'refresh_token',
|
|
62
|
+
refresh_token: refreshToken,
|
|
63
|
+
client_id: clientId,
|
|
64
|
+
});
|
|
65
|
+
export const revokeToken = async (authUrl, token) => {
|
|
66
|
+
try {
|
|
67
|
+
await fetch(`${authUrl}${REVOKE_PATH}`, {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
70
|
+
body: new URLSearchParams({ token }).toString(),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// best-effort: local credentials are removed regardless
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/lib/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAetD,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAC/C,MAAM,cAAc,GAAG,yBAAyB,CAAC;AACjD,MAAM,UAAU,GAAG,qBAAqB,CAAC;AACzC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG,yCAAyC,CAAC;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAa,EAAE;IACrC,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAW,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,OAAe,EAAE,WAAmB,EAAmB,EAAE;IAC5F,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,aAAa,EAAE,EAAE;QACpD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QA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e,EAAE,KAAa,EAAiB,EAAE;IACjF,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,WAAW,EAAE,EAAE;YACtC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;YAChE,IAAI,EAAE,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,wDAAwD;IAC1D,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Env = 'development' | 'production';
|
|
2
|
+
export interface Links {
|
|
3
|
+
site: string;
|
|
4
|
+
api: string;
|
|
5
|
+
auth: string;
|
|
6
|
+
mcp: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const normalizeFqdn: (raw?: string) => string;
|
|
9
|
+
export declare const siteFqdn: () => string;
|
|
10
|
+
export declare const environment: (fqdn: string) => Env;
|
|
11
|
+
export declare const links: (fqdn: string) => Links;
|
|
12
|
+
//# sourceMappingURL=origins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../../src/lib/origins.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,GAAG,aAAa,GAAG,YAAY,CAAC;AAE/C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAID,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAO5C,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,MAA0D,CAAC;AAKvF,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,GAC8B,CAAC;AAE1E,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,KAAG,KAa9B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const DEFAULT_FQDN = 'agentage.io';
|
|
2
|
+
export const normalizeFqdn = (raw) => {
|
|
3
|
+
const value = (raw ?? '')
|
|
4
|
+
.trim()
|
|
5
|
+
.toLowerCase()
|
|
6
|
+
.replace(/^https?:\/\//, '')
|
|
7
|
+
.replace(/\/+$/, '');
|
|
8
|
+
return value || DEFAULT_FQDN;
|
|
9
|
+
};
|
|
10
|
+
export const siteFqdn = () => normalizeFqdn(process.env['AGENTAGE_SITE_FQDN']);
|
|
11
|
+
const isLocal = (fqdn) => fqdn === 'localhost' || fqdn.startsWith('localhost:') || fqdn.startsWith('127.0.0.1');
|
|
12
|
+
export const environment = (fqdn) => isLocal(fqdn) || fqdn.startsWith('dev.') ? 'development' : 'production';
|
|
13
|
+
export const links = (fqdn) => isLocal(fqdn)
|
|
14
|
+
? {
|
|
15
|
+
site: 'http://localhost:3000',
|
|
16
|
+
api: 'http://localhost:3001/api',
|
|
17
|
+
auth: 'http://localhost:3010',
|
|
18
|
+
mcp: 'http://localhost:3003/mcp',
|
|
19
|
+
}
|
|
20
|
+
: {
|
|
21
|
+
site: `https://${fqdn}`,
|
|
22
|
+
api: `https://${fqdn}/api`,
|
|
23
|
+
auth: `https://auth.${fqdn}`,
|
|
24
|
+
mcp: `https://memory.${fqdn}/mcp`,
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=origins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origins.js","sourceRoot":"","sources":["../../src/lib/origins.ts"],"names":[],"mappings":"AASA,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAY,EAAU,EAAE;IACpD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC;SACtB,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvB,OAAO,KAAK,IAAI,YAAY,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAW,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAEvF,MAAM,OAAO,GAAG,CAAC,IAAY,EAAW,EAAE,CACxC,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAO,EAAE,CAC/C,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;AAE1E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAS,EAAE,CAC3C,OAAO,CAAC,IAAI,CAAC;IACX,CAAC,CAAC;QACE,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE,2BAA2B;QAChC,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE,2BAA2B;KACjC;IACH,CAAC,CAAC;QACE,IAAI,EAAE,WAAW,IAAI,EAAE;QACvB,GAAG,EAAE,WAAW,IAAI,MAAM;QAC1B,IAAI,EAAE,gBAAgB,IAAI,EAAE;QAC5B,GAAG,EAAE,kBAAkB,IAAI,MAAM;KAClC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AuthState } from './config.js';
|
|
2
|
+
import { type Env } from './origins.js';
|
|
3
|
+
export interface StatusReport {
|
|
4
|
+
version: string;
|
|
5
|
+
fqdn: string;
|
|
6
|
+
env: Env;
|
|
7
|
+
auth: {
|
|
8
|
+
signedIn: boolean;
|
|
9
|
+
tokenExpiresAt?: string;
|
|
10
|
+
note?: string;
|
|
11
|
+
};
|
|
12
|
+
endpoint: {
|
|
13
|
+
url: string;
|
|
14
|
+
reachable: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare const gatherStatus: (auth: AuthState | null, fqdn: string) => Promise<StatusReport>;
|
|
18
|
+
//# sourceMappingURL=status-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-info.d.ts","sourceRoot":"","sources":["../../src/lib/status-info.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAsB,KAAK,GAAG,EAAE,MAAM,cAAc,CAAC;AAG5D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/C;AAWD,eAAO,MAAM,YAAY,GAAU,MAAM,SAAS,GAAG,IAAI,EAAE,MAAM,MAAM,KAAG,OAAO,CAAC,YAAY,CAuB7F,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AuthRequiredError, introspectToken } from './api.js';
|
|
2
|
+
import { environment, links } from './origins.js';
|
|
3
|
+
import { VERSION } from '../utils/version.js';
|
|
4
|
+
const checkEndpoint = async (apiUrl) => {
|
|
5
|
+
try {
|
|
6
|
+
const res = await fetch(`${apiUrl}/health`, { signal: AbortSignal.timeout(3000) });
|
|
7
|
+
return res.ok;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const gatherStatus = async (auth, fqdn) => {
|
|
14
|
+
const target = links(fqdn);
|
|
15
|
+
const report = {
|
|
16
|
+
version: VERSION,
|
|
17
|
+
fqdn,
|
|
18
|
+
env: environment(fqdn),
|
|
19
|
+
auth: { signedIn: false, note: 'not signed in - run: agentage setup' },
|
|
20
|
+
endpoint: { url: target.api, reachable: await checkEndpoint(target.api) },
|
|
21
|
+
};
|
|
22
|
+
if (!auth)
|
|
23
|
+
return report;
|
|
24
|
+
try {
|
|
25
|
+
const session = await introspectToken(auth, target);
|
|
26
|
+
report.auth = { signedIn: true, tokenExpiresAt: session.expiresAt };
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
report.auth =
|
|
30
|
+
err instanceof AuthRequiredError
|
|
31
|
+
? { signedIn: false, note: 'session expired - run: agentage setup' }
|
|
32
|
+
: {
|
|
33
|
+
signedIn: false,
|
|
34
|
+
note: `could not verify session: ${err instanceof Error ? err.message : String(err)}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return report;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=status-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-info.js","sourceRoot":"","sources":["../../src/lib/status-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,KAAK,EAAY,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAU9C,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAoB,EAAE;IAC/D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnF,OAAO,GAAG,CAAC,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,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/utils/version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,QAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AAEjE,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentage/cli",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "The agentage CLI - connect this machine to agentage from the terminal",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"agentage": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22.0.0",
|
|
15
|
+
"npm": ">=10.0.0"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.build.json",
|
|
19
|
+
"type-check": "tsc --noEmit",
|
|
20
|
+
"lint": "eslint src",
|
|
21
|
+
"lint:fix": "eslint src --fix",
|
|
22
|
+
"format": "prettier --write \"{src,e2e}/**/*.ts\"",
|
|
23
|
+
"format:check": "prettier --check \"{src,e2e}/**/*.ts\"",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:coverage": "vitest run --coverage",
|
|
27
|
+
"test:e2e": "playwright test",
|
|
28
|
+
"type-check:e2e": "tsc -p e2e",
|
|
29
|
+
"clean": "rm -rf dist *.tsbuildinfo coverage playwright-report test-results",
|
|
30
|
+
"verify": "npm run type-check && npm run type-check:e2e && npm run lint && npm run format:check && npm run test && npm run build",
|
|
31
|
+
"prepublishOnly": "npm run verify"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"chalk": "latest",
|
|
35
|
+
"commander": "latest",
|
|
36
|
+
"open": "latest"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@anthropic-ai/sdk": "0.106.0",
|
|
40
|
+
"@playwright/test": "latest",
|
|
41
|
+
"@types/node": "latest",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "latest",
|
|
43
|
+
"@typescript-eslint/parser": "latest",
|
|
44
|
+
"@vitest/coverage-v8": "latest",
|
|
45
|
+
"eslint": "latest",
|
|
46
|
+
"eslint-config-prettier": "latest",
|
|
47
|
+
"eslint-plugin-prettier": "latest",
|
|
48
|
+
"prettier": "latest",
|
|
49
|
+
"typescript": "latest",
|
|
50
|
+
"vitest": "latest"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"cli",
|
|
54
|
+
"agentage"
|
|
55
|
+
],
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://github.com/agentage/cli.git"
|
|
59
|
+
},
|
|
60
|
+
"license": "MIT"
|
|
61
|
+
}
|