@k2wanko/gemini-cli-sdk 0.2.0 → 0.2.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/dist/agent.d.ts CHANGED
@@ -23,7 +23,13 @@ export declare class GeminiAgent {
23
23
  private readonly resumeSessionId;
24
24
  private instructionsLoaded;
25
25
  constructor(options: GeminiAgentOptions);
26
+ /** Return the session ID assigned to this agent instance */
27
+ getSessionId(): string;
28
+ /** List available sessions for the current project */
29
+ listSessions(): Promise<import("./session.js").SessionInfo[]>;
26
30
  sendStream(prompt: string, signal?: AbortSignal): AsyncGenerator<ServerGeminiStreamEvent>;
31
+ private initialized;
32
+ private ensureInitialized;
27
33
  private initialize;
28
34
  private resolveInstructions;
29
35
  private buildScopedRegistry;
package/dist/agent.js CHANGED
@@ -36,6 +36,15 @@ export class GeminiAgent {
36
36
  };
37
37
  this.config = new Config(configParams);
38
38
  }
39
+ /** Return the session ID assigned to this agent instance */
40
+ getSessionId() {
41
+ return this.config.getSessionId();
42
+ }
43
+ /** List available sessions for the current project */
44
+ async listSessions() {
45
+ await this.ensureInitialized();
46
+ return listSessions(this.config);
47
+ }
39
48
  async *sendStream(prompt, signal) {
40
49
  await this.initialize();
41
50
  const client = this.config.getGeminiClient();
@@ -91,12 +100,19 @@ export class GeminiAgent {
91
100
  // -------------------------------------------------------------------------
92
101
  // Private helpers
93
102
  // -------------------------------------------------------------------------
94
- async initialize() {
95
- if (this.config.getContentGenerator())
103
+ initialized = false;
104
+ async ensureInitialized() {
105
+ if (this.initialized)
96
106
  return;
97
107
  const authType = getAuthTypeFromEnv() || AuthType.COMPUTE_ADC;
98
108
  await this.config.refreshAuth(authType);
99
109
  await this.config.initialize();
110
+ this.initialized = true;
111
+ }
112
+ async initialize() {
113
+ if (this.config.getContentGenerator())
114
+ return;
115
+ await this.ensureInitialized();
100
116
  // Resume previous session if requested
101
117
  if (this.resumeSessionId) {
102
118
  const sessions = await listSessions(this.config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2wanko/gemini-cli-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A lightweight SDK for building non-interactive AI agents powered by Google Gemini",
5
5
  "type": "module",
6
6
  "private": false,