codexmate 0.0.56 → 0.1.1

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.
Files changed (42) hide show
  1. package/README.md +2 -2
  2. package/README.vi.md +1 -0
  3. package/README.zh.md +2 -2
  4. package/cli/openai-bridge-retry.js +62 -0
  5. package/cli/openai-bridge-runtime.js +1819 -0
  6. package/cli/openai-bridge.js +137 -2048
  7. package/cli.js +749 -133
  8. package/lib/task-orchestrator.js +90 -21
  9. package/lib/task-workspace-chat.js +292 -0
  10. package/package.json +2 -2
  11. package/web-ui/app.js +67 -131
  12. package/web-ui/modules/app.computed.main-tabs.mjs +304 -7
  13. package/web-ui/modules/app.methods.agents.mjs +192 -1
  14. package/web-ui/modules/app.methods.claude-config.mjs +65 -25
  15. package/web-ui/modules/app.methods.navigation.mjs +67 -83
  16. package/web-ui/modules/app.methods.openclaw-editing.mjs +3 -6
  17. package/web-ui/modules/app.methods.providers.mjs +40 -10
  18. package/web-ui/modules/app.methods.session-actions.mjs +1 -12
  19. package/web-ui/modules/app.methods.session-browser.mjs +23 -54
  20. package/web-ui/modules/app.methods.session-trash.mjs +0 -1
  21. package/web-ui/modules/app.methods.startup-claude.mjs +16 -31
  22. package/web-ui/modules/app.methods.task-orchestration.mjs +347 -8
  23. package/web-ui/modules/app.methods.tool-config-permissions.mjs +0 -3
  24. package/web-ui/modules/app.methods.web-ui-preferences.mjs +442 -68
  25. package/web-ui/modules/config-template-confirm-pref.mjs +2 -3
  26. package/web-ui/modules/i18n/locales/en.mjs +181 -30
  27. package/web-ui/modules/i18n/locales/ja.mjs +178 -27
  28. package/web-ui/modules/i18n/locales/vi.mjs +180 -29
  29. package/web-ui/modules/i18n/locales/zh-tw.mjs +181 -30
  30. package/web-ui/modules/i18n/locales/zh.mjs +183 -32
  31. package/web-ui/modules/i18n.mjs +5 -12
  32. package/web-ui/modules/sessions-filters-url.mjs +1 -2
  33. package/web-ui/partials/index/layout-header.html +44 -38
  34. package/web-ui/partials/index/modals-basic.html +26 -0
  35. package/web-ui/partials/index/panel-orchestration.html +489 -282
  36. package/web-ui/partials/index/panel-prompts.html +66 -3
  37. package/web-ui/res/web-ui-render.precompiled.js +1181 -604
  38. package/web-ui/styles/layout-shell.css +157 -1
  39. package/web-ui/styles/modals-core.css +173 -0
  40. package/web-ui/styles/navigation-panels.css +11 -0
  41. package/web-ui/styles/responsive.css +32 -0
  42. package/web-ui/styles/task-orchestration.css +2161 -4
@@ -30,16 +30,7 @@ function isSessionLoadNativeDialogEnabled(vm) {
30
30
  // ignore global flag lookup failures
31
31
  }
32
32
 
33
- try {
34
- if (typeof localStorage !== 'undefined' && typeof localStorage.getItem === 'function') {
35
- const stored = String(localStorage.getItem('codexmateSessionLoadNativeDialog') || '').trim().toLowerCase();
36
- if (stored === '1' || stored === 'true' || stored === 'yes' || stored === 'on') {
37
- return true;
38
- }
39
- }
40
- } catch (_) {
41
- // ignore storage lookup failures
42
- }
33
+ if (vm && vm.sessionLoadNativeDialog === true) return true;
43
34
 
44
35
  try {
45
36
  const search = typeof location !== 'undefined' && location && typeof location.search === 'string'
@@ -271,28 +262,17 @@ export function createSessionBrowserMethods(options = {}) {
271
262
  url.hash = '';
272
263
  window.history.replaceState(null, '', url.toString());
273
264
  } catch (_) {}
274
- try {
275
- const sortCache = localStorage.getItem('codexmateSessionSortMode');
276
- this.sessionSortMode = normalizeSortMode(sortCache);
277
- } catch (_) {}
278
265
  if (this.mainTab === 'sessions' && typeof this.loadSessions === 'function') {
279
266
  void this.loadSessions();
280
267
  }
281
268
  return;
282
269
  }
