mingdao-harness 0.1.61 → 0.1.63

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mingdao-harness",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "description": "MingDao Harness —— 开源智能体框架(Agent Harness)。零依赖、开箱即用,针对 DeepSeek-V4 系列优化,开放主流模型接入。",
5
5
  "type": "module",
6
6
  "bin": {
package/src/config.js CHANGED
@@ -33,6 +33,26 @@ export function loadConfig() {
33
33
  }
34
34
  }
35
35
 
36
+ /** 桌面版首次运行:无配置时自动创建最小可用配置(引导在 WebUI 内完成,
37
+ * 不再要求先去终端跑 mingdao init)。CLI 的 mingdao init 向导不受影响。 */
38
+ export function ensureMinimalConfig() {
39
+ const existing = loadConfig();
40
+ if (existing) return existing;
41
+ ensureHome();
42
+ const pp = PROVIDERS['deepseek'] || Object.values(PROVIDERS)[0];
43
+ const model = modelPreset('deepseek-v4-flash') ? 'deepseek-v4-flash' : pp.models[0];
44
+ const cfg = {
45
+ provider: 'deepseek',
46
+ model,
47
+ baseUrl: pp.baseUrl,
48
+ permission: 'ask',
49
+ sandbox: 'off',
50
+ contextBudget: 128000,
51
+ };
52
+ saveConfig(cfg);
53
+ return cfg;
54
+ }
55
+
36
56
  export function saveConfig(cfg) {
37
57
  ensureHome();
38
58
  const p = configPath();
@@ -666,6 +666,10 @@ async function init(){
666
666
  $('#notifyChk').checked=j.notify!==false;
667
667
  const env = ('路由'+(j.routing?'开':'关')+' · 沙箱'+((j.sandbox&&j.sandbox!=='off')?(j.sandboxSupported?j.sandbox:'降级'):'off'));
668
668
  $('#envBadge').textContent=env; $('#envBadge').style.display='';
669
+ // 首次使用引导:无 API Key 时明确提示去设置(桌面版自动初始化后必走这里)
670
+ if (j.keyReady === false) {
671
+ renderBanner({ text: '🔑 欢迎使用 MingDao Harness!还没有配置 API Key:请点击右上角 ⚙ 设置 →「模型与 API Key」选择模型并填入密钥(DeepSeek 平台申请)后即可对话。' });
672
+ }
669
673
  }catch(e){
670
674
  const ms=$('#modelSel'); if(!ms.options.length){ const o=document.createElement('option'); o.textContent='加载失败,刷新重试'; ms.appendChild(o); }
671
675
  }
package/src/web/server.js CHANGED
@@ -463,6 +463,8 @@ export async function runWebServer({ host = '127.0.0.1', port = 3820, authToken
463
463
  ok: true,
464
464
  model: modelName,
465
465
  models,
466
+ // 首次使用引导:当前模型无可用 API Key 时前端显示「去 ⚙ 设置填 Key」横幅
467
+ keyReady: Boolean((resolveProviderConfig(cfg, modelName) || {}).apiKey),
466
468
  permissions: ['ask', 'auto', 'readonly'],
467
469
  permission: cfg.permission ?? 'ask',
468
470
  sandbox: cfg.sandbox || 'off',