@link-assistant/agent 0.0.12 → 0.0.14
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/package.json +1 -1
- package/src/auth/plugins.ts +3 -3
- package/src/index.js +29 -0
package/package.json
CHANGED
package/src/auth/plugins.ts
CHANGED
|
@@ -276,7 +276,7 @@ const AnthropicPlugin: AuthPlugin = {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
return {
|
|
279
|
-
apiKey: '',
|
|
279
|
+
apiKey: 'oauth-token-used-via-custom-fetch',
|
|
280
280
|
async fetch(input: RequestInfo | URL, init?: RequestInit) {
|
|
281
281
|
let currentAuth = await getAuth();
|
|
282
282
|
if (!currentAuth || currentAuth.type !== 'oauth')
|
|
@@ -551,7 +551,7 @@ const GitHubCopilotPlugin: AuthPlugin = {
|
|
|
551
551
|
|
|
552
552
|
return {
|
|
553
553
|
baseURL,
|
|
554
|
-
apiKey: '',
|
|
554
|
+
apiKey: 'oauth-token-used-via-custom-fetch',
|
|
555
555
|
async fetch(input: RequestInfo | URL, init?: RequestInit) {
|
|
556
556
|
let currentInfo = await getAuth();
|
|
557
557
|
if (!currentInfo || currentInfo.type !== 'oauth')
|
|
@@ -776,7 +776,7 @@ const OpenAIPlugin: AuthPlugin = {
|
|
|
776
776
|
// Note: Full OpenAI Codex support would require additional request transformations
|
|
777
777
|
// For now, this provides basic OAuth token management
|
|
778
778
|
return {
|
|
779
|
-
apiKey: '',
|
|
779
|
+
apiKey: 'oauth-token-used-via-custom-fetch',
|
|
780
780
|
baseURL: 'https://chatgpt.com/backend-api',
|
|
781
781
|
async fetch(input: RequestInfo | URL, init?: RequestInit) {
|
|
782
782
|
let currentAuth = await getAuth();
|
package/src/index.js
CHANGED
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
import { McpCommand } from './cli/cmd/mcp.ts';
|
|
17
17
|
import { AuthCommand } from './cli/cmd/auth.ts';
|
|
18
18
|
import { Flag } from './flag/flag.ts';
|
|
19
|
+
import { FormatError } from './cli/error.ts';
|
|
20
|
+
import { UI } from './cli/ui.ts';
|
|
19
21
|
|
|
20
22
|
// Track if any errors occurred during execution
|
|
21
23
|
let hasError = false;
|
|
@@ -561,6 +563,33 @@ async function main() {
|
|
|
561
563
|
'Use existing Claude OAuth credentials from ~/.claude/.credentials.json (from Claude Code CLI)',
|
|
562
564
|
default: false,
|
|
563
565
|
})
|
|
566
|
+
.fail((msg, err, yargs) => {
|
|
567
|
+
// Handle errors from command handlers
|
|
568
|
+
if (err) {
|
|
569
|
+
// Check if it's a CancelledError (user pressed ESC)
|
|
570
|
+
if (UI.CancelledError.isInstance(err)) {
|
|
571
|
+
// Exit silently without showing error or help text
|
|
572
|
+
process.exit(0);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// Format other errors using FormatError
|
|
576
|
+
const formatted = FormatError(err);
|
|
577
|
+
if (formatted) {
|
|
578
|
+
console.error(formatted);
|
|
579
|
+
} else {
|
|
580
|
+
// Fallback to default error formatting
|
|
581
|
+
console.error(err.message || err);
|
|
582
|
+
}
|
|
583
|
+
process.exit(1);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
// Handle validation errors (msg without err)
|
|
587
|
+
if (msg) {
|
|
588
|
+
console.error(msg);
|
|
589
|
+
console.error(`\n${yargs.help()}`);
|
|
590
|
+
process.exit(1);
|
|
591
|
+
}
|
|
592
|
+
})
|
|
564
593
|
.help().argv;
|
|
565
594
|
|
|
566
595
|
// If a command was executed (like mcp), yargs handles it
|