codexmate 0.1.33 → 0.1.35

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 (91) hide show
  1. package/README.md +27 -2
  2. package/README.vi.md +27 -2
  3. package/README.zh.md +27 -2
  4. package/cli/analytics-export-args.js +7 -0
  5. package/cli/local-bridge.js +10 -6
  6. package/cli/openai-chat-routing.js +38 -0
  7. package/cli/routing-bridge.js +143 -0
  8. package/cli/session-usage.js +4 -1
  9. package/cli/system-prompt-files.js +75 -53
  10. package/cli.js +191 -9
  11. package/lib/data/model-prices.json +1868 -0
  12. package/lib/file-sharing-lan.js +111 -0
  13. package/lib/file-sharing.js +196 -0
  14. package/lib/model-test-client.js +61 -0
  15. package/lib/model-test.js +126 -0
  16. package/lib/routing-groups.js +161 -0
  17. package/lib/session-context-health.js +5 -1
  18. package/lib/session-evidence-collections.js +85 -0
  19. package/lib/session-features.js +15 -0
  20. package/lib/session-project-git.js +65 -0
  21. package/lib/session-projects.js +12 -1
  22. package/lib/session-stories.js +67 -0
  23. package/lib/session-usage-ledger.js +77 -0
  24. package/lib/session-usage-pricing.js +42 -0
  25. package/lib/session-usage-report.js +101 -0
  26. package/package.json +4 -1
  27. package/plugins/file-sharing/manifest.mjs +10 -0
  28. package/plugins/file-sharing/methods.mjs +101 -0
  29. package/plugins/file-sharing/overview.mjs +3 -0
  30. package/plugins/file-sharing/ownership.mjs +5 -0
  31. package/plugins/prompt-templates/computed.mjs +9 -0
  32. package/plugins/registry.mjs +3 -0
  33. package/web-ui/app.js +25 -2
  34. package/web-ui/index.html +3 -2
  35. package/web-ui/logic.session-artifacts.mjs +39 -0
  36. package/web-ui/modules/app.computed.main-tabs.mjs +3 -0
  37. package/web-ui/modules/app.methods.agents.mjs +14 -1
  38. package/web-ui/modules/app.methods.install.mjs +23 -3
  39. package/web-ui/modules/app.methods.navigation.mjs +2 -0
  40. package/web-ui/modules/app.methods.prompts-editor.mjs +7 -4
  41. package/web-ui/modules/app.methods.session-actions.mjs +2 -2
  42. package/web-ui/modules/app.methods.session-browser.mjs +35 -0
  43. package/web-ui/modules/app.methods.system-prompt.mjs +99 -19
  44. package/web-ui/modules/app.methods.theme.mjs +4 -3
  45. package/web-ui/modules/app.methods.web-ui-preferences.mjs +12 -0
  46. package/web-ui/modules/i18n/locales/en.mjs +239 -5
  47. package/web-ui/modules/i18n/locales/ja.mjs +239 -5
  48. package/web-ui/modules/i18n/locales/vi.mjs +239 -5
  49. package/web-ui/modules/i18n/locales/zh-tw.mjs +239 -5
  50. package/web-ui/modules/i18n/locales/zh.mjs +239 -5
  51. package/web-ui/modules/model-test.mjs +82 -0
  52. package/web-ui/modules/plugins.methods.mjs +3 -1
  53. package/web-ui/modules/prompt-ecosystem.methods.mjs +4 -3
  54. package/web-ui/modules/routing.mjs +206 -0
  55. package/web-ui/modules/session-collections.mjs +65 -0
  56. package/web-ui/modules/session-evidence.mjs +81 -0
  57. package/web-ui/modules/session-features.mjs +15 -1
  58. package/web-ui/modules/session-git.mjs +39 -0
  59. package/web-ui/modules/session-stories.mjs +64 -0
  60. package/web-ui/modules/usage-pricing.mjs +30 -0
  61. package/web-ui/partials/index/layout-footer.html +1 -1
  62. package/web-ui/partials/index/layout-header.html +33 -12
  63. package/web-ui/partials/index/modals-basic.html +15 -0
  64. package/web-ui/partials/index/panel-plugins.html +3 -9
  65. package/web-ui/partials/index/panel-prompts.html +13 -7
  66. package/web-ui/partials/index/panel-routing.html +3 -0
  67. package/web-ui/partials/index/panel-sessions.html +20 -20
  68. package/web-ui/partials/index/panel-settings.html +11 -1
  69. package/web-ui/partials/index/panel-usage.html +2 -0
  70. package/web-ui/partials/index/plugin-file-sharing.html +47 -0
  71. package/web-ui/partials/index/routing-model-test.html +53 -0
  72. package/web-ui/partials/index/session-diagnostics.html +7 -4
  73. package/web-ui/partials/index/session-features.html +82 -2
  74. package/web-ui/partials/index/thread-handoff.html +73 -62
  75. package/web-ui/partials/index/usage-records.html +41 -0
  76. package/web-ui/res/web-ui-render.precompiled.js +1378 -230
  77. package/web-ui/styles/base-theme.css +1 -1
  78. package/web-ui/styles/modals-core.css +6 -5
  79. package/web-ui/styles/navigation-panels.css +4 -0
  80. package/web-ui/styles/plugins-panel.css +40 -1
  81. package/web-ui/styles/responsive.css +10 -5
  82. package/web-ui/styles/routing.css +78 -0
  83. package/web-ui/styles/session-features.css +180 -7
  84. package/web-ui/styles/sessions-list.css +74 -0
  85. package/web-ui/styles/sessions-preview.css +106 -68
  86. package/web-ui/styles/sessions-usage.css +8 -0
  87. package/web-ui/styles/settings-panel.css +30 -0
  88. package/web-ui/styles/system-prompt.css +8 -7
  89. package/web-ui/styles/theme-violet-tokens.css +52 -0
  90. package/web-ui/styles/theme-violet.css +1742 -0
  91. package/web-ui/styles.css +2 -0
