geomind 0.1.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.
- package/.geomind/extensions/memory.ts +330 -0
- package/.geomind/extensions/setup.ts +247 -0
- package/README.md +206 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +163 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/system.d.ts +3 -0
- package/dist/prompts/system.d.ts.map +1 -0
- package/dist/prompts/system.js +130 -0
- package/dist/prompts/system.js.map +1 -0
- package/dist/setup.d.ts +15 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +227 -0
- package/dist/setup.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# GeoMind
|
|
2
|
+
|
|
3
|
+
具备自主数据认知与持续记忆能力的地理空间分析智能体。
|
|
4
|
+
|
|
5
|
+
GeoMind 基于 [Pi Agent](https://github.com/earendil-works/pi) 构建,能够通过 `psql` 自主探索 PostGIS 数据库,无需人工编写模式文档。它会记住你的纠错和偏好,越用越好。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
### 前置要求
|
|
12
|
+
|
|
13
|
+
- [Node.js](https://nodejs.org/) >= 18
|
|
14
|
+
- [PostgreSQL](https://www.postgresql.org/)(本地或远程均可)
|
|
15
|
+
- 大模型 API Key(支持 Anthropic Claude、OpenAI、DeepSeek 等)
|
|
16
|
+
- [QGIS](https://qgis.org/)(可选,用于空间分析处理)
|
|
17
|
+
|
|
18
|
+
### 从 npm 安装(推荐)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g geomind
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 从源码安装(开发者)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git clone https://github.com/zhanlutuzi/GeoMind.git
|
|
28
|
+
cd GeoMind
|
|
29
|
+
pnpm install
|
|
30
|
+
pnpm build
|
|
31
|
+
pnpm link --global
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> **Windows 用户**:如果全局安装报权限错误,请用管理员身份运行命令行。
|
|
35
|
+
|
|
36
|
+
### 卸载
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# npm 安装的
|
|
40
|
+
npm uninstall -g geomind
|
|
41
|
+
|
|
42
|
+
# 源码安装的
|
|
43
|
+
pnpm uninstall --global geomind
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 快速开始
|
|
49
|
+
|
|
50
|
+
### 1. 设置大模型
|
|
51
|
+
|
|
52
|
+
GeoMind 需要一个大模型 API Key。设置环境变量后启动:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
56
|
+
geomind
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
或者启动后使用 `/login` 命令交互式登录。
|
|
60
|
+
|
|
61
|
+
### 2. 配置数据库
|
|
62
|
+
|
|
63
|
+
首次启动后,在对话中使用 `/setup` 命令配置数据库连接:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
/setup
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
按提示输入数据库信息(host、port、用户名、数据库名)。支持本地和远程数据库。
|
|
70
|
+
|
|
71
|
+
你也可以手动编辑配置文件:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
// .geomind/config.json(工程级)或 ~/.geomind/config.json(全局)
|
|
75
|
+
{
|
|
76
|
+
"psql": {
|
|
77
|
+
"command": "psql",
|
|
78
|
+
"database": "my_database",
|
|
79
|
+
"host": "localhost",
|
|
80
|
+
"port": 5432,
|
|
81
|
+
"user": "readonly_user"
|
|
82
|
+
},
|
|
83
|
+
"qgis_process": {
|
|
84
|
+
"path": "/path/to/qgis_process",
|
|
85
|
+
"available": true
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. 开始使用
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
geomind
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
然后直接用自然语言和它对话:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
> 帮我看看数据库里有什么表
|
|
100
|
+
|
|
101
|
+
> 查一下东京都内有多少个铁路站点
|
|
102
|
+
|
|
103
|
+
> 找出涩谷区地价最高的5个地点,导出为 GeoJSON
|
|
104
|
+
|
|
105
|
+
> 分析哪些铁路站点位于洪水风险区域内
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
GeoMind 会自主探索数据库、生成 SQL、执行查询,遇到不确定的会主动问你。
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 功能特性
|
|
113
|
+
|
|
114
|
+
### 🔍 自主数据库探索
|
|
115
|
+
|
|
116
|
+
无需人工编写模式文档。GeoMind 通过 psql 自主发现表结构、空间列、参考系等信息。不确定的语义会主动询问用户。
|
|
117
|
+
|
|
118
|
+
### 🧠 持续记忆
|
|
119
|
+
|
|
120
|
+
GeoMind 会记住:
|
|
121
|
+
- **数据库知识**:表结构、列含义、查询模式(工程级)
|
|
122
|
+
- **用户偏好**:常关注区域、分析习惯、展示偏好(全局)
|
|
123
|
+
- **用户纠错**:你曾经纠正过的错误理解(全局)
|
|
124
|
+
|
|
125
|
+
每 5 轮对话自动反思一次,将新知识合并到记忆中。
|
|
126
|
+
|
|
127
|
+
### 🌍 空间分析
|
|
128
|
+
|
|
129
|
+
- 通过 PostGIS 执行空间 SQL(ST_Contains、ST_Buffer、ST_Intersects 等)
|
|
130
|
+
- 支持 QGIS Processing(`qgis_process`)进行高级空间分析(可选)
|
|
131
|
+
- 可导出 GeoJSON、生成交互式 HTML 地图报告
|
|
132
|
+
|
|
133
|
+
### ⚙️ 配置分层
|
|
134
|
+
|
|
135
|
+
| 类型 | 位置 | 适用场景 |
|
|
136
|
+
|------|------|---------|
|
|
137
|
+
| 全局 | `~/.geomind/` | API Key、用户身份、偏好、QGIS 路径 |
|
|
138
|
+
| 工程级 | `./.geomind/` | 数据库连接、数据库知识记忆 |
|
|
139
|
+
|
|
140
|
+
工程级配置覆盖全局配置。
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 常用命令
|
|
145
|
+
|
|
146
|
+
| 命令 | 说明 |
|
|
147
|
+
|------|------|
|
|
148
|
+
| `/setup` | 交互式配置数据库连接和 QGIS |
|
|
149
|
+
| `/login` | 设置大模型 API Key |
|
|
150
|
+
| `/model` | 切换大模型 |
|
|
151
|
+
| `/new` | 新建会话 |
|
|
152
|
+
| `/compact` | 压缩上下文 |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 开发
|
|
157
|
+
|
|
158
|
+
### 环境准备
|
|
159
|
+
|
|
160
|
+
- [pnpm](https://pnpm.io/)(安装:`npm install -g pnpm`)
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/zhanlutuzi/GeoMind.git
|
|
164
|
+
cd GeoMind
|
|
165
|
+
pnpm install
|
|
166
|
+
pnpm dev # 开发模式(tsx 直接运行,无需编译)
|
|
167
|
+
pnpm build # 编译
|
|
168
|
+
pnpm start # 运行编译后的版本
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 项目结构
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
├── src/
|
|
175
|
+
│ ├── index.ts # 入口文件
|
|
176
|
+
│ ├── config.ts # 配置管理(全局/工程分层)
|
|
177
|
+
│ ├── setup.ts # 环境检测与初始化
|
|
178
|
+
│ └── prompts/
|
|
179
|
+
│ └── system.ts # System Prompt 动态生成
|
|
180
|
+
├── .geomind/
|
|
181
|
+
│ └── extensions/
|
|
182
|
+
│ ├── memory.ts # 记忆系统 Extension
|
|
183
|
+
│ └── setup.ts # /setup 命令 Extension
|
|
184
|
+
├── scripts/
|
|
185
|
+
│ ├── patch-branding.js # 品牌定制脚本(仅开发时用)
|
|
186
|
+
│ └── ensure-shebang.js # 编译后添加 shebang
|
|
187
|
+
└── devplan/ # 开发计划文档
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 平台支持
|
|
193
|
+
|
|
194
|
+
- ✅ macOS
|
|
195
|
+
- ✅ Linux
|
|
196
|
+
- ✅ Windows
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 致谢
|
|
201
|
+
|
|
202
|
+
GeoMind 基于 [Pi Agent](https://github.com/earendil-works/pi) 开源框架构建。感谢 Earendil Works 团队提供的优秀 Agent 基础设施,包括工具调用、会话管理、终端 UI 等核心能力,使我们能够专注于地理空间领域的智能体研究。
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface GeoMindConfig {
|
|
2
|
+
psql?: {
|
|
3
|
+
command: string;
|
|
4
|
+
database: string;
|
|
5
|
+
user?: string;
|
|
6
|
+
host?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
};
|
|
9
|
+
qgis_process?: {
|
|
10
|
+
path: string;
|
|
11
|
+
available: boolean;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export type ConfigScope = "global" | "project";
|
|
15
|
+
export declare const EMPTY_CONFIG: GeoMindConfig;
|
|
16
|
+
export declare function getGlobalDir(): string;
|
|
17
|
+
export declare function getGlobalAgentDir(): string;
|
|
18
|
+
export declare function getGlobalConfigPath(): string;
|
|
19
|
+
export declare function getProjectDir(cwd?: string): string;
|
|
20
|
+
export declare function getProjectConfigPath(cwd?: string): string;
|
|
21
|
+
export declare function getConfigPath(cwd?: string): string;
|
|
22
|
+
export declare function configExists(cwd?: string): boolean;
|
|
23
|
+
export declare function projectConfigExists(cwd?: string): boolean;
|
|
24
|
+
export declare function globalConfigExists(): boolean;
|
|
25
|
+
export declare function ensureGlobalLayout(): void;
|
|
26
|
+
export declare function ensureProjectLayout(cwd?: string): void;
|
|
27
|
+
export declare function ensureConfigDir(cwd?: string): void;
|
|
28
|
+
export declare function normalizeConfig(value: unknown): GeoMindConfig;
|
|
29
|
+
export declare function mergeConfig(globalConfig: GeoMindConfig, projectConfig: GeoMindConfig): GeoMindConfig;
|
|
30
|
+
export declare function loadGlobalConfig(): GeoMindConfig;
|
|
31
|
+
export declare function loadProjectConfig(cwd?: string): GeoMindConfig;
|
|
32
|
+
export declare function loadConfig(cwd?: string): GeoMindConfig;
|
|
33
|
+
export declare function writeConfig(config: GeoMindConfig, cwd?: string, scope?: ConfigScope): void;
|
|
34
|
+
export declare function writeGlobalConfig(config: GeoMindConfig): void;
|
|
35
|
+
export declare function writeProjectConfig(config: GeoMindConfig, cwd?: string): void;
|
|
36
|
+
export declare function buildPsqlCommand(config: GeoMindConfig): string | undefined;
|
|
37
|
+
export declare function migrateLegacyPiAuth(): boolean;
|
|
38
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG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SAAS,CAmB1E;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAS7C"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
export const EMPTY_CONFIG = {};
|
|
5
|
+
export function getGlobalDir() {
|
|
6
|
+
return path.join(os.homedir(), ".geomind");
|
|
7
|
+
}
|
|
8
|
+
export function getGlobalAgentDir() {
|
|
9
|
+
return path.join(getGlobalDir(), "agent");
|
|
10
|
+
}
|
|
11
|
+
export function getGlobalConfigPath() {
|
|
12
|
+
return path.join(getGlobalDir(), "config.json");
|
|
13
|
+
}
|
|
14
|
+
export function getProjectDir(cwd = process.cwd()) {
|
|
15
|
+
return path.join(cwd, ".geomind");
|
|
16
|
+
}
|
|
17
|
+
export function getProjectConfigPath(cwd = process.cwd()) {
|
|
18
|
+
return path.join(getProjectDir(cwd), "config.json");
|
|
19
|
+
}
|
|
20
|
+
export function getConfigPath(cwd = process.cwd()) {
|
|
21
|
+
return getProjectConfigPath(cwd);
|
|
22
|
+
}
|
|
23
|
+
export function configExists(cwd = process.cwd()) {
|
|
24
|
+
return fs.existsSync(getProjectConfigPath(cwd)) || fs.existsSync(getGlobalConfigPath());
|
|
25
|
+
}
|
|
26
|
+
export function projectConfigExists(cwd = process.cwd()) {
|
|
27
|
+
return fs.existsSync(getProjectConfigPath(cwd));
|
|
28
|
+
}
|
|
29
|
+
export function globalConfigExists() {
|
|
30
|
+
return fs.existsSync(getGlobalConfigPath());
|
|
31
|
+
}
|
|
32
|
+
export function ensureGlobalLayout() {
|
|
33
|
+
fs.mkdirSync(getGlobalAgentDir(), { recursive: true });
|
|
34
|
+
fs.mkdirSync(path.join(getGlobalDir(), "memory", "user"), { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
export function ensureProjectLayout(cwd = process.cwd()) {
|
|
37
|
+
fs.mkdirSync(path.join(getProjectDir(cwd), "memory", "database"), { recursive: true });
|
|
38
|
+
fs.mkdirSync(path.join(getProjectDir(cwd), "sessions"), { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
export function ensureConfigDir(cwd = process.cwd()) {
|
|
41
|
+
fs.mkdirSync(path.dirname(getProjectConfigPath(cwd)), { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
function isRecord(value) {
|
|
44
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
45
|
+
}
|
|
46
|
+
function optionalString(value) {
|
|
47
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
48
|
+
}
|
|
49
|
+
function optionalPort(value) {
|
|
50
|
+
if (typeof value !== "number" || !Number.isInteger(value))
|
|
51
|
+
return undefined;
|
|
52
|
+
return value > 0 ? value : undefined;
|
|
53
|
+
}
|
|
54
|
+
function normalizePsql(value) {
|
|
55
|
+
if (!isRecord(value))
|
|
56
|
+
return undefined;
|
|
57
|
+
const command = optionalString(value.command);
|
|
58
|
+
const database = optionalString(value.database);
|
|
59
|
+
if (!command || !database)
|
|
60
|
+
return undefined;
|
|
61
|
+
return {
|
|
62
|
+
command,
|
|
63
|
+
database,
|
|
64
|
+
user: optionalString(value.user),
|
|
65
|
+
host: optionalString(value.host),
|
|
66
|
+
port: optionalPort(value.port),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function normalizeQgis(value) {
|
|
70
|
+
if (!isRecord(value))
|
|
71
|
+
return undefined;
|
|
72
|
+
const available = typeof value.available === "boolean" ? value.available : false;
|
|
73
|
+
const qgisPath = optionalString(value.path) ?? "";
|
|
74
|
+
return {
|
|
75
|
+
path: qgisPath,
|
|
76
|
+
available,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function normalizeConfig(value) {
|
|
80
|
+
if (!isRecord(value))
|
|
81
|
+
return EMPTY_CONFIG;
|
|
82
|
+
const config = {};
|
|
83
|
+
const psql = normalizePsql(value.psql);
|
|
84
|
+
const qgisProcess = normalizeQgis(value.qgis_process);
|
|
85
|
+
if (psql)
|
|
86
|
+
config.psql = psql;
|
|
87
|
+
if (qgisProcess)
|
|
88
|
+
config.qgis_process = qgisProcess;
|
|
89
|
+
return config;
|
|
90
|
+
}
|
|
91
|
+
function readConfigFile(filePath) {
|
|
92
|
+
if (!fs.existsSync(filePath))
|
|
93
|
+
return EMPTY_CONFIG;
|
|
94
|
+
try {
|
|
95
|
+
return normalizeConfig(JSON.parse(fs.readFileSync(filePath, "utf-8")));
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return EMPTY_CONFIG;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export function mergeConfig(globalConfig, projectConfig) {
|
|
102
|
+
const config = {};
|
|
103
|
+
if (projectConfig.psql ?? globalConfig.psql) {
|
|
104
|
+
config.psql = projectConfig.psql ?? globalConfig.psql;
|
|
105
|
+
}
|
|
106
|
+
if (projectConfig.qgis_process ?? globalConfig.qgis_process) {
|
|
107
|
+
config.qgis_process = projectConfig.qgis_process ?? globalConfig.qgis_process;
|
|
108
|
+
}
|
|
109
|
+
return config;
|
|
110
|
+
}
|
|
111
|
+
export function loadGlobalConfig() {
|
|
112
|
+
return readConfigFile(getGlobalConfigPath());
|
|
113
|
+
}
|
|
114
|
+
export function loadProjectConfig(cwd = process.cwd()) {
|
|
115
|
+
return readConfigFile(getProjectConfigPath(cwd));
|
|
116
|
+
}
|
|
117
|
+
export function loadConfig(cwd = process.cwd()) {
|
|
118
|
+
return mergeConfig(loadGlobalConfig(), loadProjectConfig(cwd));
|
|
119
|
+
}
|
|
120
|
+
export function writeConfig(config, cwd = process.cwd(), scope = "project") {
|
|
121
|
+
const filePath = scope === "global" ? getGlobalConfigPath() : getProjectConfigPath(cwd);
|
|
122
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
123
|
+
fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`, "utf-8");
|
|
124
|
+
}
|
|
125
|
+
export function writeGlobalConfig(config) {
|
|
126
|
+
writeConfig(config, process.cwd(), "global");
|
|
127
|
+
}
|
|
128
|
+
export function writeProjectConfig(config, cwd = process.cwd()) {
|
|
129
|
+
writeConfig(config, cwd, "project");
|
|
130
|
+
}
|
|
131
|
+
function shellQuote(value) {
|
|
132
|
+
if (/^[A-Za-z0-9_./:=@+-]+$/.test(value))
|
|
133
|
+
return value;
|
|
134
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
135
|
+
}
|
|
136
|
+
export function buildPsqlCommand(config) {
|
|
137
|
+
if (!config.psql)
|
|
138
|
+
return undefined;
|
|
139
|
+
const parts = [shellQuote(config.psql.command)];
|
|
140
|
+
if (config.psql.host) {
|
|
141
|
+
parts.push("-h", shellQuote(config.psql.host));
|
|
142
|
+
}
|
|
143
|
+
if (config.psql.port) {
|
|
144
|
+
parts.push("-p", String(config.psql.port));
|
|
145
|
+
}
|
|
146
|
+
if (config.psql.user) {
|
|
147
|
+
parts.push("-U", shellQuote(config.psql.user));
|
|
148
|
+
}
|
|
149
|
+
if (config.psql.database) {
|
|
150
|
+
parts.push("-d", shellQuote(config.psql.database));
|
|
151
|
+
}
|
|
152
|
+
return parts.join(" ");
|
|
153
|
+
}
|
|
154
|
+
export function migrateLegacyPiAuth() {
|
|
155
|
+
const geomindAuthPath = path.join(getGlobalAgentDir(), "auth.json");
|
|
156
|
+
const piAuthPath = path.join(os.homedir(), ".pi", "agent", "auth.json");
|
|
157
|
+
if (fs.existsSync(geomindAuthPath) || !fs.existsSync(piAuthPath))
|
|
158
|
+
return false;
|
|
159
|
+
fs.mkdirSync(path.dirname(geomindAuthPath), { recursive: true });
|
|
160
|
+
fs.copyFileSync(piAuthPath, geomindAuthPath);
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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AAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAExE,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/E,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, InteractiveMode, SessionManager, } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import { getGlobalAgentDir, getProjectDir, loadConfig } from "./config.js";
|
|
7
|
+
import { getSystemPrompt } from "./prompts/system.js";
|
|
8
|
+
import { ensureRuntimeEnvironment } from "./setup.js";
|
|
9
|
+
const GEOMIND_CWD = process.cwd();
|
|
10
|
+
const GEOMIND_AGENT_DIR = getGlobalAgentDir();
|
|
11
|
+
const EXTENSION_FILES = ["memory.ts", "setup.ts"];
|
|
12
|
+
/**
|
|
13
|
+
* Patch Pi Agent branding to GeoMind at runtime.
|
|
14
|
+
* This replaces the postinstall script to avoid npm install failures
|
|
15
|
+
* on systems where `sh` is not available or scripts are skipped.
|
|
16
|
+
*/
|
|
17
|
+
function ensureBranding() {
|
|
18
|
+
const packageRoot = getPackageRoot();
|
|
19
|
+
const candidates = [];
|
|
20
|
+
// npm layout: node_modules/@earendil-works/pi-coding-agent/package.json
|
|
21
|
+
const directPath = path.join(packageRoot, "node_modules", "@earendil-works", "pi-coding-agent", "package.json");
|
|
22
|
+
if (fs.existsSync(directPath))
|
|
23
|
+
candidates.push(directPath);
|
|
24
|
+
// pnpm layout: node_modules/.pnpm/@earendil-works+pi-coding-agent@*/...
|
|
25
|
+
const pnpmDir = path.join(packageRoot, "node_modules", ".pnpm");
|
|
26
|
+
if (fs.existsSync(pnpmDir)) {
|
|
27
|
+
try {
|
|
28
|
+
for (const dir of fs.readdirSync(pnpmDir)) {
|
|
29
|
+
if (dir.startsWith("@earendil-works+pi-coding-agent@")) {
|
|
30
|
+
candidates.push(path.join(pnpmDir, dir, "node_modules", "@earendil-works", "pi-coding-agent", "package.json"));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch { /* ignore read errors */ }
|
|
35
|
+
}
|
|
36
|
+
for (const pkgPath of candidates) {
|
|
37
|
+
if (!fs.existsSync(pkgPath))
|
|
38
|
+
continue;
|
|
39
|
+
try {
|
|
40
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
41
|
+
if (pkg.piConfig?.name === "GeoMind")
|
|
42
|
+
continue; // already patched
|
|
43
|
+
if (!pkg.piConfig)
|
|
44
|
+
pkg.piConfig = {};
|
|
45
|
+
pkg.piConfig.name = "GeoMind";
|
|
46
|
+
pkg.piConfig.configDir = ".geomind";
|
|
47
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
48
|
+
}
|
|
49
|
+
catch { /* ignore write errors */ }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function getPackageRoot() {
|
|
53
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
54
|
+
return path.basename(currentDir) === "dist" || path.basename(currentDir) === "src"
|
|
55
|
+
? path.dirname(currentDir)
|
|
56
|
+
: currentDir;
|
|
57
|
+
}
|
|
58
|
+
function ensureExtensions(cwd) {
|
|
59
|
+
const packageExtensionDir = path.join(getPackageRoot(), ".geomind", "extensions");
|
|
60
|
+
const projectExtensionDir = path.join(getProjectDir(cwd), "extensions");
|
|
61
|
+
fs.mkdirSync(projectExtensionDir, { recursive: true });
|
|
62
|
+
for (const fileName of EXTENSION_FILES) {
|
|
63
|
+
const sourcePath = path.join(packageExtensionDir, fileName);
|
|
64
|
+
const targetPath = path.join(projectExtensionDir, fileName);
|
|
65
|
+
if (fs.existsSync(targetPath))
|
|
66
|
+
continue;
|
|
67
|
+
if (!fs.existsSync(sourcePath)) {
|
|
68
|
+
throw new Error(`Bundled GeoMind extension not found: ${sourcePath}`);
|
|
69
|
+
}
|
|
70
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function main() {
|
|
74
|
+
ensureBranding();
|
|
75
|
+
const authMigrated = ensureRuntimeEnvironment(GEOMIND_CWD);
|
|
76
|
+
ensureExtensions(GEOMIND_CWD);
|
|
77
|
+
if (authMigrated) {
|
|
78
|
+
console.log("Copied existing Pi auth to ~/.geomind/agent/auth.json");
|
|
79
|
+
}
|
|
80
|
+
const createRuntime = async ({ cwd, sessionManager, sessionStartEvent, }) => {
|
|
81
|
+
const services = await createAgentSessionServices({
|
|
82
|
+
cwd,
|
|
83
|
+
agentDir: GEOMIND_AGENT_DIR,
|
|
84
|
+
resourceLoaderOptions: {
|
|
85
|
+
systemPromptOverride: () => getSystemPrompt(loadConfig(cwd)),
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
...(await createAgentSessionFromServices({
|
|
90
|
+
services,
|
|
91
|
+
sessionManager,
|
|
92
|
+
sessionStartEvent,
|
|
93
|
+
})),
|
|
94
|
+
services,
|
|
95
|
+
diagnostics: services.diagnostics,
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
99
|
+
cwd: GEOMIND_CWD,
|
|
100
|
+
agentDir: GEOMIND_AGENT_DIR,
|
|
101
|
+
sessionManager: SessionManager.create(GEOMIND_CWD, path.join(getProjectDir(GEOMIND_CWD), "sessions")),
|
|
102
|
+
});
|
|
103
|
+
const mode = new InteractiveMode(runtime, {
|
|
104
|
+
migratedProviders: [],
|
|
105
|
+
modelFallbackMessage: undefined,
|
|
106
|
+
initialMessage: undefined,
|
|
107
|
+
initialImages: [],
|
|
108
|
+
initialMessages: [],
|
|
109
|
+
});
|
|
110
|
+
await mode.run();
|
|
111
|
+
}
|
|
112
|
+
main().catch((err) => {
|
|
113
|
+
console.error("GeoMind failed to start:", err);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAEL,8BAA8B,EAC9B,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAClC,MAAM,iBAAiB,GAAG,iBAAiB,EAAE,CAAC;AAC9C,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,UAAU,CAAU,CAAC;AAE3D;;;;GAIG;AACH,SAAS,cAAc;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