bopodev-agent-sdk 0.1.13 → 0.1.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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > bopodev-agent-sdk@0.1.13 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/agent-sdk
3
+ > bopodev-agent-sdk@0.1.14 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/agent-sdk
4
4
  > tsc -p tsconfig.json --emitDeclarationOnly
5
5
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 BopoDev contributors
3
+ Copyright (c) 2026 Bopo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1 @@
1
+ export declare function formatStdoutEvent(line: string, debug: boolean): void;
@@ -0,0 +1 @@
1
+ export { formatStdoutEvent } from "./format-event";
@@ -0,0 +1,28 @@
1
+ import type { AdapterMetadata, AdapterModule } from "../../../agent-sdk/src/types";
2
+ export declare const type: "gemini_cli";
3
+ export declare const label = "Gemini CLI";
4
+ export declare const models: readonly [{
5
+ readonly id: "gemini-2.5-pro";
6
+ readonly label: "Gemini 2.5 Pro";
7
+ }, {
8
+ readonly id: "gemini-2.5-flash";
9
+ readonly label: "Gemini 2.5 Flash";
10
+ }, {
11
+ readonly id: "gemini-2.5-flash-lite";
12
+ readonly label: "Gemini 2.5 Flash Lite";
13
+ }, {
14
+ readonly id: "gemini-3.1-flash-lite";
15
+ readonly label: "Gemini 3.1 Flash Lite";
16
+ }, {
17
+ readonly id: "gemini-3-flash";
18
+ readonly label: "Gemini 3 Flash";
19
+ }, {
20
+ readonly id: "gemini-3-pro";
21
+ readonly label: "Gemini 3 Pro";
22
+ }, {
23
+ readonly id: "gemini-3-pro-200k";
24
+ readonly label: "Gemini 3 Pro (>200k context)";
25
+ }];
26
+ export declare const agentConfigurationDoc = "# Gemini CLI agent configuration\n\nAdapter: gemini_cli\n\nUse when:\n- You want to run the Gemini CLI locally on the host machine.\n- You want Gemini chat sessions resumed across heartbeats with --resume.\n- You need Google Gemini model selection (e.g. 2.5 Pro, 2.5 Flash, 3 Flash).\n\nDon't use when:\n- You need webhook-style external invocation (use http adapter).\n- You only need a one-shot script without an AI coding agent loop (use shell).\n- Gemini CLI is not installed on the machine that runs the agent.\n\nCore fields:\n- cwd (string, optional): absolute working directory for the agent process.\n- model (string, optional): Gemini model id (e.g. gemini-2.5-pro, gemini-2.5-flash).\n- command (string, optional): defaults to \"gemini\".\n- timeoutSec / timeoutMs (number, optional): run timeout.\n- args (string[], optional): additional CLI args.\n\nNotes:\n- Runs use positional prompt; prompt is passed as the final argument.\n- Sessions resume with --resume when stored session cwd matches the current cwd.\n- Authentication can use GEMINI_API_KEY or GOOGLE_API_KEY.";
27
+ export declare const metadata: AdapterMetadata;
28
+ export declare const geminiCliAdapterModule: AdapterModule;
@@ -0,0 +1,2 @@
1
+ import type { HeartbeatContext, AdapterExecutionResult } from "../../../../agent-sdk/src/types";
2
+ export declare function execute(context: HeartbeatContext): Promise<AdapterExecutionResult>;
@@ -0,0 +1,6 @@
1
+ import type { AgentRuntimeConfig, AdapterModelOption } from "../../../../agent-sdk/src/types";
2
+ import { execute } from "./execute";
3
+ import { testEnvironment } from "./test";
4
+ export { execute, testEnvironment };
5
+ export * from "./parse";
6
+ export declare function listModels(runtime?: AgentRuntimeConfig): Promise<AdapterModelOption[]>;
@@ -0,0 +1 @@
1
+ export { parseGeminiOutput, isGeminiUnknownSessionError } from "../../../../agent-sdk/src/adapters";
@@ -0,0 +1,2 @@
1
+ import type { AgentRuntimeConfig, AdapterEnvironmentResult } from "../../../../agent-sdk/src/types";
2
+ export declare function testEnvironment(runtime?: AgentRuntimeConfig): Promise<AdapterEnvironmentResult>;
@@ -0,0 +1 @@
1
+ export declare function buildAdapterConfig(values: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ export { parseStdoutLine } from "./parse-stdout";
2
+ export { buildAdapterConfig } from "./build-config";
@@ -0,0 +1,6 @@
1
+ export declare function parseStdoutLine(line: string, timestampIso: string): {
2
+ kind: string;
3
+ ts: string;
4
+ text: string;
5
+ adapterType: string;
6
+ }[];
@@ -50,6 +50,7 @@ export declare function runProviderWork(context: HeartbeatContext, provider: "cl
50
50
  }): Promise<AdapterExecutionResult>;