283
- const sourceCache = localStorage.getItem('codexmateSessionFilterSource');
284
- const pathCache = localStorage.getItem('codexmateSessionPathFilter');
285
- const cached = buildSessionFilterCacheState(sourceCache, pathCache);
270
+ const cached = buildSessionFilterCacheState(this.sessionFilterSource, this.sessionPathFilter);
286
271
  this.sessionFilterSource = cached.source;
287
272
  this.sessionPathFilter = cached.pathFilter;
288
- const queryCache = localStorage.getItem('codexmateSessionQuery');
289
- const roleCache = localStorage.getItem('codexmateSessionRoleFilter');
290
- const timeCache = localStorage.getItem('codexmateSessionTimePreset');
291
- const sortCache = localStorage.getItem('codexmateSessionSortMode');
292
- this.sessionQuery = typeof queryCache === 'string' ? queryCache : '';
293
- this.sessionRoleFilter = normalizeSessionRoleFilter(roleCache);
294
- this.sessionTimePreset = normalizeSessionTimePreset(timeCache);
295
- this.sessionSortMode = normalizeSortMode(sortCache);
273
+ this.sessionRoleFilter = normalizeSessionRoleFilter(this.sessionRoleFilter);
274
+ this.sessionTimePreset = normalizeSessionTimePreset(this.sessionTimePreset);
275
+ this.sessionSortMode = normalizeSortMode(this.sessionSortMode);
296
276
  this.refreshSessionPathOptions(this.sessionFilterSource);