@@ -0,0 +1,65 @@
1
+ export const sessionCollectionsMixin = {
2
+ data() {
3
+ return { collectionsOpen: false, collections: [], collectionRevision: '', collectionId: '', collectionName: '',
4
+ collectionBusy: false, collectionError: '', collectionSequence: 0 };
5
+ },
6
+ beforeUnmount() { this.collectionSequence++; },
7
+ methods: {
8
+ async toggleCollections(event) {
9
+ if (event.target !== event.currentTarget) return;
10
+ this.collectionsOpen = event.currentTarget.open;
11
+ if (this.collectionsOpen) await this.loadEvidenceCollections();
12
+ },
13
+ async loadEvidenceCollections() {
14
+ const sequence = ++this.collectionSequence;
15
+ this.collectionBusy = true; this.collectionError = '';
16
+ try {
17
+ const report = await this.featureCall('session-collections-list');
18
+ if (sequence !== this.collectionSequence) return;
19
+ this.collections = report.items; this.collectionRevision = report.revision;
20
+ } catch (error) { if (sequence === this.collectionSequence) this.collectionError = this.featureErrorText(error); }
21
+ finally { if (sequence === this.collectionSequence) this.collectionBusy = false; }
22
+ },
23
+ async openEvidenceCollection(item) {
24
+ if (this.collectionBusy || this.evidenceBusy) return;
25
+ const sequence = ++this.collectionSequence;
26
+ this.collectionBusy = true; this.collectionError = '';
27
+ try {
28
+ const report = await this.featureCall('session-collection-open', { id: item.id });
29
+ if (sequence !== this.collectionSequence) return;
30
+ this.evidenceSequence++; this.evidencePack = ''; this.evidenceError = '';
31
+ this.evidenceSelections = report.items; this.evidenceGoal = report.item.goal; this.evidenceNote = '';
32
+ this.collectionId = report.item.id; this.collectionName = report.item.name; this.collectionRevision = report.revision;
33
+ } catch (error) { if (sequence === this.collectionSequence) this.collectionError = this.featureErrorText(error); }
34
+ finally { if (sequence === this.collectionSequence) this.collectionBusy = false; }
35
+ },
36
+ async saveEvidenceCollection(asNew = false) {
37
+ if (this.collectionBusy || this.evidenceBusy || !this.evidenceSelections.length) return;
38
+ const sequence = ++this.collectionSequence;
39
+ this.collectionBusy = true; this.collectionError = '';
40
+ const references = this.evidenceSelections.map(item => ({ nodeId: item.nodeId, textHash: item.textHash,
41
+ session: { source: item.session.source, sessionId: item.session.sessionId || '', filePath: item.session.filePath || '',
42
+ cwd: item.session.cwd || '', title: item.session.title || '' } }));
43
+ try {
44
+ const report = await this.featureCall('session-collection-save', { id: asNew ? '' : this.collectionId,
45
+ name: this.collectionName, goal: this.evidenceGoal, references, revision: this.collectionRevision });
46
+ if (sequence !== this.collectionSequence) return;
47
+ this.collections = report.items; this.collectionRevision = report.revision;
48
+ this.collectionId = report.item.id; this.collectionName = report.item.name; this.collectionsOpen = true;
49
+ } catch (error) { if (sequence === this.collectionSequence) this.collectionError = this.featureErrorText(error); }
50
+ finally { if (sequence === this.collectionSequence) this.collectionBusy = false; }
51
+ },
52
+ async removeEvidenceCollection(item) {
53
+ if (this.collectionBusy) return;
54
+ const sequence = ++this.collectionSequence;
55
+ this.collectionBusy = true; this.collectionError = '';
56
+ try {
57
+ const report = await this.featureCall('session-collection-remove', { id: item.id, revision: this.collectionRevision });
58
+ if (sequence !== this.collectionSequence) return;
59
+ this.collections = report.items; this.collectionRevision = report.revision;
60
+ if (this.collectionId === item.id) { this.collectionId = ''; this.collectionName = ''; }
61
+ } catch (error) { if (sequence === this.collectionSequence) this.collectionError = this.featureErrorText(error); }
62
+ finally { if (sequence === this.collectionSequence) this.collectionBusy = false; }
63
+ }
64
+ }
65
+ };
@@ -0,0 +1,81 @@
1
+ import { sessionCollectionsMixin } from './session-collections.mjs';
2
+ import { renderSessionArtifact, sessionArtifactFilename } from '../logic.session-artifacts.mjs';
3
+ const MAX_SELECTIONS = 100;
4
+ const selectionKey = result => JSON.stringify([result.session.source, result.session.sessionId, result.session.filePath, result.nodeId]);
5
+
6
+ export const sessionEvidenceMixin = {
7
+ mixins: [sessionCollectionsMixin],
8
+ data() {
9
+ return { evidenceSelections: [], evidenceGoal: '', evidencePack: '', evidenceBusy: false, evidenceError: '', evidenceSequence: 0,
10
+ evidenceFormat: 'evidence', evidenceNote: '', evidenceGeneratedFormat: 'evidence' };
11
+ },
12
+ beforeUnmount() { this.evidenceSequence++; },
13
+ watch: {
14
+ evidenceGoal() { this.invalidateEvidenceArtifact(); },
15
+ evidenceFormat() { this.invalidateEvidenceArtifact(); },
16
+ evidenceNote() { this.invalidateEvidenceArtifact(); }
17
+ },
18
+ methods: {
19
+ evidenceKey: selectionKey,
20
+ invalidateEvidenceArtifact() { this.evidenceSequence++; this.evidencePack = ''; },
21
+ isEvidenceSelected(result) { return this.evidenceSelections.some(item => selectionKey(item) === selectionKey(result)); },
22
+ toggleEvidence(result) {
23
+ this.evidenceSequence++;
24
+ this.evidencePack = ''; this.evidenceError = '';
25
+ const key = selectionKey(result);
26
+ if (this.isEvidenceSelected(result)) {
27
+ this.evidenceSelections = this.evidenceSelections.filter(item => selectionKey(item) !== key);
28
+ return;
29
+ }
30
+ if (this.evidenceSelections.length >= MAX_SELECTIONS) { this.evidenceError = this.t('evidence.limit'); return; }
31
+ this.evidenceSelections = [...this.evidenceSelections, { ...result, session: { ...result.session } }];
32
+ },
33
+ async generateEvidencePack() {
34
+ if (this.evidenceBusy || !this.evidenceSelections.length) return;
35
+ const sequence = ++this.evidenceSequence;
36
+ const format = this.evidenceFormat;
37
+ const goal = this.evidenceGoal;
38
+ const note = this.evidenceNote;
39
+ const selections = [...this.evidenceSelections];
40
+ const groups = new Map();
41
+ for (const item of selections) {
42
+ const key = JSON.stringify([item.session.source, item.session.sessionId, item.session.filePath]);
43
+ if (!groups.has(key)) groups.set(key, []);
44
+ groups.get(key).push(item);
45
+ }
46
+ this.evidenceBusy = true; this.evidenceError = ''; this.evidencePack = '';
47
+ try {
48
+ const evidence = new Map();
49
+ for (const group of groups.values()) {
50
+ const draft = await this.featureCall('session-handoff-draft', { ...group[0].session, goal,
51
+ selections: group.map(item => item.nodeId) });
52
+ if (sequence !== this.evidenceSequence) return;
53
+ for (const item of group) {
54
+ const found = draft.evidence.find(entry => entry.nodeId === item.nodeId);
55
+ if (!found || found.textHash !== item.textHash) throw new Error(this.t('evidence.changed'));
56
+ evidence.set(selectionKey(item), found);
57
+ }
58
+ }
59
+ if (format !== 'evidence') {
60
+ this.evidencePack = renderSessionArtifact({ format, goal, note, selections, evidence, translate: key => this.t(key) });
61
+ } else {
62
+ const lines = [`# ${this.t('evidence.title')}`, '', this.t('evidence.scope'), '', goal.trim()];
63
+ for (const [index, item] of selections.entries()) {
64
+ const found = evidence.get(selectionKey(item));
65
+ lines.push('', `## ${index + 1}. ${item.session.title || item.session.sessionId}`, '',
66
+ `${item.session.source} · ${item.session.sessionId} · ${found.nodeId}`,
67
+ `${this.t('evidence.path')}: ${JSON.stringify(item.session.filePath || item.session.cwd || '')}`,
68
+ `SHA-256: ${found.textHash}`, `${this.t('evidence.status')}: ${this.t('evidence.' + found.status)}`, '',
69
+ ...found.excerpt.split('\n').map(line => '> ' + line));
70
+ }
71
+ this.evidencePack = lines.join('\n').trim() + '\n';
72
+ }
73
+ this.evidenceGeneratedFormat = format;
74
+ } catch (error) { if (sequence === this.evidenceSequence) this.evidenceError = error.message; }
75
+ finally { this.evidenceBusy = false; }
76
+ },
77
+ downloadEvidencePack() {
78
+ if (this.evidencePack) this.downloadTextFile(sessionArtifactFilename(this.evidenceGeneratedFormat), this.evidencePack);
79
+ }
80
+ }
81
+ };
@@ -1,4 +1,7 @@
1
1
  import { api } from './api.mjs';