51
51
  export declare function runCursorWork(context: HeartbeatContext): Promise<AdapterExecutionResult>;
52
52
  export declare function runOpenCodeWork(context: HeartbeatContext): Promise<AdapterExecutionResult>;
53
+ export declare function runGeminiCliWork(context: HeartbeatContext): Promise<AdapterExecutionResult>;
53
54
  export declare function resolveFailedUsage(runtime: {
54
55
  parsedUsage?: {
55
56
  tokenInput?: number;
@@ -60,9 +61,6 @@ export declare function resolveFailedUsage(runtime: {
60
61
  failureType?: "timeout" | "spawn_error" | "nonzero_exit";
61
62
  stdout: string;
62
63
  stderr: string;
63
- }, prompt: string, pricing: {
64
- inputRate: number;
65
- outputRate: number;
66
64
  }): {
67
65
  tokenInput: number;
68
66
  tokenOutput: number;
@@ -73,11 +71,6 @@ export declare function resolveFailedUsage(runtime: {
73
71
  tokenOutput: number;
74
72
  usdCost: number;
75
73
  source: "none";
76
- } | {
77
- tokenInput: number;
78
- tokenOutput: number;
79
- usdCost: number;
80
- source: "estimated";
81
74
  };
82
75
  export declare function toProviderResult(context: HeartbeatContext, provider: AgentProviderType, prompt: string, runtime: {
83
76
  ok: boolean;
@@ -142,7 +135,10 @@ export declare function toProviderResult(context: HeartbeatContext, provider: Ag
142
135
  }, pricing: {
143
136
  inputRate: number;
144
137
  outputRate: number;
145
- }, sessionUpdate?: ProviderSessionUpdate): AdapterExecutionResult;
138
+ }, sessionUpdate?: ProviderSessionUpdate, pricingIdentity?: {
139
+ pricingProviderType?: string | null;
140
+ pricingModelId?: string | null;
141
+ }): AdapterExecutionResult;
146
142
  export declare function resolveRuntimeFailureDetail(runtime: {
147
143
  stderr: string;
148
144
  stdout: string;
@@ -155,6 +151,10 @@ export declare function resolveRuntimeFailureDetail(runtime: {
155
151
  export declare function parseOpenCodeOutput(stdout: string): {
156
152
  sessionId: string | null;
157
153
  };
154
+ export declare function parseGeminiOutput(stdout: string): {
155
+ sessionId: string | null;
156
+ };
157
+ export declare function isGeminiUnknownSessionError(stdout: string, stderr: string): boolean;
158
158
  export declare function resolveCursorResumeState(state: HeartbeatContext["state"], cwd: string): {
159
159
  resumeSessionId: null;
160
160
  resumeAttempted: boolean;
@@ -1,2 +1,2 @@
1
1
  export type { RuntimeAttemptTrace, RuntimeCommandHealth, RuntimeExecutionOutput, RuntimeTranscriptEvent } from "./runtime";
2
- export { checkRuntimeCommandHealth, executeAgentRuntime, executePromptRuntime } from "./runtime";
2
+ export { checkRuntimeCommandHealth, containsRateLimitFailure, executeAgentRuntime, executePromptRuntime } from "./runtime";
@@ -1,5 +1,5 @@
1
1
  import type { AgentRuntimeConfig } from "./types";
2
- type LocalProvider = "claude_code" | "codex" | "cursor" | "opencode";
2
+ type LocalProvider = "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli";
3
3
  type ClaudeContractDiagnostics = {
4
4
  commandOverride: boolean;
5
5
  commandLooksClaude: boolean;
@@ -93,6 +93,7 @@ export declare function executePromptRuntime(command: string, prompt: string, co
93
93
  provider?: LocalProvider;
94
94
  claudeContract?: ClaudeContractDiagnostics;
95
95
  }): Promise<RuntimeExecutionOutput>;
96
+ export declare function containsRateLimitFailure(text: string): boolean;
96
97
  export declare function checkRuntimeCommandHealth(command: string, options?: {
97
98
  cwd?: string;
98
99
  timeoutMs?: number;
@@ -115,5 +116,9 @@ export declare function parseClaudeStreamOutput(stdout: string): {
115
116
  sessionId: string | undefined;
116
117
  } | undefined;
117
118
  export declare function parseCursorStreamOutput(stdout: string): CursorParsedStream | undefined;
119
+ export declare function parseGeminiStreamOutput(stdout: string, stderr?: string): {
120
+ usage: ParsedUsageRecord;
121
+ sessionId?: string;
122
+ } | undefined;
118
123
  export declare function parseRuntimeTranscript(provider: LocalProvider | undefined, stdout: string, stderr: string): RuntimeTranscriptEvent[] | undefined;
119
124
  export {};
@@ -64,6 +64,8 @@ export interface AdapterExecutionResult {
64
64
  tokenInput: number;
65
65
  tokenOutput: number;
66
66
  usdCost: number;
67
+ pricingProviderType?: string | null;
68
+ pricingModelId?: string | null;
67
69
  outcome?: ExecutionOutcome;
68
70
  nextState?: AgentState;
69
71
  trace?: AdapterTrace;
@@ -167,7 +169,7 @@ export interface AdapterTrace {
167
169
  timedOut?: boolean;
168
170
  failureType?: string;
169
171
  timeoutSource?: "runtime" | "watchdog" | null;
170
- usageSource?: "structured" | "estimated" | "none" | "unknown";
172
+ usageSource?: "structured" | "none" | "unknown";
171
173
  attemptCount?: number;
172
174
  attempts?: Array<{
173
175
  attempt: number;
@@ -203,6 +205,7 @@ export interface AdapterTrace {
203
205
  claudeSessionId?: string;
204
206
  cursorSessionId?: string;
205
207
  cursorErrorMessage?: string;
208
+ geminiSessionId?: string;
206
209
  claudeContract?: {
207
210
  commandOverride: boolean;
208
211
  commandLooksClaude: boolean;
@@ -125,6 +125,7 @@ export declare const ProviderTypeSchema: z.ZodEnum<{
125
125
  codex: "codex";
126
126
  cursor: "cursor";
127
127
  opencode: "opencode";
128
+ gemini_cli: "gemini_cli";
128
129
  openai_api: "openai_api";
129
130
  anthropic_api: "anthropic_api";
130
131
  http: "http";
@@ -437,6 +438,7 @@ export declare const AgentCreateRequestSchema: z.ZodObject<{
437
438
  codex: "codex";
438
439
  cursor: "cursor";
439
440
  opencode: "opencode";
441
+ gemini_cli: "gemini_cli";
440
442
  openai_api: "openai_api";
441
443
  anthropic_api: "anthropic_api";
442
444
  http: "http";
@@ -480,6 +482,7 @@ export declare const AgentUpdateRequestSchema: z.ZodObject<{
480
482
  codex: "codex";
481
483
  cursor: "cursor";
482
484
  opencode: "opencode";
485
+ gemini_cli: "gemini_cli";
483
486
  openai_api: "openai_api";
484
487
  anthropic_api: "anthropic_api";
485
488
  http: "http";
@@ -530,6 +533,7 @@ export declare const AgentSchema: z.ZodObject<{
530
533
  codex: "codex";
531
534
  cursor: "cursor";
532
535
  opencode: "opencode";
536
+ gemini_cli: "gemini_cli";
533
537
  openai_api: "openai_api";
534
538
  anthropic_api: "anthropic_api";
535
539
  http: "http";
@@ -769,6 +773,7 @@ export declare const OfficeOccupantSchema: z.ZodObject<{
769
773
  codex: "codex";
770
774
  cursor: "cursor";
771
775
  opencode: "opencode";
776
+ gemini_cli: "gemini_cli";
772
777
  openai_api: "openai_api";
773
778
  anthropic_api: "anthropic_api";
774
779
  http: "http";
@@ -815,6 +820,7 @@ export declare const OfficeSpaceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
815
820
  codex: "codex";
816
821
  cursor: "cursor";
817
822
  opencode: "opencode";
823
+ gemini_cli: "gemini_cli";
818
824
  openai_api: "openai_api";
819
825
  anthropic_api: "anthropic_api";
820
826
  http: "http";
@@ -860,6 +866,7 @@ export declare const OfficeSpaceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
860
866
  codex: "codex";
861
867
  cursor: "cursor";
862
868
  opencode: "opencode";
869
+ gemini_cli: "gemini_cli";
863
870
  openai_api: "openai_api";
864
871
  anthropic_api: "anthropic_api";
865
872
  http: "http";
@@ -1142,6 +1149,7 @@ export declare const RealtimeEventEnvelopeSchema: z.ZodDiscriminatedUnion<[z.Zod
1142
1149
  codex: "codex";
1143
1150
  cursor: "cursor";
1144
1151
  opencode: "opencode";
1152
+ gemini_cli: "gemini_cli";
1145
1153
  openai_api: "openai_api";
1146
1154
  anthropic_api: "anthropic_api";
1147
1155
  http: "http";
@@ -1187,6 +1195,7 @@ export declare const RealtimeEventEnvelopeSchema: z.ZodDiscriminatedUnion<[z.Zod
1187
1195
  codex: "codex";
1188
1196
  cursor: "cursor";
1189
1197
  opencode: "opencode";
1198
+ gemini_cli: "gemini_cli";
1190
1199
  openai_api: "openai_api";
1191
1200
  anthropic_api: "anthropic_api";
1192
1201
  http: "http";
@@ -1455,6 +1464,7 @@ export declare const RealtimeEventMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
1455
1464
  codex: "codex";
1456
1465
  cursor: "cursor";
1457
1466
  opencode: "opencode";
1467
+ gemini_cli: "gemini_cli";
1458
1468
  openai_api: "openai_api";
1459
1469
  anthropic_api: "anthropic_api";
1460
1470
  http: "http";
@@ -1500,6 +1510,7 @@ export declare const RealtimeEventMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
1500
1510
  codex: "codex";
1501
1511
  cursor: "cursor";
1502
1512
  opencode: "opencode";
1513
+ gemini_cli: "gemini_cli";
1503
1514
  openai_api: "openai_api";
1504
1515
  anthropic_api: "anthropic_api";
1505
1516
  http: "http";
@@ -1768,6 +1779,7 @@ export declare const RealtimeMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
1768
1779
  codex: "codex";
1769
1780
  cursor: "cursor";
1770
1781
  opencode: "opencode";
1782
+ gemini_cli: "gemini_cli";
1771
1783
  openai_api: "openai_api";
1772
1784
  anthropic_api: "anthropic_api";
1773
1785
  http: "http";
@@ -1813,6 +1825,7 @@ export declare const RealtimeMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
1813
1825
  codex: "codex";
1814
1826
  cursor: "cursor";
1815
1827
  opencode: "opencode";
1828
+ gemini_cli: "gemini_cli";
1816
1829
  openai_api: "openai_api";
1817
1830
  anthropic_api: "anthropic_api";
1818
1831
  http: "http";
@@ -1977,11 +1990,24 @@ export declare const CostLedgerEntrySchema: z.ZodObject<{
1977
1990
  codex: "codex";
1978
1991
  cursor: "cursor";
1979
1992
  opencode: "opencode";
1993
+ gemini_cli: "gemini_cli";
1980
1994
  openai_api: "openai_api";
1981
1995
  anthropic_api: "anthropic_api";
1982
1996
  http: "http";
1983
1997
  shell: "shell";
1984
1998
  }>;
1999
+ runtimeModelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2000
+ pricingProviderType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2001
+ opencode: "opencode";
2002
+ openai_api: "openai_api";
2003
+ anthropic_api: "anthropic_api";
2004
+ gemini_api: "gemini_api";
2005
+ }>>>;
2006
+ pricingModelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2007
+ pricingSource: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2008
+ exact: "exact";
2009
+ missing: "missing";
2010
+ }>>>;
1985
2011
  tokenInput: z.ZodNumber;
1986
2012
  tokenOutput: z.ZodNumber;
1987
2013
  usdCost: z.ZodNumber;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "bopodev-agent-sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "types": "src/index.ts",
8
8
  "dependencies": {
9
- "bopodev-contracts": "0.1.13"
9
+ "bopodev-contracts": "0.1.14"
10
10
  },
11
11
  "scripts": {
12
12
  "build": "tsc -p tsconfig.json --emitDeclarationOnly",