codexmate 0.0.18 → 0.0.19
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.en.md +28 -15
- package/README.md +28 -23
- package/cli.js +498 -319
- package/package.json +1 -1
- package/web-ui/app.js +36 -260
- package/web-ui/index.html +274 -122
- package/web-ui/modules/config-mode.computed.mjs +1 -0
- package/web-ui/modules/skills.computed.mjs +26 -1
- package/web-ui/modules/skills.methods.mjs +154 -23
- package/web-ui/session-helpers.mjs +12 -0
- package/web-ui/styles.css +171 -2
- package/doc/CHANGELOG.md +0 -32
- package/doc/CHANGELOG.zh-CN.md +0 -34
package/package.json
CHANGED
package/web-ui/app.js
CHANGED
|
@@ -144,6 +144,8 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
144
144
|
confirmDialogConfirmText: '确认',
|
|
145
145
|
confirmDialogCancelText: '取消',
|
|
146
146
|
confirmDialogDanger: false,
|
|
147
|
+
confirmDialogConfirmDisabled: false,
|
|
148
|
+
confirmDialogDisableWhen: null,
|
|
147
149
|
confirmDialogResolver: null,
|
|
148
150
|
configTemplateContent: '',
|
|
149
151
|
configTemplateApplying: false,
|
|
@@ -170,6 +172,7 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
170
172
|
agentsContext: 'codex',
|
|
171
173
|
agentsModalTitle: 'AGENTS.md 编辑器',
|
|
172
174
|
agentsModalHint: '保存后会写入目标 AGENTS.md(与 config.toml 同级)。',
|
|
175
|
+
skillsTargetApp: 'codex',
|
|
173
176
|
skillsRootPath: '',
|
|
174
177
|
skillsList: [],
|
|
175
178
|
skillsSelectedNames: [],
|
|
@@ -183,6 +186,9 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
183
186
|
skillsImporting: false,
|
|
184
187
|
skillsZipImporting: false,
|
|
185
188
|
skillsExporting: false,
|
|
189
|
+
skillsMarketLoading: false,
|
|
190
|
+
skillsMarketLocalLoadedOnce: false,
|
|
191
|
+
skillsMarketImportLoadedOnce: false,
|
|
186
192
|
sessionPinnedMap: {},
|
|
187
193
|
sessionsList: [],
|
|
188
194
|
sessionsLoadedOnce: false,
|
|
@@ -375,24 +381,6 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
375
381
|
claudeImportLoading: false,
|
|
376
382
|
codexImportLoading: false,
|
|
377
383
|
codexAuthProfiles: [],
|
|
378
|
-
codexAuthImportLoading: false,
|
|
379
|
-
codexAuthSwitching: {},
|
|
380
|
-
codexAuthDeleting: {},
|
|
381
|
-
proxySettings: {
|
|
382
|
-
enabled: false,
|
|
383
|
-
host: '127.0.0.1',
|
|
384
|
-
port: 8318,
|
|
385
|
-
provider: '',
|
|
386
|
-
authSource: 'provider',
|
|
387
|
-
timeoutMs: 30000
|
|
388
|
-
},
|
|
389
|
-
proxyRuntime: null,
|
|
390
|
-
proxyLoading: false,
|
|
391
|
-
proxySaving: false,
|
|
392
|
-
proxyStarting: false,
|
|
393
|
-
proxyStopping: false,
|
|
394
|
-
proxyApplying: false,
|
|
395
|
-
showProxyAdvanced: false,
|
|
396
384
|
forceCompactLayout: false
|
|
397
385
|
}
|
|
398
386
|
},
|
|
@@ -576,19 +564,16 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
576
564
|
}
|
|
577
565
|
return list;
|
|
578
566
|
},
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
return
|
|
585
|
-
},
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
? this.proxyRuntime.provider.trim()
|
|
590
|
-
: '';
|
|
591
|
-
return value || 'local';
|
|
567
|
+
hasLocalAndProxy() {
|
|
568
|
+
return false;
|
|
569
|
+
},
|
|
570
|
+
displayCurrentProvider() {
|
|
571
|
+
const current = String(this.currentProvider || '').trim();
|
|
572
|
+
return current;
|
|
573
|
+
},
|
|
574
|
+
displayProvidersList() {
|
|
575
|
+
const list = Array.isArray(this.providersList) ? this.providersList : [];
|
|
576
|
+
return list.filter((item) => String(item && item.name ? item.name : '').trim().toLowerCase() !== 'codexmate-proxy');
|
|
592
577
|
},
|
|
593
578
|
installTargetCards() {
|
|
594
579
|
const targets = Array.isArray(this.installStatusTargets) ? this.installStatusTargets : [];
|
|
@@ -639,7 +624,6 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
639
624
|
if (this.codexApplying || this.configTemplateApplying || this.openclawApplying) tasks.push('配置应用');
|
|
640
625
|
if (this.agentsSaving) tasks.push('AGENTS 保存');
|
|
641
626
|
if (this.skillsLoading || this.skillsDeleting || this.skillsScanningImports || this.skillsImporting || this.skillsZipImporting || this.skillsExporting) tasks.push('Skills 管理');
|
|
642
|
-
if (this.proxySaving || this.proxyApplying || this.proxyStarting || this.proxyStopping) tasks.push('代理更新');
|
|
643
627
|
return tasks.length ? tasks.join(' / ') : '空闲';
|
|
644
628
|
},
|
|
645
629
|
inspectorMessageSummary() {
|
|
@@ -679,15 +663,6 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
679
663
|
}
|
|
680
664
|
return '正常';
|
|
681
665
|
},
|
|
682
|
-
inspectorProxyStatus() {
|
|
683
|
-
if (this.proxySaving || this.proxyApplying || this.proxyStarting || this.proxyStopping) {
|
|
684
|
-
return '状态更新中';
|
|
685
|
-
}
|
|
686
|
-
if (this.proxyRuntime && this.proxyRuntime.running === true) {
|
|
687
|
-
return `运行中(${this.proxyRuntimeDisplayProvider})`;
|
|
688
|
-
}
|
|
689
|
-
return '未运行';
|
|
690
|
-
},
|
|
691
666
|
installTroubleshootingTips() {
|
|
692
667
|
const platform = this.resolveInstallPlatform();
|
|
693
668
|
if (platform === 'win32') {
|
|
@@ -751,12 +726,9 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
751
726
|
}
|
|
752
727
|
|
|
753
728
|
try {
|
|
754
|
-
await
|
|
755
|
-
this.loadCodexAuthProfiles(),
|
|
756
|
-
this.loadProxyStatus()
|
|
757
|
-
]);
|
|
729
|
+
await this.loadCodexAuthProfiles();
|
|
758
730
|
} catch (e) {
|
|
759
|
-
//
|
|
731
|
+
// 认证状态加载失败不阻塞主界面
|
|
760
732
|
}
|
|
761
733
|
},
|
|
762
734
|
|
|
@@ -3550,6 +3522,7 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
3550
3522
|
if (typeof this.confirmDialogResolver === 'function') {
|
|
3551
3523
|
this.confirmDialogResolver(false);
|
|
3552
3524
|
}
|
|
3525
|
+
const confirmDisabled = options.confirmDisabled;
|
|
3553
3526
|
this.confirmDialogTitle = typeof options.title === 'string' && options.title.trim()
|
|
3554
3527
|
? options.title.trim()
|
|
3555
3528
|
: '请确认操作';
|
|
@@ -3561,11 +3534,23 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
3561
3534
|
? options.cancelText.trim()
|
|
3562
3535
|
: '取消';
|
|
3563
3536
|
this.confirmDialogDanger = !!options.danger;
|
|
3537
|
+
this.confirmDialogConfirmDisabled = typeof confirmDisabled === 'function' ? false : !!confirmDisabled;
|
|
3538
|
+
this.confirmDialogDisableWhen = typeof confirmDisabled === 'function' ? confirmDisabled : null;
|
|
3564
3539
|
this.showConfirmDialog = true;
|
|
3565
3540
|
return new Promise((resolve) => {
|
|
3566
3541
|
this.confirmDialogResolver = resolve;
|
|
3567
3542
|
});
|
|
3568
3543
|
},
|
|
3544
|
+
isConfirmDialogDisabled() {
|
|
3545
|
+
if (typeof this.confirmDialogDisableWhen === 'function') {
|
|
3546
|
+
try {
|
|
3547
|
+
return !!this.confirmDialogDisableWhen.call(this);
|
|
3548
|
+
} catch (_) {
|
|
3549
|
+
return true;
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
return !!this.confirmDialogConfirmDisabled;
|
|
3553
|
+
},
|
|
3569
3554
|
resolveConfirmDialog(confirmed) {
|
|
3570
3555
|
const resolver = typeof this.confirmDialogResolver === 'function'
|
|
3571
3556
|
? this.confirmDialogResolver
|
|
@@ -3576,6 +3561,8 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
3576
3561
|
this.confirmDialogConfirmText = '确认';
|
|
3577
3562
|
this.confirmDialogCancelText = '取消';
|
|
3578
3563
|
this.confirmDialogDanger = false;
|
|
3564
|
+
this.confirmDialogConfirmDisabled = false;
|
|
3565
|
+
this.confirmDialogDisableWhen = null;
|
|
3579
3566
|
this.confirmDialogResolver = null;
|
|
3580
3567
|
if (resolver) {
|
|
3581
3568
|
resolver(!!confirmed);
|
|
@@ -3827,7 +3814,7 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
3827
3814
|
? String(providerOrName.name || '')
|
|
3828
3815
|
: String(providerOrName);
|
|
3829
3816
|
const normalized = rawName.trim().toLowerCase();
|
|
3830
|
-
return normalized === 'local'
|
|
3817
|
+
return normalized === 'local';
|
|
3831
3818
|
},
|
|
3832
3819
|
|
|
3833
3820
|
providerPillState(provider) {
|
|
@@ -3867,7 +3854,7 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
3867
3854
|
if (!providerOrName) return false;
|
|
3868
3855
|
if (typeof providerOrName === 'object') {
|
|
3869
3856
|
const directName = String(providerOrName.name || '').trim().toLowerCase();
|
|
3870
|
-
if (directName === 'local'
|
|
3857
|
+
if (directName === 'local') {
|
|
3871
3858
|
return true;
|
|
3872
3859
|
}
|
|
3873
3860
|
return !!providerOrName.nonDeletable;
|
|
@@ -3875,7 +3862,7 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
3875
3862
|
const name = String(providerOrName).trim();
|
|
3876
3863
|
if (!name) return false;
|
|
3877
3864
|
const normalized = name.toLowerCase();
|
|
3878
|
-
if (normalized === 'local'
|
|
3865
|
+
if (normalized === 'local') {
|
|
3879
3866
|
return true;
|
|
3880
3867
|
}
|
|
3881
3868
|
const target = (this.providersList || []).find((item) => item && item.name === name);
|
|
@@ -5547,215 +5534,6 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
5547
5534
|
}
|
|
5548
5535
|
},
|
|
5549
5536
|
|
|
5550
|
-
triggerCodexAuthUpload() {
|
|
5551
|
-
const input = this.$refs.codexAuthImportInput;
|
|
5552
|
-
if (input) {
|
|
5553
|
-
input.value = '';
|
|
5554
|
-
input.click();
|
|
5555
|
-
}
|
|
5556
|
-
},
|
|
5557
|
-
|
|
5558
|
-
handleCodexAuthImportChange(event) {
|
|
5559
|
-
const file = event && event.target && event.target.files ? event.target.files[0] : null;
|
|
5560
|
-
if (file) {
|
|
5561
|
-
void this.importCodexAuthFile(file);
|
|
5562
|
-
}
|
|
5563
|
-
},
|
|
5564
|
-
|
|
5565
|
-
resetCodexAuthImportInput() {
|
|
5566
|
-
const el = this.$refs.codexAuthImportInput;
|
|
5567
|
-
if (el) {
|
|
5568
|
-
el.value = '';
|
|
5569
|
-
}
|
|
5570
|
-
},
|
|
5571
|
-
|
|
5572
|
-
async importCodexAuthFile(file) {
|
|
5573
|
-
this.codexAuthImportLoading = true;
|
|
5574
|
-
try {
|
|
5575
|
-
const base64 = await this.readFileAsBase64(file);
|
|
5576
|
-
const res = await api('import-auth-profile', {
|
|
5577
|
-
fileName: file.name || 'codex-auth.json',
|
|
5578
|
-
fileBase64: base64,
|
|
5579
|
-
activate: true
|
|
5580
|
-
});
|
|
5581
|
-
if (res && res.error) {
|
|
5582
|
-
this.showMessage(res.error, 'error');
|
|
5583
|
-
return;
|
|
5584
|
-
}
|
|
5585
|
-
await this.loadCodexAuthProfiles({ silent: true });
|
|
5586
|
-
this.showMessage('认证文件已导入并切换', 'success');
|
|
5587
|
-
} catch (e) {
|
|
5588
|
-
this.showMessage('导入认证文件失败', 'error');
|
|
5589
|
-
} finally {
|
|
5590
|
-
this.codexAuthImportLoading = false;
|
|
5591
|
-
this.resetCodexAuthImportInput();
|
|
5592
|
-
}
|
|
5593
|
-
},
|
|
5594
|
-
|
|
5595
|
-
async switchCodexAuthProfile(name) {
|
|
5596
|
-
const key = String(name || '').trim();
|
|
5597
|
-
if (!key || this.codexAuthSwitching[key]) return;
|
|
5598
|
-
this.codexAuthSwitching[key] = true;
|
|
5599
|
-
try {
|
|
5600
|
-
const res = await api('switch-auth-profile', { name: key });
|
|
5601
|
-
if (res && res.error) {
|
|
5602
|
-
this.showMessage(res.error, 'error');
|
|
5603
|
-
return;
|
|
5604
|
-
}
|
|
5605
|
-
await this.loadCodexAuthProfiles({ silent: true });
|
|
5606
|
-
this.showMessage(`已切换认证: ${key}`, 'success');
|
|
5607
|
-
} catch (e) {
|
|
5608
|
-
this.showMessage('切换认证失败', 'error');
|
|
5609
|
-
} finally {
|
|
5610
|
-
this.codexAuthSwitching[key] = false;
|
|
5611
|
-
}
|
|
5612
|
-
},
|
|
5613
|
-
|
|
5614
|
-
async deleteCodexAuthProfile(name) {
|
|
5615
|
-
const key = String(name || '').trim();
|
|
5616
|
-
if (!key || this.codexAuthDeleting[key]) return;
|
|
5617
|
-
this.codexAuthDeleting[key] = true;
|
|
5618
|
-
try {
|
|
5619
|
-
const res = await api('delete-auth-profile', { name: key });
|
|
5620
|
-
if (res && res.error) {
|
|
5621
|
-
this.showMessage(res.error, 'error');
|
|
5622
|
-
return;
|
|
5623
|
-
}
|
|
5624
|
-
await this.loadCodexAuthProfiles({ silent: true });
|
|
5625
|
-
const switchedTip = res && res.switchedTo ? `,已切换到 ${res.switchedTo}` : '';
|
|
5626
|
-
this.showMessage(`已删除认证${switchedTip}`, 'success');
|
|
5627
|
-
} catch (e) {
|
|
5628
|
-
this.showMessage('删除认证失败', 'error');
|
|
5629
|
-
} finally {
|
|
5630
|
-
this.codexAuthDeleting[key] = false;
|
|
5631
|
-
}
|
|
5632
|
-
},
|
|
5633
|
-
|
|
5634
|
-
mergeProxySettings(nextSettings) {
|
|
5635
|
-
const safe = nextSettings && typeof nextSettings === 'object' ? nextSettings : {};
|
|
5636
|
-
const port = parseInt(String(safe.port), 10);
|
|
5637
|
-
const timeoutMs = parseInt(String(safe.timeoutMs), 10);
|
|
5638
|
-
this.proxySettings = {
|
|
5639
|
-
enabled: safe.enabled !== false,
|
|
5640
|
-
host: typeof safe.host === 'string' && safe.host.trim() ? safe.host.trim() : '127.0.0.1',
|
|
5641
|
-
port: Number.isFinite(port) ? port : 8318,
|
|
5642
|
-
provider: typeof safe.provider === 'string' ? safe.provider.trim() : '',
|
|
5643
|
-
authSource: safe.authSource === 'profile' || safe.authSource === 'none' ? safe.authSource : 'provider',
|
|
5644
|
-
timeoutMs: Number.isFinite(timeoutMs) ? timeoutMs : 30000
|
|
5645
|
-
};
|
|
5646
|
-
},
|
|
5647
|
-
|
|
5648
|
-
async loadProxyStatus(options = {}) {
|
|
5649
|
-
const silent = !!options.silent;
|
|
5650
|
-
this.proxyLoading = true;
|
|
5651
|
-
try {
|
|
5652
|
-
const res = await api('proxy-status');
|
|
5653
|
-
if (res && res.error) {
|
|
5654
|
-
if (!silent) {
|
|
5655
|
-
this.showMessage(res.error, 'error');
|
|
5656
|
-
}
|
|
5657
|
-
return;
|
|
5658
|
-
}
|
|
5659
|
-
this.mergeProxySettings(res && res.settings ? res.settings : {});
|
|
5660
|
-
this.proxyRuntime = res && res.runtime ? { running: true, ...res.runtime } : null;
|
|
5661
|
-
} catch (e) {
|
|
5662
|
-
if (!silent) {
|
|
5663
|
-
this.showMessage('读取代理状态失败', 'error');
|
|
5664
|
-
}
|
|
5665
|
-
} finally {
|
|
5666
|
-
this.proxyLoading = false;
|
|
5667
|
-
}
|
|
5668
|
-
},
|
|
5669
|
-
|
|
5670
|
-
async saveProxySettings(options = {}) {
|
|
5671
|
-
const silent = !!options.silent;
|
|
5672
|
-
this.proxySaving = true;
|
|
5673
|
-
try {
|
|
5674
|
-
const res = await api('proxy-save-config', this.proxySettings);
|
|
5675
|
-
if (res && res.error) {
|
|
5676
|
-
if (!silent) {
|
|
5677
|
-
this.showMessage(res.error, 'error');
|
|
5678
|
-
}
|
|
5679
|
-
return;
|
|
5680
|
-
}
|
|
5681
|
-
if (res && res.settings) {
|
|
5682
|
-
this.mergeProxySettings(res.settings);
|
|
5683
|
-
}
|
|
5684
|
-
if (!silent) {
|
|
5685
|
-
this.showMessage('代理配置已保存', 'success');
|
|
5686
|
-
}
|
|
5687
|
-
} catch (e) {
|
|
5688
|
-
if (!silent) {
|
|
5689
|
-
this.showMessage('保存代理配置失败', 'error');
|
|
5690
|
-
}
|
|
5691
|
-
} finally {
|
|
5692
|
-
this.proxySaving = false;
|
|
5693
|
-
}
|
|
5694
|
-
},
|
|
5695
|
-
|
|
5696
|
-
async startBuiltinProxy() {
|
|
5697
|
-
this.proxyStarting = true;
|
|
5698
|
-
try {
|
|
5699
|
-
const res = await api('proxy-start', {
|
|
5700
|
-
...this.proxySettings,
|
|
5701
|
-
enabled: true
|
|
5702
|
-
});
|
|
5703
|
-
if (res && res.error) {
|
|
5704
|
-
this.showMessage(res.error, 'error');
|
|
5705
|
-
return;
|
|
5706
|
-
}
|
|
5707
|
-
if (res && res.settings) {
|
|
5708
|
-
this.mergeProxySettings(res.settings);
|
|
5709
|
-
}
|
|
5710
|
-
await this.loadProxyStatus({ silent: true });
|
|
5711
|
-
const listenTip = res && res.listenUrl ? `:${res.listenUrl}` : '';
|
|
5712
|
-
this.showMessage(`代理已启动${listenTip}`, 'success');
|
|
5713
|
-
} catch (e) {
|
|
5714
|
-
this.showMessage('启动代理失败', 'error');
|
|
5715
|
-
} finally {
|
|
5716
|
-
this.proxyStarting = false;
|
|
5717
|
-
}
|
|
5718
|
-
},
|
|
5719
|
-
|
|
5720
|
-
async stopBuiltinProxy() {
|
|
5721
|
-
this.proxyStopping = true;
|
|
5722
|
-
try {
|
|
5723
|
-
const res = await api('proxy-stop');
|
|
5724
|
-
if (res && res.error) {
|
|
5725
|
-
this.showMessage(res.error, 'error');
|
|
5726
|
-
return;
|
|
5727
|
-
}
|
|
5728
|
-
await this.loadProxyStatus({ silent: true });
|
|
5729
|
-
this.showMessage('代理已停止', 'success');
|
|
5730
|
-
} catch (e) {
|
|
5731
|
-
this.showMessage('停止代理失败', 'error');
|
|
5732
|
-
} finally {
|
|
5733
|
-
this.proxyStopping = false;
|
|
5734
|
-
}
|
|
5735
|
-
},
|
|
5736
|
-
|
|
5737
|
-
async applyBuiltinProxyProvider() {
|
|
5738
|
-
this.proxyApplying = true;
|
|
5739
|
-
try {
|
|
5740
|
-
const saveRes = await api('proxy-save-config', this.proxySettings);
|
|
5741
|
-
if (saveRes && saveRes.error) {
|
|
5742
|
-
this.showMessage(saveRes.error, 'error');
|
|
5743
|
-
return;
|
|
5744
|
-
}
|
|
5745
|
-
const res = await api('proxy-apply-provider', { switchToProxy: true });
|
|
5746
|
-
if (res && res.error) {
|
|
5747
|
-
this.showMessage(res.error, 'error');
|
|
5748
|
-
return;
|
|
5749
|
-
}
|
|
5750
|
-
await this.loadAll();
|
|
5751
|
-
this.showMessage('本地代理 provider 已写入并切换', 'success');
|
|
5752
|
-
} catch (e) {
|
|
5753
|
-
this.showMessage('应用代理 provider 失败', 'error');
|
|
5754
|
-
} finally {
|
|
5755
|
-
this.proxyApplying = false;
|
|
5756
|
-
}
|
|
5757
|
-
},
|
|
5758
|
-
|
|
5759
5537
|
showMessage(text, type) {
|
|
5760
5538
|
this.message = text;
|
|
5761
5539
|
this.messageType = type || 'info';
|
|
@@ -5768,5 +5546,3 @@ import { createSkillsMethods } from './modules/skills.methods.mjs';
|
|
|
5768
5546
|
|
|
5769
5547
|
app.mount('#app');
|
|
5770
5548
|
});
|
|
5771
|
-
|
|
5772
|
-
|