ai-sdk-provider-gemini-cli-agentic 0.1.1 → 0.1.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/dist/index.cjs CHANGED
@@ -259,7 +259,7 @@ var GeminiCliLanguageModel = class {
259
259
  allowedMcpServerNames: providerOptions.allowedMcpServerNames ?? this.settings.allowedMcpServerNames
260
260
  };
261
261
  }
262
- buildArgs(promptText, settings = this.settings) {
262
+ buildArgs(settings = this.settings) {
263
263
  const base = resolveGeminiPath(settings.geminiPath, settings.allowNpx);
264
264
  const cmd = base.cmd;
265
265
  const args = [...base.args];
@@ -294,7 +294,7 @@ var GeminiCliLanguageModel = class {
294
294
  args.push("--resume", "latest");
295
295
  }
296
296
  }
297
- args.push(promptText);
297
+ args.push("-");
298
298
  const env = {
299
299
  ...process.env,
300
300
  ...settings.env || {}
@@ -346,14 +346,16 @@ var GeminiCliLanguageModel = class {
346
346
  schema: geminiCliProviderOptionsSchema
347
347
  });
348
348
  const effectiveSettings = this.mergeSettings(providerOptions);
349
- const { cmd, args, env, cwd, shell } = this.buildArgs(promptText, effectiveSettings);
350
- this.logger.debug(`[gemini-cli] Executing: ${cmd} ${args.slice(0, -1).join(" ")} [prompt]`);
349
+ const { cmd, args, env, cwd, shell } = this.buildArgs(effectiveSettings);
350
+ this.logger.debug(`[gemini-cli] Executing: ${cmd} ${args.join(" ")}`);
351
351
  let text = "";
352
352
  let usage = createEmptyUsage();
353
353
  let finishReason = { unified: "stop", raw: void 0 };
354
354
  const content = [];
355
355
  const toolResults = /* @__PURE__ */ new Map();
356
- const child = child_process.spawn(cmd, args, { env, cwd, shell, stdio: ["ignore", "pipe", "pipe"] });
356
+ const child = child_process.spawn(cmd, args, { env, cwd, shell, stdio: ["pipe", "pipe", "pipe"] });
357
+ child.stdin.write(promptText);
358
+ child.stdin.end();
357
359
  let onAbort;
358
360
  if (options.abortSignal) {
359
361
  if (options.abortSignal.aborted) {
@@ -478,14 +480,16 @@ var GeminiCliLanguageModel = class {
478
480
  schema: geminiCliProviderOptionsSchema
479
481
  });
480
482
  const effectiveSettings = this.mergeSettings(providerOptions);
481
- const { cmd, args, env, cwd, shell } = this.buildArgs(promptText, effectiveSettings);
482
- this.logger.debug(`[gemini-cli] Streaming: ${cmd} ${args.slice(0, -1).join(" ")} [prompt]`);
483
+ const { cmd, args, env, cwd, shell } = this.buildArgs(effectiveSettings);
484
+ this.logger.debug(`[gemini-cli] Streaming: ${cmd} ${args.join(" ")}`);
483
485
  const model = this;
484
486
  const abortSignal = options.abortSignal;
485
487
  const stream = new ReadableStream({
486
488
  start(controller) {
487
489
  const startTime = Date.now();
488
- const child = child_process.spawn(cmd, args, { env, cwd, shell, stdio: ["ignore", "pipe", "pipe"] });
490
+ const child = child_process.spawn(cmd, args, { env, cwd, shell, stdio: ["pipe", "pipe", "pipe"] });
491
+ child.stdin.write(promptText);
492
+ child.stdin.end();
489
493
  controller.enqueue({ type: "stream-start", warnings });
490
494
  let stderr = "";
491
495
  let lastUsage;
package/dist/index.js CHANGED
@@ -257,7 +257,7 @@ var GeminiCliLanguageModel = class {
257
257
  allowedMcpServerNames: providerOptions.allowedMcpServerNames ?? this.settings.allowedMcpServerNames
258
258
  };
259
259
  }
260
- buildArgs(promptText, settings = this.settings) {
260
+ buildArgs(settings = this.settings) {
261
261
  const base = resolveGeminiPath(settings.geminiPath, settings.allowNpx);
262
262
  const cmd = base.cmd;
263
263
  const args = [...base.args];
@@ -292,7 +292,7 @@ var GeminiCliLanguageModel = class {
292
292
  args.push("--resume", "latest");
293
293
  }
294
294
  }
295
- args.push(promptText);
295
+ args.push("-");
296
296
  const env = {
297
297
  ...process.env,
298
298
  ...settings.env || {}
@@ -344,14 +344,16 @@ var GeminiCliLanguageModel = class {
344
344
  schema: geminiCliProviderOptionsSchema
345
345
  });
346
346
  const effectiveSettings = this.mergeSettings(providerOptions);
347
- const { cmd, args, env, cwd, shell } = this.buildArgs(promptText, effectiveSettings);
348
- this.logger.debug(`[gemini-cli] Executing: ${cmd} ${args.slice(0, -1).join(" ")} [prompt]`);
347
+ const { cmd, args, env, cwd, shell } = this.buildArgs(effectiveSettings);
348
+ this.logger.debug(`[gemini-cli] Executing: ${cmd} ${args.join(" ")}`);
349
349
  let text = "";
350
350
  let usage = createEmptyUsage();
351
351
  let finishReason = { unified: "stop", raw: void 0 };
352
352
  const content = [];
353
353
  const toolResults = /* @__PURE__ */ new Map();
354
- const child = spawn(cmd, args, { env, cwd, shell, stdio: ["ignore", "pipe", "pipe"] });
354
+ const child = spawn(cmd, args, { env, cwd, shell, stdio: ["pipe", "pipe", "pipe"] });
355
+ child.stdin.write(promptText);
356
+ child.stdin.end();
355
357
  let onAbort;
356
358
  if (options.abortSignal) {
357
359
  if (options.abortSignal.aborted) {
@@ -476,14 +478,16 @@ var GeminiCliLanguageModel = class {
476
478
  schema: geminiCliProviderOptionsSchema
477
479
  });
478
480
  const effectiveSettings = this.mergeSettings(providerOptions);
479
- const { cmd, args, env, cwd, shell } = this.buildArgs(promptText, effectiveSettings);
480
- this.logger.debug(`[gemini-cli] Streaming: ${cmd} ${args.slice(0, -1).join(" ")} [prompt]`);
481
+ const { cmd, args, env, cwd, shell } = this.buildArgs(effectiveSettings);
482
+ this.logger.debug(`[gemini-cli] Streaming: ${cmd} ${args.join(" ")}`);
481
483
  const model = this;
482
484
  const abortSignal = options.abortSignal;
483
485
  const stream = new ReadableStream({
484
486
  start(controller) {
485
487
  const startTime = Date.now();
486
- const child = spawn(cmd, args, { env, cwd, shell, stdio: ["ignore", "pipe", "pipe"] });
488
+ const child = spawn(cmd, args, { env, cwd, shell, stdio: ["pipe", "pipe", "pipe"] });
489
+ child.stdin.write(promptText);
490
+ child.stdin.end();
487
491
  controller.enqueue({ type: "stream-start", warnings });
488
492
  let stderr = "";
489
493
  let lastUsage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-sdk-provider-gemini-cli-agentic",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "AI SDK v6 provider for Google Gemini CLI agentic mode",
5
5
  "keywords": [
6
6
  "ai-sdk",