2
+ import { sessionEvidenceMixin } from './session-evidence.mjs';
3
+ import { usagePricingMixin } from './usage-pricing.mjs';
4
+ import { sessionGitMixin } from './session-git.mjs';
2
5
  import { contextWindowReference } from '../logic.context-window.mjs';
3
6
  const SessionMessageActions = {
4
7
  props: { message: { type: Object, required: true } },
@@ -20,6 +23,7 @@ const SessionMessageActions = {
20
23
  }
21
24
  };
22
25
  export const sessionFeaturesMixin = {
26
+ mixins: [sessionEvidenceMixin, usagePricingMixin, sessionGitMixin],
23
27
  components: { SessionMessageActions },
24
28
  data() {
25
29
  return { featureView: '', featureBusy: false, featureError: '', bookmarks: [], bookmarkRevision: '',
@@ -29,6 +33,16 @@ export const sessionFeaturesMixin = {
29
33
  diagnosticsTargets: [], diagnosticsSelected: [], diagnosticsTimer: null };
30
34
  },
31
35
  computed: {
36
+ indexCatalogTime() {
37
+ const timestamp = this.indexReport?.updatedAt;
38
+ const parsed = typeof timestamp === 'string' ? Date.parse(timestamp) : NaN;
39
+ return Number.isFinite(parsed) ? new Date(parsed).toISOString() : this.t('features.indexUnknown');
40
+ },
41
+ indexSourceCoverage() {
42
+ const coverage = this.indexReport?.coverage;
43
+ const source = this.sessionFilterSource || 'all';
44
+ return Array.isArray(coverage) ? coverage.filter(entry => source === 'all' || entry.source === source) : [];
45
+ },
32
46
  contextPreferenceKey() {
33
47
  return `${this.handoffSessionKey}::${this.contextSelectedModel || this.sessionContextHealth?.models?.[0] || 'manual'}`;
34
48
  },
@@ -46,7 +60,7 @@ export const sessionFeaturesMixin = {
46
60
  void this.loadContextPreferences();
47
61
  },
48
62
  contextSelectedModel() { if (this.sessionContextHealth) void this.loadContextPreferences(); },
49
- handoffSessionKey() { this.contextWindowInput = ''; this.contextSelectedModel = ''; this.selectedContextIds = []; this.handoffDraftEvidence = []; this.handoffUnverified = []; this.featureFocus = null; this.featureRequestSeq++; this.featureBusy = false; }
63
+ handoffSessionKey() { this.contextWindowInput = ''; this.contextSelectedModel = ''; this.selectedContextIds = []; this.handoffDraftEvidence = []; this.handoffUnverified = []; this.featureFocus = null; this.featureBusy = false; }
50
64
  },
51
65
  methods: {
52
66
  featureErrorText(error) {
@@ -0,0 +1,39 @@
1
+ import { sessionStoriesMixin } from './session-stories.mjs';
2
+ export const sessionGitMixin = {
3
+ mixins: [sessionStoriesMixin],
4
+ data() { return { projectGitOpen: false, projectGit: null, projectGitCommit: null, projectGitBusy: false, projectGitError: '', projectGitSequence: 0 }; },
5
+ beforeUnmount() { this.projectGitSequence++; },
6
+ watch: {
7
+ projectSelected() {
8
+ this.projectGitSequence++; this.projectGit = null; this.projectGitCommit = null; this.projectGitError = ''; this.projectGitBusy = false;
9
+ if (!this.projectSelected) this.projectGitOpen = false;
10
+ else if (this.projectGitOpen) void this.loadProjectGit();
11
+ }
12
+ },
13
+ methods: {
14
+ toggleProjectGit(event) {
15
+ if (event.target !== event.currentTarget) return;
16
+ this.projectGitOpen = event.currentTarget.open;
17
+ if (this.projectGitOpen && !this.projectGit) return this.loadProjectGit();
18
+ },
19
+ async loadProjectGit() {
20
+ if (!this.projectSelected || this.projectGitBusy) return;
21
+ const sequence = ++this.projectGitSequence;
22
+ this.projectGitBusy = true; this.projectGitError = ''; this.projectGitCommit = null;
23
+ try {
24
+ const report = await this.featureCall('session-project-git', { project: this.projectSelected });
25
+ if (sequence === this.projectGitSequence) this.projectGit = report;
26
+ } catch (error) { if (sequence === this.projectGitSequence) this.projectGitError = error.message; }
27
+ finally { if (sequence === this.projectGitSequence) this.projectGitBusy = false; }
28
+ },
29
+ async loadProjectGitCommit(sha) {
30
+ const sequence = ++this.projectGitSequence;
31
+ this.projectGitBusy = true; this.projectGitError = ''; this.projectGitCommit = null;
32
+ try {
33
+ const report = await this.featureCall('session-project-git-commit', { project: this.projectSelected, sha });
34
+ if (sequence === this.projectGitSequence) this.projectGitCommit = report;
35
+ } catch (error) { if (sequence === this.projectGitSequence) this.projectGitError = error.message; }
36
+ finally { if (sequence === this.projectGitSequence) this.projectGitBusy = false; }
37
+ }
38
+ }
39
+ };
@@ -0,0 +1,64 @@
1
+ export const sessionStoriesMixin = {
2
+ data() {
3
+ return { stories: [], storySessions: [], storyRevision: '', storySession: '', storyNote: '', storyBusy: false,
4
+ storyError: '', storySequence: 0 };
5
+ },
6
+ computed: {
7
+ commitStories() { return this.stories.filter(item => item.sha === this.projectGitCommit?.sha); }
8
+ },
9
+ beforeUnmount() { this.storySequence++; },
10
+ watch: {
11
+ projectSelected() {
12
+ this.storySequence++; this.stories = []; this.storySessions = []; this.storySession = ''; this.storyNote = '';
13
+ this.storyError = ''; this.storyBusy = false; this.storyRevision = '';
14
+ },
15
+ projectGitCommit(commit) {
16
+ this.storySequence++; this.storySession = ''; this.storyNote = ''; this.storyError = ''; this.storyBusy = false;
17
+ if (commit) void this.loadProjectStories();
18
+ },
19
+ storySession(key) {
20
+ const existing = this.commitStories.find(item => this.storySessionKey(item.session) === key);
21
+ this.storyNote = existing?.note || '';
22
+ }
23
+ },
24
+ methods: {
25
+ storySessionKey(session) { return JSON.stringify([session.source, session.sessionId, session.filePath]); },
26
+ async loadProjectStories() {
27
+ if (!this.projectSelected || !this.projectGitCommit) return;
28
+ const sequence = ++this.storySequence;
29
+ this.storyBusy = true; this.storyError = '';
30
+ try {
31
+ const report = await this.featureCall('session-stories-list', { project: this.projectSelected });
32
+ if (sequence !== this.storySequence) return;
33
+ this.stories = report.items; this.storySessions = report.sessions; this.storyRevision = report.revision;
34
+ } catch (error) { if (sequence === this.storySequence) this.storyError = this.featureErrorText(error); }
35
+ finally { if (sequence === this.storySequence) this.storyBusy = false; }
36
+ },
37
+ async saveProjectStory() {
38
+ if (this.storyBusy || !this.projectGitCommit) return;
39
+ const session = this.storySessions.find(item => this.storySessionKey(item) === this.storySession);
40
+ if (!session) return;
41
+ const sequence = ++this.storySequence;
42
+ this.storyBusy = true; this.storyError = '';
43
+ try {
44
+ const report = await this.featureCall('session-story-save', { project: this.projectSelected,
45
+ sha: this.projectGitCommit.sha, session, note: this.storyNote, revision: this.storyRevision });
46
+ if (sequence !== this.storySequence) return;
47
+ this.stories = report.items; this.storySessions = report.sessions; this.storyRevision = report.revision;
48
+ } catch (error) { if (sequence === this.storySequence) this.storyError = this.featureErrorText(error); }
49
+ finally { if (sequence === this.storySequence) this.storyBusy = false; }
50
+ },
51
+ async removeProjectStory(item) {
52
+ if (this.storyBusy) return;
53
+ const sequence = ++this.storySequence;
54
+ this.storyBusy = true; this.storyError = '';
55
+ try {
56
+ const report = await this.featureCall('session-story-remove', { project: this.projectSelected, id: item.id, revision: this.storyRevision });
57
+ if (sequence !== this.storySequence) return;
58
+ this.stories = report.items; this.storySessions = report.sessions; this.storyRevision = report.revision;
59
+ if (this.storySession === this.storySessionKey(item.session)) { this.storySession = ''; this.storyNote = ''; }
60
+ } catch (error) { if (sequence === this.storySequence) this.storyError = this.featureErrorText(error); }
61
+ finally { if (sequence === this.storySequence) this.storyBusy = false; }
62
+ }
63
+ }
64
+ };
@@ -0,0 +1,30 @@
1
+ export const usagePricingMixin = {
2
+ data() { return { usagePricingOpen: false, usagePricing: null, usagePricingBusy: false, usagePricingError: '', usagePricingSequence: 0 }; },
3
+ beforeUnmount() { this.usagePricingSequence++; },
4
+ watch: { sessionsUsageTimeRange() { if (this.usagePricingOpen) void this.loadUsagePricing(); } },
5
+ methods: {
6
+ toggleUsagePricing(event) {
7
+ if (event.target !== event.currentTarget) return;
8
+ this.usagePricingOpen = event.currentTarget.open;
9
+ if (this.usagePricingOpen) return this.loadUsagePricing();
10
+ },
11
+ async loadUsagePricing() {
12
+ const sequence = ++this.usagePricingSequence;
13
+ const range = this.sessionsUsageTimeRange;
14
+ const today = new Date();
15
+ const from = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() - (range === '30d' ? 29 : 6)));
16
+ this.usagePricingBusy = true; this.usagePricingError = ''; this.usagePricing = null;
17
+ try {
18
+ const report = await this.featureCall('session-usage-pricing', { source: 'all', limit: range === 'all' ? 2000 : (range === '30d' ? 1200 : 600),
19
+ ...(range === 'all' ? {} : { from: from.toISOString().slice(0, 10), to: today.toISOString().slice(0, 10) }) });
20
+ if (sequence === this.usagePricingSequence) this.usagePricing = report;
21
+ } catch (error) { if (sequence === this.usagePricingSequence) this.usagePricingError = error.message; }
22
+ finally { if (sequence === this.usagePricingSequence) this.usagePricingBusy = false; }
23
+ },
24
+ formatPriceUsd(value) { return value === null ? this.t('usage.records.unknown') : '$' + value.toFixed(6); },
25
+ formatTokenRate(value) { return typeof value === 'number' ? (value * 1000000).toLocaleString('en-US', { maximumFractionDigits: 6 }) : this.t('usage.records.unknown'); },
26
+ downloadUsagePricing() {
27
+ if (this.usagePricing) this.downloadTextFile('codexmate-price-reference.json', JSON.stringify(this.usagePricing, null, 2), 'application/json;charset=utf-8');
28
+ }
29
+ }
30
+ };
@@ -1,5 +1,5 @@
1
1
  <!-- 加载状态 -->
2
- <div v-if="loading && mainTab !== 'usage'" class="state-message app-loading-state">
2
+ <div v-if="loading && mainTab !== 'usage' && mainTab !== 'prompts'" class="state-message app-loading-state">
3
3
  {{ t('app.loadingConfig') }}
4
4
  </div>
5
5
 
@@ -46,6 +46,16 @@
46
46
  :class="{ active: isMainTabNavActive('config') }"
47
47
  @pointerdown="onMainTabPointerDown('config', $event)"
48
48
  @click="onMainTabClick('config', $event)">{{ t('tab.config') }}</button>
49
+ <button type="button" class="top-tab"
50
+ id="tab-routing"
51
+ role="tab"
52
+ data-main-tab="routing"
53
+ :tabindex="mainTab === 'routing' ? 0 : -1"
54
+ :aria-selected="mainTab === 'routing'"
55
+ aria-controls="panel-routing"
56
+ :class="{ active: isMainTabNavActive('routing') }"
57
+ @pointerdown="onMainTabPointerDown('routing', $event)"
58
+ @click="onMainTabClick('routing', $event)">{{ t('tab.routing') }}</button>
49
59
  <button type="button" class="top-tab"
50
60
  id="tab-sessions"
51
61
  role="tab"
@@ -116,17 +126,8 @@
116
126
  @click="openLanguageSettings">{{ t('settings.language.sideLabel', { language: currentLanguageLabel() }) }}</button>
117
127
  </div>
118
128
 
119
- <div :class="['app-shell', { standalone: sessionStandalone, 'sidebar-collapsed': sidebarCollapsed }]">
129
+ <div :class="['app-shell', 'sidebar-collapsed', { standalone: sessionStandalone }]">
120
130
  <aside class="side-rail" v-if="!sessionStandalone">
121
- <button
122
- type="button"
123
- class="side-rail-collapse-toggle"
124
- :aria-pressed="sidebarCollapsed ? 'true' : 'false'"
125
- :aria-label="sidebarCollapsed ? t('side.expand') : t('side.collapse')"
126
- :title="sidebarCollapsed ? t('side.expand') : t('side.collapse')"
127
- @click="toggleSidebarCollapsed">
128
- <span aria-hidden="true">{{ sidebarCollapsed ? '›' : '‹' }}</span>
129
- </button>
130
131
  <div class="brand-block">
131
132
  <div class="brand-head">
132
133
  <img class="brand-logo" src="/res/logo-pack.webp" alt="Codex Mate logo">
@@ -267,6 +268,15 @@
267
268
 
268
269
  <div class="side-section" role="navigation" :aria-label="t('side.workspace')">
269
270
  <div class="side-section-title">{{ t('side.workspace') }}</div>
271
+ <button
272
+ id="side-tab-routing"
273
+ data-main-tab="routing"
274
+ :aria-current="mainTab === 'routing' ? 'page' : null"
275
+ :class="['side-item', { active: isMainTabNavActive('routing') }]"
276
+ @pointerdown="onMainTabPointerDown('routing', $event)"
277
+ @click="onMainTabClick('routing', $event)">
278
+ <div class="side-item-title">{{ t('tab.routing') }}</div>
279
+ </button>
270
280
  <button
271
281
  id="side-tab-sessions"
272
282
  data-main-tab="sessions"
@@ -356,6 +366,17 @@
356
366
  <span>{{ t('plugins.textTools.tools.compress') }}</span>
357
367
  </div>
358
368
  </button>
369
+ <button
370
+ id="side-tab-plugins-file-sharing"
371
+ data-main-tab="plugins"
372
+ data-plugins-id="file-sharing"
373
+ :aria-current="mainTab === 'plugins' && pluginsActiveId === 'file-sharing' ? 'page' : null"
374
+ :class="['side-item', { active: isPluginsIdNavActive('file-sharing') }]"
375
+ @pointerdown="onPluginsTabPointerDown('file-sharing', $event)"
376
+ @click="onPluginsTabClick('file-sharing', $event)">
377
+ <span class="side-item-icon" aria-hidden="true">⇩</span>
378
+ <div class="side-item-title">{{ t('plugins.fileSharing.title') }}</div>
379
+ </button>
359
380
  </div>
360
381
 
361
382
  <div class="side-section" role="navigation" :aria-label="t('side.system')">
@@ -402,7 +423,7 @@
402
423
  aria-haspopup="menu"
403
424
  @click="toggleLanguageMenu"
404
425
  @keydown.esc.prevent="closeLanguageMenu">
405
- {{ t('settings.language.sideLabel', { language: currentLanguageLabel() }) }}
426
+ {{ currentLanguageLabel() }}
406
427
  <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6l4 4 4-4"/></svg>
407
428
  </button>
408
429
  <div v-if="languageMenuOpen" class="side-language-dropdown" role="menu" @focusout="handleLanguageMenuFocusOut">
@@ -439,7 +460,7 @@
439
460
  <div class="main-panel-topbar">
440
461
  <div class="panel-header panel-header-refined" v-if="!sessionStandalone">
441
462
  <div class="panel-header-copy">
442
- <div class="panel-kicker">{{ mainTabKicker }}</div>
463
+ <div v-if="mainTabKicker" class="panel-kicker">{{ mainTabKicker }}</div>
443
464
  <h1 class="main-title">{{ mainTabTitle }}</h1>
444
465
  </div>
445
466
  </div>
@@ -1,3 +1,18 @@
1
+ <div v-if="showAppUpdateModal" class="modal-overlay" @click.self="closeAppUpdateModal">
2
+ <div class="modal app-update-modal" role="dialog" aria-modal="true" aria-labelledby="app-update-title" aria-describedby="app-update-versions app-update-hint">
3
+ <div id="app-update-title" class="modal-title">{{ t('side.update.available') }}</div>
4
+ <div id="app-update-versions" class="form-group confirm-dialog-message">{{ t('side.update.metaVersions', { current: normalizePackageVersion(appVersion), latest: normalizePackageVersion(appLatestVersion) }) }}</div>
5
+ <div class="docs-command-box">
6
+ <input id="app-update-command" class="install-command" type="text" :value="appUpdateCommand()" readonly :aria-label="t('common.command')" @focus="$event.target.select()">
7
+ <button type="button" class="btn-mini docs-copy-btn" @click="copyInstallCommand(appUpdateCommand())">{{ t('common.copy') }}</button>
8
+ </div>
9
+ <p id="app-update-hint" class="form-hint">{{ t('side.update.commandHint') }}</p>
10
+ <div class="btn-group">
11
+ <button type="button" class="btn btn-cancel" @click="closeAppUpdateModal">{{ t('common.close') }}</button>
12
+ </div>
13
+ </div>
14
+ </div>
15
+
1
16
  <!-- 添加提供商模态框 -->
2
17
  <div v-if="showAddModal" class="modal-overlay" @click.self="closeAddModal">
3
18
  <div class="modal" role="dialog" aria-modal="true" aria-labelledby="add-provider-modal-title">
@@ -9,7 +9,6 @@
9
9
  <div class="selector-header plugins-sidebar-header">
10
10
  <div>
11
11
  <span class="selector-title">{{ t('plugins.sidebar.title') }}</span>
12
- <div class="plugins-panel-note">{{ t('plugins.sidebar.note') }}</div>
13
12
  </div>
14
13
  </div>
15
14
 
@@ -17,6 +16,7 @@
17
16
  <button
18
17
  v-for="plugin in pluginsCatalog"
19
18
  :key="'plugin-' + plugin.id"
19
+ :data-plugin-id="plugin.id"
20
20
  type="button"
21
21
  :class="['plugins-item', { active: pluginsActiveId === plugin.id }]"
22
22
  :aria-current="pluginsActiveId === plugin.id ? 'page' : null"
@@ -41,7 +41,6 @@
41
41
  <div class="plugins-panel-head">
42
42
  <div>
43
43
  <div class="plugins-panel-title">{{ t('plugins.promptTemplates.title') }}</div>
44
- <div v-if="pluginsActiveAttribution" class="plugins-panel-note">{{ pluginsActiveAttribution }}</div>
45
44
  </div>
46
45
  <div v-if="!pluginsSidebarVisible" class="settings-tab-actions">
47
46
  <button type="button" class="btn-tool btn-tool-compact" @click="loadPluginsOverview({ forceRefresh: true, silent: false })" :disabled="loading || !!initError || pluginsLoading">
@@ -81,7 +80,6 @@
81
80
  </select>
82
81
 
83
82
  <div v-if="!promptComposerActiveTemplate" class="plugins-panel-note">{{ t('plugins.promptTemplates.compose.empty') }}</div>
84
- <div v-else-if="promptComposerActiveTemplate.description" class="plugins-panel-note">{{ promptComposerActiveTemplate.description }}</div>
85
83
  <div v-if="promptComposerActiveTemplate && !promptComposerActiveTemplate.isBuiltin" class="prompt-compose-actions">
86
84
  <button
87
85
  type="button"
@@ -95,7 +93,6 @@
95
93
  <div class="prompt-vars-head">
96
94
  <div>
97
95
  <div class="prompt-vars-title">{{ t('plugins.promptTemplates.vars.title') }}</div>
98
- <div v-if="!promptComposerActiveTemplate.isBuiltin" class="plugins-panel-note">{{ t('plugins.promptTemplates.compose.varsHint') }}</div>
99
96
  <div v-if="promptComposerMissingVars.length" class="plugins-panel-note">{{ t('plugins.promptTemplates.compose.missingCount', { count: promptComposerMissingVars.length }) }}</div>
100
97
  </div>
101
98
  <div class="prompt-editor-actions">
@@ -121,7 +118,6 @@
121
118
  <div class="prompt-vars-head">
122
119
  <div>
123
120
  <div class="prompt-vars-title">{{ t('plugins.promptTemplates.compose.outputTitle') }}</div>
124
- <div class="plugins-panel-note">{{ t('plugins.promptTemplates.compose.outputHint') }}</div>
125
121
  </div>
126
122
  <button type="button" class="btn-mini" @click="copyPromptComposerRendered" :disabled="pluginsLoading || !promptComposerRendered">{{ t('plugins.promptTemplates.compose.copy') }}</button>
127
123
  </div>
@@ -210,9 +206,7 @@
210
206
  <div v-if="promptTemplateDraft.isBuiltin" class="plugins-panel-note">
211
207
  {{ t('plugins.promptTemplates.editor.builtinReadOnly') }}
212
208
  </div>
213
- <div v-if="promptTemplateDraft.isBuiltin && (promptTemplateDraft.createdBy || (promptTemplateDraft.maintainers && promptTemplateDraft.maintainers.length))" class="plugins-panel-note">
214
- {{ t('plugins.meta.attribution', { createdBy: promptTemplateDraft.createdBy || '', maintainers: (promptTemplateDraft.maintainers || []).join(', ') }) }}
215
- </div>
209
+
216
210
  <input class="form-input" type="text" v-model.trim="promptTemplateDraftRaw.description" :disabled="promptTemplateDraft.isBuiltin" :placeholder="t('plugins.promptTemplates.editor.descPlaceholder')" :aria-label="t('plugins.promptTemplates.editor.descAria')">
217
211
  </div>
218
212
 
@@ -265,7 +259,6 @@
265
259
  <div class="plugins-panel-head">
266
260
  <div>
267
261
  <div class="plugins-panel-title">{{ t('plugins.textTools.title') }}</div>
268
- <div v-if="pluginsActiveAttribution" class="plugins-panel-note">{{ pluginsActiveAttribution }}</div>
269
262
  </div>
270
263
  </div>
271
264
 
@@ -307,6 +300,7 @@
307
300
  </div>
308
301
  </div>
309
302
 
303
+ <!-- @include ./plugin-file-sharing.html -->
310
304
  <div v-else class="skills-empty-state">{{ t('plugins.promptTemplates.noPluginSelected') }}</div>
311
305
  </section>
312
306
  </div>
@@ -29,9 +29,6 @@
29
29
  :value="projectClaudeMdPath"
30
30
  @change="setProjectClaudeMdPathManual($event.target.value)">
31
31
  </div>
32
- <div v-if="projectClaudeMdPath" class="form-hint project-path-detected">
33
- {{ t('prompts.project.detected', { path: projectClaudeMdPath }) }}
34
- </div>
35
32
  </div>
36
33
 
37
34
 
@@ -271,21 +268,30 @@
271
268
 
272
269
  <div v-if="promptsSubTab === 'system'">
273
270
  <div class="sys-prompt-controls">
271
+ <div class="sys-prompt-control-group">
272
+ <label class="form-label" for="sys-prompt-file-select">{{ t('sysPrompt.fileLabel') }}</label>
273
+ <select id="sys-prompt-file-select" class="form-input sys-prompt-select" :value="currentSysPromptFileName()" :aria-busy="sysPromptFilesLoading" :disabled="sysPromptLoading || sysPromptSaving || sysPromptDiffVisible" @focus="loadSystemPromptFiles" @pointerdown="loadSystemPromptFiles" @keydown.enter="loadSystemPromptFiles" @keydown.space="loadSystemPromptFiles" @change="switchSysPromptFileName($event.target.value, $event)">
274
+ <option v-if="!sysPromptFiles.some(file => file.filename === currentSysPromptFileName())" :value="currentSysPromptFileName()" disabled>{{ currentSysPromptFileName() }}</option>
275
+ <option v-for="file in sysPromptFiles" :key="file.filename" :value="file.filename">{{ file.filename }}{{ file.exists ? '' : ' · ' + t('common.notExistsWillCreateOnSave') }}</option>
276
+ </select>
277
+ <div v-if="sysPromptFilesLoading" class="form-hint" role="status">{{ t('sysPrompt.filesLoading') }}</div>
278
+ </div>
274
279
  <div class="sys-prompt-control-group">
275
280
  <label class="form-label">{{ t('sysPrompt.scope.label') }}</label>
276
- <select class="form-input sys-prompt-select" :value="sysPromptScope" @change="switchSysPromptScope($event.target.value)" :disabled="sysPromptLoading || sysPromptSaving || sysPromptDiffVisible">
281
+ <select class="form-input sys-prompt-select" :value="sysPromptScope" @change="switchSysPromptScope($event.target.value)" :disabled="sysPromptLoading || sysPromptSaving || sysPromptDiffVisible || hasSysPromptContentChanged()">
277
282
  <option value="global">{{ t('sysPrompt.scope.global') }}</option>
278
283
  <option value="project">{{ t('sysPrompt.scope.project') }}</option>
279
284
  </select>
280
285
  </div>
281
- <div class="sys-prompt-control-group">
286
+ <div v-if="!isSysPromptCustomFile()" class="sys-prompt-control-group">
282
287
  <label class="form-label">{{ t('sysPrompt.mode.label') }}</label>
283
- <select class="form-input sys-prompt-select" :value="sysPromptMode" @change="switchSysPromptMode($event.target.value)" :disabled="sysPromptLoading || sysPromptSaving || sysPromptDiffVisible">
288
+ <select class="form-input sys-prompt-select" :value="sysPromptMode" @change="switchSysPromptMode($event.target.value)" :disabled="sysPromptLoading || sysPromptSaving || sysPromptDiffVisible || hasSysPromptContentChanged()">
284
289
  <option value="append">{{ t('sysPrompt.mode.append') }}</option>
285
290
  <option value="system">{{ t('sysPrompt.mode.system') }}</option>
286
291
  </select>
287
292
  </div>
288
293
  </div>
294
+ <div v-if="sysPromptFilesError" class="state-message error" role="alert">{{ sysPromptFilesError }}</div>
289
295
 
290
296
  <div class="prompts-editor">
291
297
  <div class="prompts-editor-toolbar">
@@ -332,7 +338,7 @@
332
338
  <button class="btn-mini" @click="sysPromptDiffVisible ? resetSysPromptDiffState() : cancelSysPromptEdit()" :disabled="sysPromptSaving || sysPromptDiffLoading" :title="t('common.cancel')">
333
339
  <svg class="btn-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
334
340
  </button>
335
- <button class="btn-mini btn-confirm-mini" @click="applySystemPrompt" :disabled="sysPromptSaving || sysPromptLoading || sysPromptDiffLoading || (!sysPromptDiffVisible && !hasSysPromptContentChanged()) || (sysPromptDiffVisible && !sysPromptDiffHasChangesValue)" :title="sysPromptDiffVisible ? t('common.save') : t('common.preview')">
341
+ <button class="btn-mini btn-confirm-mini" @click="applySystemPrompt" :disabled="sysPromptFileMissing || sysPromptSaving || sysPromptLoading || sysPromptDiffLoading || (!sysPromptDiffVisible && !hasSysPromptContentChanged()) || (sysPromptDiffVisible && !sysPromptDiffHasChangesValue)" :title="sysPromptDiffVisible ? t('common.save') : t('common.preview')">
336
342
  <svg v-if="sysPromptDiffVisible" class="btn-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 6L9 17l-5-5"/></svg>
337
343
  <svg v-else class="btn-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
338
344
  </button>
@@ -0,0 +1,3 @@
1
+ <section v-show="mainTab === 'routing'" id="panel-routing" class="mode-content" role="tabpanel" aria-labelledby="tab-routing">
2
+ <!-- @include ./routing-model-test.html -->
3
+ </section>