Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

Gate marketplace installs by app version

wyt6e52077baf18
diff --git a/src/main/features/marketplace.ts b/src/main/features/marketplace.ts
index 29846bd5..09380220 100644
--- a/src/main/features/marketplace.ts
+++ b/src/main/features/marketplace.ts
@@ -444,6 +444,7 @@ function _assertMarketplaceAppCompatible(kind: MarketplaceInstallKind, id: strin
id,
name,
`requires Orkas >= ${min}; current ${current || 'unknown'}`,
+ { appUpdateRequired: true, minAppVersion: min, currentAppVersion: current || '' },
);
}
@@ -457,8 +458,19 @@ export class MarketplaceInstallError extends Error {
marketplaceId: string;
marketplaceName: string;
marketplaceReason: string;
-
- constructor(kind: MarketplaceInstallKind, id: string, name: string | undefined, reason: string) {
+ /** Set when the install was blocked because the client app is older than
+ * the item's min_app_version. The renderer can then show localized copy. */
+ appUpdateRequired = false;
+ minAppVersion = '';
+ currentAppVersion = '';
+
+ constructor(
+ kind: MarketplaceInstallKind,
+ id: string,
+ name: string | undefined,
+ reason: string,
+ extra?: { appUpdateRequired?: boolean; minAppVersion?: string; currentAppVersion?: string },
+ ) {
const label = kind === 'agent' ? 'agent' : 'skill';
const cleanName = String(name || '').trim();
const displayName = cleanName || (id || '').trim();
@@ -468,6 +480,9 @@ export class MarketplaceInstallError extends Error {
this.marketplaceId = id;
this.marketplaceName = cleanName;
this.marketplaceReason = reason;
+ if (extra?.appUpdateRequired) this.appUpdateRequired = true;
+ if (extra?.minAppVersion) this.minAppVersion = extra.minAppVersion;
+ if (extra?.currentAppVersion) this.currentAppVersion = extra.currentAppVersion;
}
}
@@ -477,6 +492,9 @@ export function getMarketplaceInstallErrorInfo(err: unknown): {
name?: string;
reason: string;
qualityReport?: QualityReport;
+ appUpdateRequired?: boolean;
+ minAppVersion?: string;
+ currentAppVersion?: string;
} {
const e = err as Partial<MarketplaceInstallError> & { message?: string; qualityReport?: QualityReport };
return {
@@ -485,6 +503,11 @@ export function getMarketplaceInstallErrorInfo(err: unknown): {
name: e.marketplaceName,
reason: e.marketplaceReason || e.message || String(err),
qualityReport: e.qualityReport,
+ ...(e.appUpdateRequired ? {
+ appUpdateRequired: true,
+ minAppVersion: e.minAppVersion || '',
+ currentAppVersion: e.currentAppVersion || '',
+ } : {}),
};
}
diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.ts
index 7daff239..7d150b1d 100644
--- a/src/main/ipc/index.ts
+++ b/src/main/ipc/index.ts
@@ -2830,6 +2830,9 @@ export function register(): void {
marketplaceId?: string;
marketplaceName?: string;
marketplaceReason?: string;
+ marketplaceAppUpdateRequired?: boolean;
+ marketplaceMinAppVersion?: string;
+ marketplaceCurrentAppVersion?: string;
qualityReport?: unknown;
} = {
ok: false,
@@ -2846,6 +2849,11 @@ export function register(): void {
if (installInfo.name) out.marketplaceName = installInfo.name;
if (installInfo.reason) out.marketplaceReason = installInfo.reason;
}
+ if (installInfo.appUpdateRequired) {
+ out.marketplaceAppUpdateRequired = true;
+ out.marketplaceMinAppVersion = installInfo.minAppVersion || '';
+ out.marketplaceCurrentAppVersion = installInfo.currentAppVersion || '';
+ }
return out;
}
});
diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.json
index ac0a9366..939092ac 100644
--- a/src/renderer/locales/en.json
+++ b/src/renderer/locales/en.json
@@ -1526,6 +1526,8 @@
"marketplace.status_rejected": "Rejected",
"marketplace.status_archived": "Archived",
"marketplace.install": "Install",
+ "marketplace.requires_app": "Needs Orkas {version}+",
+ "marketplace.app_update_required": "Requires Orkas {minimum} or newer (current {current}). Update Orkas, then install.",
"marketplace.installed": "Installed",
"marketplace.installing": "Installing…",
"marketplace.update": "Update",
diff --git a/src/renderer/locales/ja.json b/src/renderer/locales/ja.json
index 069843eb..44a9cb29 100644
--- a/src/renderer/locales/ja.json
+++ b/src/renderer/locales/ja.json
@@ -1526,6 +1526,8 @@
"marketplace.status_rejected": "非承認",
"marketplace.status_archived": "アーカイブ",
"marketplace.install": "インストール",
+ "marketplace.requires_app": "Orkas {version}+ が必要",
+ "marketplace.app_update_required": "Orkas {minimum} 以降が必要です(現在 {current})。Orkas を更新してからインストールしてください。",
"marketplace.installed": "インストール済み",
"marketplace.installing": "インストール中…",
"marketplace.update": "更新",
diff --git a/src/renderer/locales/pt.json b/src/renderer/locales/pt.json
index 3a45205a..b22cd578 100644
--- a/src/renderer/locales/pt.json
+++ b/src/renderer/locales/pt.json
@@ -1510,6 +1510,8 @@
"marketplace.status_rejected": "Rejeitado",
"marketplace.status_archived": "Arquivado",
"marketplace.install": "Instalar",
+ "marketplace.requires_app": "Requer Orkas {version}+",
+ "marketplace.app_update_required": "Requer o Orkas {minimum} ou mais recente (atual {current}). Atualize o Orkas e instale novamente.",
"marketplace.installed": "Instalado",
"marketplace.installing": "Instalando…",
"marketplace.update": "Atualizar",
diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.json
index 6caea24c..0a92d2a5 100644
--- a/src/renderer/locales/zh.json
+++ b/src/renderer/locales/zh.json
@@ -1526,6 +1526,8 @@
"marketplace.status_rejected": "审核不通过",
"marketplace.status_archived": "归档",
"marketplace.install": "安装",
+ "marketplace.requires_app": "需 Orkas {version}+",
+ "marketplace.app_update_required": "需要 Orkas {minimum} 或更高版本(当前 {current}),请更新 Orkas 后再安装。",
"marketplace.installed": "已安装",
"marketplace.installing": "安装中…",
"marketplace.update": "更新",
diff --git a/src/renderer/modules/marketplace.js b/src/renderer/modules/marketplace.js
index c1d5f8ae..3cacc868 100644
--- a/src/renderer/modules/marketplace.js
+++ b/src/renderer/modules/marketplace.js
@@ -82,6 +82,11 @@ function _mpErrorFromResponse(res, fallbackMessage) {
if (res && res.marketplaceId) err.marketplaceId = res.marketplaceId;
if (res && res.marketplaceName) err.marketplaceName = res.marketplaceName;
if (res && res.marketplaceReason) err.marketplaceReason = res.marketplaceReason;
+ if (res && res.marketplaceAppUpdateRequired) {
+ err.marketplaceAppUpdateRequired = true;
+ err.marketplaceMinAppVersion = res.marketplaceMinAppVersion || '';
+ err.marketplaceCurrentAppVersion = res.marketplaceCurrentAppVersion || '';
+ }
if (res && res.qualityReport) err.qualityReport = res.qualityReport;
return err;
}
@@ -192,6 +197,38 @@ function _mpMinAppVersion(row) {
|| '';
return typeof value === 'string' ? value.trim() : '';
}
+
+// Renderer-local mirror of util/app-version-compat; classic scripts cannot import it.
+function _mpVersionTokens(value) {
+ const text = typeof value === 'string' ? value.trim() : '';
+ if (!text) return [];
+ return text.replace(/^v/i, '').split(/[.+_-]/).filter(Boolean)
+ .map((p) => (/^\d+$/.test(p) ? Number(p) : p.toLowerCase()));
+}
+
+function _mpCompareVersions(a, b) {
+ const aa = _mpVersionTokens(a);
+ const bb = _mpVersionTokens(b);
+ if (!aa.length || !bb.length) return 0;
+ const n = Math.max(aa.length, bb.length);
+ for (let i = 0; i < n; i++) {
+ const x = aa[i] ?? 0;
+ const y = bb[i] ?? 0;
+ if (x === y) continue;
+ if (typeof x === 'number' && typeof y === 'number') return x > y ? 1 : -1;
+ return String(x).localeCompare(String(y), undefined, { numeric: true, sensitivity: 'base' });
+ }
+ return 0;
+}
+
+function _mpItemAppCompatible(item) {
+ const min = _mpMinAppVersion(item);
+ if (!min) return true;
+ const current = _mpState && _mpState.appVersion;
+ if (!current) return true;
+ return _mpCompareVersions(current, min) >= 0;
+}
+
function _mpInstallMetaRows(kind) {
const ids = kind === 'agent' ? _mpState.installedAgentIds : _mpState.installedSkillIds;
const map = kind === 'agent' ? _mpState.installedAgentMeta : _mpState.installedSkillMeta;
@@ -283,6 +320,7 @@ function openMarketplace(initialTab = 'agent', opts = {}) {
_mpState = {
view: 'grid',
+ appVersion: (_mpState && _mpState.appVersion) || '',
tab: (initialTab === 'skill' || initialTab === 'oss') ? initialTab : 'agent',
category: '',
// Open-source projects专区 (curated, config-as-code; isolated from the
@@ -355,6 +393,16 @@ function openMarketplace(initialTab = 'agent', opts = {}) {
// Best-effort cache sweep — never blocks the UI.
window.orkas.invoke('marketplace.sweepCache').catch(() => { /* ignore */ });
+ if (!_mpState.appVersion && window.orkas && typeof window.orkas.env === 'function') {
+ window.orkas.env().then((env) => {
+ const v = env && env.version;
+ if (typeof v === 'string' && v && _mpState) {
+ _mpState.appVersion = v;
+ _mpRender();
+ }
+ }).catch(() => { /* ignore */ });
+ }
+
const deepLinkItem = opts && opts.detailItem && opts.detailItem.id ? opts.detailItem : null;
const deepLinkKind = opts && opts.detailKind ? opts.detailKind : _mpState.tab;
if (deepLinkItem) {
@@ -1314,6 +1362,7 @@ function _mpCardHtml(item, lang) {
const avatar = kind === 'agent'
? renderAvatarHtml(item.icon, item.color, { size: 32, seed: item.id, extraClass: 'marketplace-card-avatar' })
: '';
+ const appCompatible = status.installed || status.updateAvailable || _mpItemAppCompatible(item);
let btnClass = 'btn btn-sm btn-primary';
let btnLabel = t('marketplace.install');
let btnAttrs = `data-mp-install="${escapeHtml(kind)}" data-mp-id="${escapeHtml(item.id)}"`;
@@ -1323,6 +1372,10 @@ function _mpCardHtml(item, lang) {
btnLabel = status.updateAvailable ? t('marketplace.updating') : t('marketplace.installing');
btnAttrs = 'disabled';
btnSpinner = '<span class="marketplace-btn-spinner"></span>';
+ } else if (!appCompatible) {
+ btnClass = 'btn btn-sm is-disabled';
+ btnLabel = t('marketplace.requires_app').replace('{version}', _mpMinAppVersion(item));
+ btnAttrs = 'disabled title="' + escapeHtml(btnLabel) + '"';
} else if (status.updateAvailable) {
btnClass = 'btn btn-sm btn-primary';
btnLabel = t('marketplace.update');
@@ -1463,6 +1516,7 @@ function _mpRenderDetail() {
const installBtn = panel.querySelector('[data-mp-detail-install]');
installBtn.dataset.id = item.id;
installBtn.dataset.kind = kind;
+ installBtn.title = '';
// When installed, repurpose the primary button as Uninstall (local-only — does NOT touch
// the server row). When installing/uninstalling, disabled with progress text + inline
// spinner so the user sees "still working" instead of a static label.
@@ -1486,6 +1540,14 @@ function _mpRenderDetail() {
installBtn.classList.add('btn-danger');
installBtn.disabled = false;
installBtn.dataset.action = 'uninstall';
+ } else if (!_mpItemAppCompatible(item)) {
+ const label = t('marketplace.requires_app').replace('{version}', _mpMinAppVersion(item));
+ installBtn.textContent = label;
+ installBtn.title = label;
+ installBtn.classList.remove('btn-primary', 'btn-danger');
+ installBtn.classList.add('is-disabled');
+ installBtn.disabled = true;
+ installBtn.dataset.action = '';
} else {
installBtn.textContent = t('marketplace.install');
installBtn.classList.remove('is-disabled', 'btn-danger');
@@ -1775,7 +1837,11 @@ function _mpInstallFailedName(kind, item, err) {
function _mpInstallFailedText(kind, item, err) {
const failedKind = err?.marketplaceKind || kind;
const failedName = _mpInstallFailedName(kind, item, err);
- const reason = _mpUserErrorMessage(err, 'marketplace.action_failed_retry_later');
+ const reason = (err && err.marketplaceAppUpdateRequired)
+ ? t('marketplace.app_update_required')
+ .replace('{minimum}', String(err.marketplaceMinAppVersion || _mpMinAppVersion(item) || ''))
+ .replace('{current}', String(err.marketplaceCurrentAppVersion || ''))
+ : _mpUserErrorMessage(err, 'marketplace.action_failed_retry_later');
const tmpl = t('marketplace.install_failed_resource');
if (tmpl && tmpl !== 'marketplace.install_failed_resource') {
return tmpl
diff --git a/test/renderer/marketplace-install-error.test.ts b/test/renderer/marketplace-install-error.test.ts
index f1398c01..1a9cab54 100644
--- a/test/renderer/marketplace-install-error.test.ts
+++ b/test/renderer/marketplace-install-error.test.ts
@@ -44,6 +44,8 @@ function loadMarketplaceRenderer(): any {
'marketplace.install_failed': 'Install failed: {reason}',
'marketplace.install_failed_resource': 'Install failed: {kind}: {name}. {reason}',
'marketplace.action_failed_retry_later': 'Marketplace is temporarily unavailable. Please try again later.',
+ 'marketplace.app_update_required': 'Requires Orkas {minimum} or newer (current {current}). Update Orkas, then install.',
+ 'marketplace.requires_app': 'Needs Orkas {version}+',
'marketplace_request.kind_agent': 'Agent',
'marketplace_request.kind_skill': 'Skill',
} as Record<string, string>)[key] || key,
@@ -91,6 +93,41 @@ describe('marketplace install error display', () => {
expect(text).not.toContain('stale-skill-id');
});
+ it('shows a localized update prompt for a min-app-version block, not a raw string', () => {
+ const ctx = loadMarketplaceRenderer();
+ const text = ctx._mpInstallFailedText(
+ 'agent',
+ { id: 'agent-1', name: 'VideoStudio' },
+ {
+ marketplaceKind: 'agent',
+ marketplaceAppUpdateRequired: true,
+ marketplaceMinAppVersion: '1.6.0',
+ marketplaceCurrentAppVersion: '1.5.1',
+ message: 'requires Orkas >= 1.6.0; current 1.5.1',
+ },
+ );
+
+ expect(text).toBe(
+ 'Install failed: Agent: VideoStudio. Requires Orkas 1.6.0 or newer (current 1.5.1). Update Orkas, then install.',
+ );
+ expect(text).not.toContain('requires Orkas >= 1.6.0');
+ });
+
+ it('gates the install button by client app version', () => {
+ const ctx = loadMarketplaceRenderer();
+ expect(ctx._mpCompareVersions('1.5.1', '1.6.0')).toBeLessThan(0);
+ expect(ctx._mpCompareVersions('1.6.0', '1.6.0')).toBe(0);
+ expect(ctx._mpCompareVersions('1.7.0', '1.6.0')).toBeGreaterThan(0);
+
+ vm.runInContext('_mpState = { appVersion: "1.5.1" }', ctx);
+ expect(ctx._mpItemAppCompatible({ min_app_version: '1.6.0' })).toBe(false);
+ expect(ctx._mpItemAppCompatible({ min_app_version: '1.5.0' })).toBe(true);
+ expect(ctx._mpItemAppCompatible({ min_app_version: '' })).toBe(true);
+
+ vm.runInContext('_mpState = { appVersion: "" }', ctx);
+ expect(ctx._mpItemAppCompatible({ min_app_version: '1.6.0' })).toBe(true);
+ });
+
it('maps transport failures to user-facing marketplace copy', () => {
const ctx = loadMarketplaceRenderer();
const text = ctx._mpInstallFailedText(