forked from NoeFabris/opencode-antigravity-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.ts
More file actions
52 lines (42 loc) · 1.57 KB
/
Copy pathconstants.ts
File metadata and controls
52 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Constants for session recovery storage paths.
*
* Based on oh-my-opencode/src/hooks/session-recovery/constants.ts
*/
import { join } from "node:path";
import { homedir } from "node:os";
/**
* Get the XDG data directory for OpenCode storage.
* Falls back to ~/.local/share on Linux/Mac, or APPDATA on Windows.
*/
function getXdgData(): string {
const platform = process.platform;
if (platform === "win32") {
return process.env.APPDATA || join(homedir(), "AppData", "Roaming");
}
return process.env.XDG_DATA_HOME || join(homedir(), ".local", "share");
}
/**
* Get the XDG config directory for Antigravity config.
* Falls back to ~/.config on Linux/Mac, or APPDATA on Windows.
*/
export function getXdgConfig(): string {
const platform = process.platform;
if (platform === "win32") {
return process.env.APPDATA || join(homedir(), "AppData", "Roaming");
}
return process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
}
/**
* Get the Antigravity config directory.
* Default: ~/.config/opencode/antigravity.json
*/
export function getAntigravityConfigDir(): string {
return join(getXdgConfig(), "opencode");
}
export const OPENCODE_STORAGE = join(getXdgData(), "opencode", "storage");
export const MESSAGE_STORAGE = join(OPENCODE_STORAGE, "message");
export const PART_STORAGE = join(OPENCODE_STORAGE, "part");
export const THINKING_TYPES = new Set(["thinking", "redacted_thinking", "reasoning"]);
export const META_TYPES = new Set(["step-start", "step-finish"]);
export const CONTENT_TYPES = new Set(["text", "tool", "tool_use", "tool_result"]);