oh-my-opencode 0.3.3 → 0.4.0

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.
Files changed (52) hide show
  1. package/README.ko.md +162 -37
  2. package/README.md +160 -35
  3. package/dist/auth/antigravity/constants.d.ts +36 -0
  4. package/dist/auth/antigravity/fetch.d.ts +68 -0
  5. package/dist/auth/antigravity/index.d.ts +13 -0
  6. package/dist/auth/antigravity/message-converter.d.ts +54 -0
  7. package/dist/auth/antigravity/oauth.d.ts +85 -0
  8. package/dist/auth/antigravity/plugin.d.ts +54 -0
  9. package/dist/auth/antigravity/project.d.ts +20 -0
  10. package/dist/auth/antigravity/request.d.ts +104 -0
  11. package/dist/auth/antigravity/response.d.ts +137 -0
  12. package/dist/auth/antigravity/thinking.d.ts +234 -0
  13. package/dist/auth/antigravity/thought-signature-store.d.ts +52 -0
  14. package/dist/auth/antigravity/token.d.ts +41 -0
  15. package/dist/auth/antigravity/tools.d.ts +119 -0
  16. package/dist/auth/antigravity/types.d.ts +173 -0
  17. package/dist/config/schema.d.ts +454 -80
  18. package/dist/features/background-agent/index.d.ts +2 -0
  19. package/dist/features/background-agent/manager.d.ts +37 -0
  20. package/dist/features/background-agent/types.d.ts +27 -0
  21. package/dist/google-auth.d.ts +3 -0
  22. package/dist/hooks/anthropic-auto-compact/types.d.ts +11 -0
  23. package/dist/hooks/auto-update-checker/cache.d.ts +1 -0
  24. package/dist/hooks/auto-update-checker/checker.d.ts +6 -0
  25. package/dist/hooks/auto-update-checker/constants.d.ts +8 -0
  26. package/dist/hooks/auto-update-checker/index.d.ts +12 -0
  27. package/dist/hooks/auto-update-checker/types.d.ts +19 -0
  28. package/dist/hooks/background-notification/index.d.ts +12 -0
  29. package/dist/hooks/background-notification/types.d.ts +4 -0
  30. package/dist/hooks/index.d.ts +3 -0
  31. package/dist/hooks/rules-injector/constants.d.ts +6 -0
  32. package/dist/hooks/rules-injector/finder.d.ts +45 -0
  33. package/dist/hooks/rules-injector/index.d.ts +22 -0
  34. package/dist/hooks/rules-injector/matcher.d.ts +21 -0
  35. package/dist/hooks/rules-injector/parser.d.ts +18 -0
  36. package/dist/hooks/rules-injector/storage.d.ts +9 -0
  37. package/dist/hooks/rules-injector/types.d.ts +41 -0
  38. package/dist/hooks/session-recovery/storage.d.ts +1 -0
  39. package/dist/index.js +4320 -1445
  40. package/dist/tools/ast-grep/index.d.ts +4 -4
  41. package/dist/tools/ast-grep/tools.d.ts +4 -4
  42. package/dist/tools/background-task/constants.d.ts +3 -0
  43. package/dist/tools/background-task/index.d.ts +3 -0
  44. package/dist/tools/background-task/tools.d.ts +39 -0
  45. package/dist/tools/background-task/types.d.ts +13 -0
  46. package/dist/tools/call-omo-agent/constants.d.ts +2 -0
  47. package/dist/tools/call-omo-agent/index.d.ts +3 -0
  48. package/dist/tools/call-omo-agent/tools.d.ts +22 -0
  49. package/dist/tools/call-omo-agent/types.d.ts +24 -0
  50. package/dist/tools/index.d.ts +47 -6
  51. package/dist/tools/lsp/tools.d.ts +2 -2
  52. package/package.json +11 -3
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Thought Signature Store
3
+ *
4
+ * Stores and retrieves thought signatures for multi-turn conversations.
5
+ * Gemini 3 Pro requires thought_signature on function call content blocks
6
+ * in subsequent requests to maintain reasoning continuity.
7
+ *
8
+ * Key responsibilities:
9
+ * - Store the latest thought signature per session
10
+ * - Provide signature for injection into function call requests
11
+ * - Clear signatures when sessions end
12
+ */
13
+ /**
14
+ * Store a thought signature for a session
15
+ *
16
+ * @param sessionKey - Unique session identifier (typically fetch instance ID)
17
+ * @param signature - The thought signature from model response
18
+ */
19
+ export declare function setThoughtSignature(sessionKey: string, signature: string): void;
20
+ /**
21
+ * Retrieve the stored thought signature for a session
22
+ *
23
+ * @param sessionKey - Unique session identifier
24
+ * @returns The stored signature or undefined if not found
25
+ */
26
+ export declare function getThoughtSignature(sessionKey: string): string | undefined;
27
+ /**
28
+ * Clear the thought signature for a session
29
+ *
30
+ * @param sessionKey - Unique session identifier
31
+ */
32
+ export declare function clearThoughtSignature(sessionKey: string): void;
33
+ /**
34
+ * Store or retrieve a persistent session ID for a fetch instance
35
+ *
36
+ * @param fetchInstanceId - Unique identifier for the fetch instance
37
+ * @param sessionId - Optional session ID to store (if not provided, returns existing or generates new)
38
+ * @returns The session ID for this fetch instance
39
+ */
40
+ export declare function getOrCreateSessionId(fetchInstanceId: string, sessionId?: string): string;
41
+ /**
42
+ * Clear the session ID for a fetch instance
43
+ *
44
+ * @param fetchInstanceId - Unique identifier for the fetch instance
45
+ */
46
+ export declare function clearSessionId(fetchInstanceId: string): void;
47
+ /**
48
+ * Clear all stored data for a fetch instance (signature + session ID)
49
+ *
50
+ * @param fetchInstanceId - Unique identifier for the fetch instance
51
+ */
52
+ export declare function clearFetchInstanceData(fetchInstanceId: string): void;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Antigravity token management utilities.
3
+ * Handles token expiration checking, refresh, and storage format parsing.
4
+ */
5
+ import type { AntigravityRefreshParts, AntigravityTokenExchangeResult, AntigravityTokens } from "./types";
6
+ /**
7
+ * Check if the access token is expired.
8
+ * Includes a 60-second safety buffer to refresh before actual expiration.
9
+ *
10
+ * @param tokens - The Antigravity tokens to check
11
+ * @returns true if the token is expired or will expire within the buffer period
12
+ */
13
+ export declare function isTokenExpired(tokens: AntigravityTokens): boolean;
14
+ /**
15
+ * Refresh an access token using a refresh token.
16
+ * Exchanges the refresh token for a new access token via Google's OAuth endpoint.
17
+ *
18
+ * @param refreshToken - The refresh token to use
19
+ * @param clientId - Optional custom client ID (defaults to ANTIGRAVITY_CLIENT_ID)
20
+ * @param clientSecret - Optional custom client secret (defaults to ANTIGRAVITY_CLIENT_SECRET)
21
+ * @returns Token exchange result with new access token, or throws on error
22
+ */
23
+ export declare function refreshAccessToken(refreshToken: string, clientId?: string, clientSecret?: string): Promise<AntigravityTokenExchangeResult>;
24
+ /**
25
+ * Parse a stored token string into its component parts.
26
+ * Storage format: `refreshToken|projectId|managedProjectId`
27
+ *
28
+ * @param stored - The pipe-separated stored token string
29
+ * @returns Parsed refresh parts with refreshToken, projectId, and optional managedProjectId
30
+ */
31
+ export declare function parseStoredToken(stored: string): AntigravityRefreshParts;
32
+ /**
33
+ * Format token components for storage.
34
+ * Creates a pipe-separated string: `refreshToken|projectId|managedProjectId`
35
+ *
36
+ * @param refreshToken - The refresh token
37
+ * @param projectId - The GCP project ID
38
+ * @param managedProjectId - Optional managed project ID for enterprise users
39
+ * @returns Formatted string for storage
40
+ */
41
+ export declare function formatTokenForStorage(refreshToken: string, projectId: string, managedProjectId?: string): string;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Antigravity Tool Normalization
3
+ * Converts tools between OpenAI and Gemini formats.
4
+ *
5
+ * OpenAI format:
6
+ * { "type": "function", "function": { "name": "x", "description": "...", "parameters": {...} } }
7
+ *
8
+ * Gemini format:
9
+ * { "functionDeclarations": [{ "name": "x", "description": "...", "parameters": {...} }] }
10
+ *
11
+ * Note: This is for Gemini models ONLY. Claude models are not supported via Antigravity.
12
+ */
13
+ /**
14
+ * OpenAI function tool format
15
+ */
16
+ export interface OpenAITool {
17
+ type: string;
18
+ function?: {
19
+ name: string;
20
+ description?: string;
21
+ parameters?: Record<string, unknown>;
22
+ };
23
+ }
24
+ /**
25
+ * Gemini function declaration format
26
+ */
27
+ export interface GeminiFunctionDeclaration {
28
+ name: string;
29
+ description?: string;
30
+ parameters?: Record<string, unknown>;
31
+ }
32
+ /**
33
+ * Gemini tools format (array of functionDeclarations)
34
+ */
35
+ export interface GeminiTools {
36
+ functionDeclarations: GeminiFunctionDeclaration[];
37
+ }
38
+ /**
39
+ * OpenAI tool call in response
40
+ */
41
+ export interface OpenAIToolCall {
42
+ id: string;
43
+ type: "function";
44
+ function: {
45
+ name: string;
46
+ arguments: string;
47
+ };
48
+ }
49
+ /**
50
+ * Gemini function call in response
51
+ */
52
+ export interface GeminiFunctionCall {
53
+ name: string;
54
+ args: Record<string, unknown>;
55
+ }
56
+ /**
57
+ * Gemini function response format
58
+ */
59
+ export interface GeminiFunctionResponse {
60
+ name: string;
61
+ response: Record<string, unknown>;
62
+ }
63
+ /**
64
+ * Gemini tool result containing function calls
65
+ */
66
+ export interface GeminiToolResult {
67
+ functionCall?: GeminiFunctionCall;
68
+ functionResponse?: GeminiFunctionResponse;
69
+ }
70
+ /**
71
+ * Normalize OpenAI-format tools to Gemini format.
72
+ * Converts an array of OpenAI tools to Gemini's functionDeclarations format.
73
+ *
74
+ * - Handles `function` type tools with name, description, parameters
75
+ * - Logs warning for unsupported tool types (does NOT silently drop them)
76
+ * - Creates a single object with functionDeclarations array
77
+ *
78
+ * @param tools - Array of OpenAI-format tools
79
+ * @returns Gemini-format tools object with functionDeclarations, or undefined if no valid tools
80
+ */
81
+ export declare function normalizeToolsForGemini(tools: OpenAITool[]): GeminiTools | undefined;
82
+ /**
83
+ * Convert Gemini tool results (functionCall) back to OpenAI tool_call format.
84
+ * Handles both functionCall (request) and functionResponse (result) formats.
85
+ *
86
+ * Gemini functionCall format:
87
+ * { "name": "tool_name", "args": { ... } }
88
+ *
89
+ * OpenAI tool_call format:
90
+ * { "id": "call_xxx", "type": "function", "function": { "name": "tool_name", "arguments": "..." } }
91
+ *
92
+ * @param results - Array of Gemini tool results containing functionCall or functionResponse
93
+ * @returns Array of OpenAI-format tool calls
94
+ */
95
+ export declare function normalizeToolResultsFromGemini(results: GeminiToolResult[]): OpenAIToolCall[];
96
+ /**
97
+ * Convert a single Gemini functionCall to OpenAI tool_call format.
98
+ * Useful for streaming responses where each chunk may contain a function call.
99
+ *
100
+ * @param functionCall - Gemini function call
101
+ * @param id - Optional tool call ID (generates one if not provided)
102
+ * @returns OpenAI-format tool call
103
+ */
104
+ export declare function convertFunctionCallToToolCall(functionCall: GeminiFunctionCall, id?: string): OpenAIToolCall;
105
+ /**
106
+ * Check if a tool array contains any function-type tools.
107
+ *
108
+ * @param tools - Array of OpenAI-format tools
109
+ * @returns true if there are function tools to normalize
110
+ */
111
+ export declare function hasFunctionTools(tools: OpenAITool[]): boolean;
112
+ /**
113
+ * Extract function declarations from already-normalized Gemini tools.
114
+ * Useful when tools may already be in Gemini format.
115
+ *
116
+ * @param tools - Tools that may be in Gemini or OpenAI format
117
+ * @returns Array of function declarations
118
+ */
119
+ export declare function extractFunctionDeclarations(tools: unknown): GeminiFunctionDeclaration[];
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Antigravity Auth Type Definitions
3
+ * Matches cliproxyapi/sdk/auth/antigravity.go token format exactly
4
+ */
5
+ /**
6
+ * Token storage format for Antigravity authentication
7
+ * Matches Go metadata structure: type, access_token, refresh_token, expires_in, timestamp, email, project_id
8
+ */
9
+ export interface AntigravityTokens {
10
+ /** Always "antigravity" for this auth type */
11
+ type: "antigravity";
12
+ /** OAuth access token from Google */
13
+ access_token: string;
14
+ /** OAuth refresh token from Google */
15
+ refresh_token: string;
16
+ /** Token expiration time in seconds */
17
+ expires_in: number;
18
+ /** Unix timestamp in milliseconds when tokens were obtained */
19
+ timestamp: number;
20
+ /** ISO 8601 formatted expiration datetime (optional, for display) */
21
+ expired?: string;
22
+ /** User's email address from Google userinfo */
23
+ email?: string;
24
+ /** GCP project ID from loadCodeAssist API */
25
+ project_id?: string;
26
+ }
27
+ /**
28
+ * Project context returned from loadCodeAssist API
29
+ * Used to get cloudaicompanionProject for API calls
30
+ */
31
+ export interface AntigravityProjectContext {
32
+ /** GCP project ID for Cloud AI Companion */
33
+ cloudaicompanionProject?: string;
34
+ /** Managed project ID for enterprise users (optional) */
35
+ managedProjectId?: string;
36
+ }
37
+ /**
38
+ * Metadata for loadCodeAssist API request
39
+ */
40
+ export interface AntigravityClientMetadata {
41
+ /** IDE type identifier */
42
+ ideType: "IDE_UNSPECIFIED" | string;
43
+ /** Platform identifier */
44
+ platform: "PLATFORM_UNSPECIFIED" | string;
45
+ /** Plugin type - typically "GEMINI" */
46
+ pluginType: "GEMINI" | string;
47
+ }
48
+ /**
49
+ * Request body for loadCodeAssist API
50
+ */
51
+ export interface AntigravityLoadCodeAssistRequest {
52
+ metadata: AntigravityClientMetadata;
53
+ }
54
+ /**
55
+ * Response from loadCodeAssist API
56
+ */
57
+ export interface AntigravityLoadCodeAssistResponse {
58
+ /** Project ID - can be string or object with id field */
59
+ cloudaicompanionProject?: string | {
60
+ id: string;
61
+ };
62
+ }
63
+ /**
64
+ * Request body format for Antigravity API calls
65
+ * Wraps the actual request with project and model context
66
+ */
67
+ export interface AntigravityRequestBody {
68
+ /** GCP project ID */
69
+ project: string;
70
+ /** Model identifier (e.g., "gemini-3-pro-preview") */
71
+ model: string;
72
+ /** User agent identifier */
73
+ userAgent: string;
74
+ /** Unique request ID */
75
+ requestId: string;
76
+ /** The actual request payload */
77
+ request: Record<string, unknown>;
78
+ }
79
+ /**
80
+ * Response format from Antigravity API
81
+ * Follows OpenAI-compatible structure with Gemini extensions
82
+ */
83
+ export interface AntigravityResponse {
84
+ /** Response ID */
85
+ id?: string;
86
+ /** Object type (e.g., "chat.completion") */
87
+ object?: string;
88
+ /** Creation timestamp */
89
+ created?: number;
90
+ /** Model used for response */
91
+ model?: string;
92
+ /** Response choices */
93
+ choices?: AntigravityResponseChoice[];
94
+ /** Token usage statistics */
95
+ usage?: AntigravityUsage;
96
+ /** Error information if request failed */
97
+ error?: AntigravityError;
98
+ }
99
+ /**
100
+ * Single response choice in Antigravity response
101
+ */
102
+ export interface AntigravityResponseChoice {
103
+ /** Choice index */
104
+ index: number;
105
+ /** Message content */
106
+ message?: {
107
+ role: "assistant";
108
+ content?: string;
109
+ tool_calls?: AntigravityToolCall[];
110
+ };
111
+ /** Delta for streaming responses */
112
+ delta?: {
113
+ role?: "assistant";
114
+ content?: string;
115
+ tool_calls?: AntigravityToolCall[];
116
+ };
117
+ /** Finish reason */
118
+ finish_reason?: "stop" | "tool_calls" | "length" | "content_filter" | null;
119
+ }
120
+ /**
121
+ * Tool call in Antigravity response
122
+ */
123
+ export interface AntigravityToolCall {
124
+ id: string;
125
+ type: "function";
126
+ function: {
127
+ name: string;
128
+ arguments: string;
129
+ };
130
+ }
131
+ /**
132
+ * Token usage statistics
133
+ */
134
+ export interface AntigravityUsage {
135
+ prompt_tokens: number;
136
+ completion_tokens: number;
137
+ total_tokens: number;
138
+ }
139
+ /**
140
+ * Error response from Antigravity API
141
+ */
142
+ export interface AntigravityError {
143
+ message: string;
144
+ type?: string;
145
+ code?: string | number;
146
+ }
147
+ /**
148
+ * Token exchange result from Google OAuth
149
+ * Matches antigravityTokenResponse in Go
150
+ */
151
+ export interface AntigravityTokenExchangeResult {
152
+ access_token: string;
153
+ refresh_token: string;
154
+ expires_in: number;
155
+ token_type: string;
156
+ }
157
+ /**
158
+ * User info from Google userinfo API
159
+ */
160
+ export interface AntigravityUserInfo {
161
+ email: string;
162
+ name?: string;
163
+ picture?: string;
164
+ }
165
+ /**
166
+ * Parsed refresh token parts
167
+ * Format: refreshToken|projectId|managedProjectId
168
+ */
169
+ export interface AntigravityRefreshParts {
170
+ refreshToken: string;
171
+ projectId?: string;
172
+ managedProjectId?: string;
173
+ }