297
277
  if (this.mainTab === 'sessions' && typeof this.loadSessions === 'function') {
298
278
  const shouldReload = cached.source !== 'all'
@@ -308,27 +288,26 @@ export function createSessionBrowserMethods(options = {}) {
308
288
 
309
289
  persistSessionFilterCache() {
310
290
  const cached = buildSessionFilterCacheState(this.sessionFilterSource, this.sessionPathFilter);
311
- localStorage.setItem('codexmateSessionFilterSource', cached.source);
312
- if (cached.pathFilter) {
313
- localStorage.setItem('codexmateSessionPathFilter', cached.pathFilter);
314
- } else {
315
- localStorage.removeItem('codexmateSessionPathFilter');
316
- }
317
- if (this.sessionQuery && isSessionQueryEnabled(this.sessionFilterSource)) {
318
- localStorage.setItem('codexmateSessionQuery', this.sessionQuery);
319
- } else {
320
- localStorage.removeItem('codexmateSessionQuery');
291
+ if (typeof this.persistWebUiPreferences === 'function') {
292
+ this.persistWebUiPreferences({
293
+ sessionFilters: {
294
+ source: cached.source,
295
+ pathFilter: cached.pathFilter,
296
+ query: this.sessionQuery && isSessionQueryEnabled(this.sessionFilterSource) ? this.sessionQuery : '',
297
+ roleFilter: normalizeSessionRoleFilter(this.sessionRoleFilter),
298
+ timePreset: normalizeSessionTimePreset(this.sessionTimePreset),
299
+ sortMode: this.normalizeSessionSortMode(this.sessionSortMode)
300
+ }
301
+ });
321
302
  }
322
- localStorage.setItem('codexmateSessionRoleFilter', normalizeSessionRoleFilter(this.sessionRoleFilter));
323
- localStorage.setItem('codexmateSessionTimePreset', normalizeSessionTimePreset(this.sessionTimePreset));
324
303
  },
325
304
 
326
305
  onSessionSortChange() {
327
306
  const normalized = this.normalizeSessionSortMode(this.sessionSortMode);
328
307
  this.sessionSortMode = normalized;
329
- try {
330
- localStorage.setItem('codexmateSessionSortMode', normalized);
331
- } catch (_) {}
308
+ if (typeof this.persistWebUiPreferences === 'function') {
309
+ this.persistWebUiPreferences({ sessionFilters: { sortMode: normalized } });
310
+ }
332
311
  },
333
312
 
334
313
  getSessionHotLabel(session) {
@@ -361,25 +340,16 @@ export function createSessionBrowserMethods(options = {}) {
361
340
  },
362
341
 
363
342
  restoreSessionPinnedMap() {
364
- const cached = localStorage.getItem('codexmateSessionPinnedMap');
365
- if (!cached) {
366
- this.sessionPinnedMap = {};
367
- return;
368
- }
369
- try {
370
- const parsed = JSON.parse(cached);
371
- this.sessionPinnedMap = this.normalizeSessionPinnedMap(parsed);
372
- } catch (_) {
373
- this.sessionPinnedMap = {};
374
- localStorage.removeItem('codexmateSessionPinnedMap');
375
- }
343
+ this.sessionPinnedMap = this.normalizeSessionPinnedMap(this.sessionPinnedMap);
376
344
  },
377
345
 
378
346
  persistSessionPinnedMap() {
379
347
  const payload = (this.sessionPinnedMap && typeof this.sessionPinnedMap === 'object')
380
348
  ? this.sessionPinnedMap
381
349
  : {};
382
- localStorage.setItem('codexmateSessionPinnedMap', JSON.stringify(payload));
350
+ if (typeof this.persistWebUiPreferences === 'function') {
351
+ this.persistWebUiPreferences({ sessionPinnedMap: payload });
352
+ }
383
353
  },
384
354
 
385
355
  shouldPruneSessionPinnedMap(sessions = this.sessionsList) {
@@ -802,7 +772,6 @@ export function createSessionBrowserMethods(options = {}) {
802
772
  const normalized = typeof nextRange === 'string' ? nextRange.trim().toLowerCase() : '';
803
773
  const range = normalized === 'all' ? 'all' : (normalized === '30d' ? '30d' : '7d');
804
774
  this.sessionsUsageTimeRange = range;
805
- try { localStorage.setItem('sessionsUsageTimeRange', range); } catch (_) {}
806
775
  if (typeof this.persistWebUiPreferences === 'function') {
807
776
  this.persistWebUiPreferences({ sessionsUsageTimeRange: range });
808
777
  }
@@ -310,7 +310,6 @@ export function createSessionTrashMethods(options = {}) {
310
310
  setSessionTrashRetentionDays(days) {
311
311
  const normalized = this.normalizeSessionTrashRetentionDays(days);
312
312
  this.sessionTrashRetentionDays = normalized;
313
- try { localStorage.setItem('codexmateSessionTrashRetentionDays', String(normalized)); } catch (_) {}
314
313
  if (typeof this.persistWebUiPreferences === 'function') {
315
314
  this.persistWebUiPreferences({ sessionTrashRetentionDays: normalized });
316
315
  }
@@ -10,28 +10,20 @@ import {
10
10
  } from '../logic.mjs';
11
11
  import { nextClaudeConfigName } from './provider-default-names.mjs';
12
12
 
13
- const DELETED_CLAUDE_SETTINGS_IMPORTS_STORAGE_KEY = 'deletedClaudeSettingsImports';
14
-
15
13
  function normalizeDeletedClaudeImportUrl(value) {
16
14
  return typeof value === 'string' ? value.trim().replace(/\/+$/g, '') : '';
17
15
  }
18
16
 
19
- function shouldSuppressDeletedClaudeSettingsImport(env = {}) {
17
+ function shouldSuppressDeletedClaudeSettingsImport(env = {}, deletedEntries = []) {
20
18
  const normalized = normalizeClaudeSettingsEnv(env);
21
19
  const baseUrl = normalizeDeletedClaudeImportUrl(normalized.baseUrl);
22
20
  const model = normalizeClaudeValue(normalized.model);
23
21
  if (!baseUrl || !model) return false;
24
- try {
25
- const raw = localStorage.getItem(DELETED_CLAUDE_SETTINGS_IMPORTS_STORAGE_KEY);
26
- const parsed = raw ? JSON.parse(raw) : [];
27
- const entries = Array.isArray(parsed) ? parsed : [];
28
- return entries.some((entry) => entry
29
- && typeof entry === 'object'
30
- && normalizeDeletedClaudeImportUrl(entry.baseUrl) === baseUrl
31
- && normalizeClaudeValue(entry.model) === model);
32
- } catch (_) {
33
- return false;
34
- }
22
+ const entries = Array.isArray(deletedEntries) ? deletedEntries : [];
23
+ return entries.some((entry) => entry
24
+ && typeof entry === 'object'
25
+ && normalizeDeletedClaudeImportUrl(entry.baseUrl) === baseUrl
26
+ && normalizeClaudeValue(entry.model) === model);
35
27
  }
36
28
 
37
29
  export function createStartupClaudeMethods(options = {}) {
@@ -153,9 +145,6 @@ export function createStartupClaudeMethods(options = {}) {
153
145
  claude: statusRes.toolConfigPermissions.claude === true,
154
146
  opencode: statusRes.toolConfigPermissions.opencode === true
155
147
  };
156
- try {
157
- localStorage.setItem('toolConfigPermissions', JSON.stringify(this.toolConfigPermissions));
158
- } catch (_) {}
159
148
  }
160
149
  this.providersList = listRes.providers;
161
150
  if (typeof this.loadLocalBridgeExcluded === 'function') { this.loadLocalBridgeExcluded(); }
@@ -275,7 +264,7 @@ export function createStartupClaudeMethods(options = {}) {
275
264
  },
276
265
 
277
266
  shouldSuppressClaudeSettingsImport(env) {
278
- return isLikelyBuiltinClaudeProxySettingsEnv(env) || shouldSuppressDeletedClaudeSettingsImport(env);
267
+ return isLikelyBuiltinClaudeProxySettingsEnv(env) || shouldSuppressDeletedClaudeSettingsImport(env, this.deletedClaudeSettingsImports);
279
268
  },
280
269
 
281
270
  findDuplicateClaudeConfigName(config) {
@@ -381,7 +370,7 @@ export function createStartupClaudeMethods(options = {}) {
381
370
  if (matchName) {
382
371
  if (this.currentClaudeConfig !== matchName) {
383
372
  this.currentClaudeConfig = matchName;
384
- try { localStorage.setItem('currentClaudeConfig', matchName); } catch (_) {}
373
+ if (typeof this.persistWebUiPreferences === 'function') this.persistWebUiPreferences({ currentClaudeConfig: matchName });
385
374
  }
386
375
  this.refreshClaudeModelContext({ silentError: silentModelError });
387
376
  return;
@@ -390,7 +379,7 @@ export function createStartupClaudeMethods(options = {}) {
390
379
  if (builtinProxyMatch) {
391
380
  if (this.currentClaudeConfig !== builtinProxyMatch) {
392
381
  this.currentClaudeConfig = builtinProxyMatch;
393
- try { localStorage.setItem('currentClaudeConfig', builtinProxyMatch); } catch (_) {}
382
+ if (typeof this.persistWebUiPreferences === 'function') this.persistWebUiPreferences({ currentClaudeConfig: builtinProxyMatch });
394
383
  }
395
384
  this.refreshClaudeModelContext({ silentError: silentModelError });
396
385
  return;
@@ -401,7 +390,7 @@ export function createStartupClaudeMethods(options = {}) {
401
390
  if (importedName) {
402
391
  if (this.currentClaudeConfig !== importedName) {
403
392
  this.currentClaudeConfig = importedName;
404
- try { localStorage.setItem('currentClaudeConfig', importedName); } catch (_) {}
393
+ if (typeof this.persistWebUiPreferences === 'function') this.persistWebUiPreferences({ currentClaudeConfig: importedName });
405
394
  }
406
395
  this.refreshClaudeModelContext({ silentError: silentModelError });
407
396
  if (!silent) {
@@ -417,14 +406,14 @@ export function createStartupClaudeMethods(options = {}) {
417
406
  : (configNames[0] || '');
418
407
  if (!fallback) {
419
408
  this.currentClaudeConfig = '';
420
- try { localStorage.setItem('currentClaudeConfig', ''); } catch (_) {}
409
+ if (typeof this.persistWebUiPreferences === 'function') this.persistWebUiPreferences({ currentClaudeConfig: '' });
421
410
  this.currentClaudeModel = '';
422
411
  this.resetClaudeModelsState();
423
412
  return;
424
413
  }
425
414
  if (this.currentClaudeConfig !== fallback) {
426
415
  this.currentClaudeConfig = fallback;
427
- try { localStorage.setItem('currentClaudeConfig', fallback); } catch (_) {}
416
+ if (typeof this.persistWebUiPreferences === 'function') this.persistWebUiPreferences({ currentClaudeConfig: fallback });
428
417
  }
429
418
  this.refreshClaudeModelContext({ silentError: silentModelError });
430
419
  }
@@ -611,14 +600,10 @@ export function createStartupClaudeMethods(options = {}) {
611
600
  },
612
601
 
613
602
  maybeShowStarPrompt() {
614
- const storageKey = 'codexmateStarPrompted';
615
- try {
616
- if (!localStorage.getItem(storageKey)) {
617
- localStorage.setItem(storageKey, '1');
618
- }
619
- } catch (_) {
620
- // Ignore storage failures silently. The startup UI should not show
621
- // promotional prompts or block normal configuration work.
603
+ if (this.starPrompted === true) return;
604
+ this.starPrompted = true;
605
+ if (typeof this.persistWebUiPreferences === 'function') {
606
+ this.persistWebUiPreferences({ starPrompted: true });
622
607
  }
623
608
  }
624
609
  };