@link-assistant/agent 0.0.13 → 0.0.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface. Bun-only runtime.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -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();
@@ -109,11 +109,8 @@ export const RunCommand = cmd({
109
109
  });
110
110
  },
111
111
  handler: async (args) => {
112
- // Set verbose mode if requested
113
- if (args.verbose) {
114
- Flag.setVerbose(true);
115
- await Log.init({ print: true, level: 'DEBUG' });
116
- }
112
+ // Note: verbose flag and logging are now initialized in middleware
113
+ // See src/index.js main() function for the middleware that sets up Flag and Log.init()
117
114
  let message = args.message.join(' ');
118
115
 
119
116
  const fileParts: any[] = [];
package/src/index.js CHANGED
@@ -83,10 +83,8 @@ function readStdin() {
83
83
  }
84
84
 
85
85
  async function runAgentMode(argv) {
86
- // Set verbose mode if requested via CLI flag
87
- if (argv.verbose) {
88
- Flag.setVerbose(true);
89
- }
86
+ // Note: verbose flag and logging are now initialized in middleware
87
+ // See main() function for the middleware that sets up Flag and Log.init()
90
88
 
91
89
  // Parse model argument (handle model IDs with slashes like groq/qwen/qwen3-32b)
92
90
  const modelParts = argv.model.split('/');
@@ -176,13 +174,7 @@ async function runAgentMode(argv) {
176
174
  appendSystemMessage = await file.text();
177
175
  }
178
176
 
179
- // Initialize logging to redirect to log file instead of stderr
180
- // This prevents log messages from mixing with JSON output
181
- // In verbose mode, print to stderr for debugging
182
- await Log.init({
183
- print: Flag.OPENCODE_VERBOSE, // Print to stderr only in verbose mode
184
- level: Flag.OPENCODE_VERBOSE ? 'DEBUG' : 'INFO',
185
- });
177
+ // Logging is already initialized in middleware, no need to call Log.init() again
186
178
 
187
179
  // Read input from stdin
188
180
  const input = await readStdin();
@@ -563,6 +555,22 @@ async function main() {
563
555
  'Use existing Claude OAuth credentials from ~/.claude/.credentials.json (from Claude Code CLI)',
564
556
  default: false,
565
557
  })
558
+ // Initialize logging early for all CLI commands
559
+ // This prevents debug output from appearing in CLI unless --verbose is used
560
+ .middleware(async (argv) => {
561
+ // Set verbose flag if requested
562
+ if (argv.verbose) {
563
+ Flag.setVerbose(true);
564
+ }
565
+
566
+ // Initialize logging system
567
+ // - If verbose: print logs to stderr for debugging
568
+ // - Otherwise: write logs to file to keep CLI output clean
569
+ await Log.init({
570
+ print: Flag.OPENCODE_VERBOSE,
571
+ level: Flag.OPENCODE_VERBOSE ? 'DEBUG' : 'INFO',
572
+ });
573
+ })
566
574
  .fail((msg, err, yargs) => {
567
575
  // Handle errors from command handlers
568
576
  if (err) {