@danceiny/gotry 0.0.1-rc.6 → 0.0.1-rc.7

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/README.md CHANGED
@@ -260,7 +260,7 @@ npm pack --dry-run --registry=https://registry.npmjs.org/
260
260
  npm publish --access public --registry=https://registry.npmjs.org/
261
261
 
262
262
  # 5. 发布成功后任何用户:
263
- npx @danceiny/gotry web # 一行启动(0.0.1-rc.5 已发 npmjs)
263
+ npx @danceiny/gotry web # 一行启动(0.0.1-rc.6;rc.5 runtime 不可用)
264
264
  ```
265
265
 
266
266
  > ⚠️ **注意**: publish 后**不可逆**(30 天内可 `npm unpublish` 但会污染历史)。建议先在 main 打 `v0.0.1-rc.3` tag + GitHub release,再 publish,保证 npm 包与仓库 tag 同步。
@@ -28,14 +28,20 @@ const repoRoot = join(here, '..')
28
28
  const require_ = createRequire(import.meta.url)
29
29
 
30
30
  // --- 环境 .env 加载(provider-neutral) ---
31
- const envPath = join(repoRoot, '.env')
32
- if (existsSync(envPath)) {
33
- for (const line of readFileSync(envPath, 'utf-8').split('\n')) {
34
- const m = line.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/i)
35
- if (!m || line.trim().startsWith('#')) continue
36
- const k = m[1]; const v = m[2].trim().replace(/^["']|["']$/g, '')
37
- if (process.env[k] === undefined) process.env[k] = v
38
- }
31
+ // npm 安装模式优先读用户当前目录的 .env(包目录内不该有凭证);repo 检出读仓根。
32
+ const vendoredDshEarly = existsSync(join(repoRoot, 'ts/dsh-runtime/node_modules/@deepseek-ai/dsh/lib/bin.js'))
33
+ const envCandidates = vendoredDshEarly
34
+ ? [join(repoRoot, '.env')]
35
+ : [join(process.cwd(), '.env'), join(repoRoot, '.env')]
36
+ const envLines = []
37
+ for (const p of envCandidates) {
38
+ if (existsSync(p)) envLines.push(...readFileSync(p, 'utf-8').split('\n'))
39
+ }
40
+ for (const line of envLines) {
41
+ const m = line.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/i)
42
+ if (!m || line.trim().startsWith('#')) continue
43
+ const k = m[1]; const v = m[2].trim().replace(/^["']|["']$/g, '')
44
+ if (process.env[k] === undefined) process.env[k] = v
39
45
  }
40
46
  if (process.env.LLM_API_KEY && !process.env.DEEPSEEK_API_KEY) {
41
47
  process.env.DEEPSEEK_API_KEY = process.env.LLM_API_KEY
@@ -111,7 +117,9 @@ const patchRaw = readFileSync(staticPatch, 'utf-8')
111
117
  const patchPath = join(tmpdir(), `cordis.gotry.${process.pid}.yml`)
112
118
  writeFileSync(patchPath, patchRaw)
113
119
  if (!process.env.DEEPSEEK_API_KEY && mode !== 'help') {
114
- console.error('[gotry] 需要 DEEPSEEK_API_KEY(或 LLM_API_KEY)— 检查 .env 或环境变量。')
120
+ console.error('[gotry] 缺少 LLM API key —— 两种方式任选其一后重跑:')
121
+ console.error(` 1) 在当前目录创建 .env 写入一行: LLM_API_KEY=<你的 DeepSeek key>(key 从 https://platform.deepseek.com 获取)`)
122
+ console.error(' 2) 或临时环境变量: export LLM_API_KEY=<key>')
115
123
  process.exit(1)
116
124
  }
117
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danceiny/gotry",
3
- "version": "0.0.1-rc.6",
3
+ "version": "0.0.1-rc.7",
4
4
  "description": "GoTry — 从出发到下一次出发的 AI 旅行 Agent(dsh 插件)。npm 包入口 + vendored dsh runtime + 5 行 README 安装路径。",
5
5
  "type": "module",
6
6
  "main": "ts/src/index.ts",