codexmate 0.1.31 → 0.1.32

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 (43) hide show
  1. package/README.md +3 -3
  2. package/README.vi.md +3 -3
  3. package/README.zh.md +3 -3
  4. package/cli/agents-files.js +18 -4
  5. package/cli/plugin-config.js +64 -0
  6. package/cli/prompt-history.js +17 -4
  7. package/cli/system-prompt-files.js +7 -2
  8. package/cli.js +36 -2
  9. package/lib/cli-config-engine.js +9 -3
  10. package/lib/session-context-health.js +82 -0
  11. package/lib/session-context-records.js +153 -0
  12. package/lib/web-startup-auth.js +5 -1
  13. package/package.json +1 -1
  14. package/plugins/prompt-templates/computed.mjs +3 -3
  15. package/plugins/prompt-templates/invocation.mjs +73 -0
  16. package/plugins/prompt-templates/methods.mjs +48 -3
  17. package/plugins/prompt-templates/overview.mjs +2 -0
  18. package/web-ui/app.js +25 -0
  19. package/web-ui/index.html +1 -0
  20. package/web-ui/logic.context-health.mjs +144 -0
  21. package/web-ui/modules/app.computed.prompts.mjs +11 -0
  22. package/web-ui/modules/app.methods.agents.mjs +20 -3
  23. package/web-ui/modules/app.methods.index.mjs +4 -0
  24. package/web-ui/modules/app.methods.system-prompt.mjs +17 -2
  25. package/web-ui/modules/context-health.methods.mjs +70 -0
  26. package/web-ui/modules/i18n/locales/en.mjs +33 -0
  27. package/web-ui/modules/i18n/locales/ja.mjs +33 -0
  28. package/web-ui/modules/i18n/locales/vi.mjs +33 -0
  29. package/web-ui/modules/i18n/locales/zh-tw.mjs +33 -0
  30. package/web-ui/modules/i18n/locales/zh.mjs +33 -0
  31. package/web-ui/modules/plugins.methods.mjs +2 -0
  32. package/web-ui/modules/prompt-ecosystem.methods.mjs +136 -0
  33. package/web-ui/partials/index/context-health.html +45 -0
  34. package/web-ui/partials/index/modal-prompt-invocation.html +17 -0
  35. package/web-ui/partials/index/panel-plugins.html +37 -9
  36. package/web-ui/partials/index/panel-prompts.html +18 -2
  37. package/web-ui/partials/index/panel-sessions.html +14 -11
  38. package/web-ui/res/web-ui-render.precompiled.js +682 -32
  39. package/web-ui/styles/context-health.css +107 -0
  40. package/web-ui/styles/prompts-editor.css +23 -0
  41. package/web-ui/styles/sessions-preview.css +21 -0
  42. package/web-ui/styles/sub-tabs.css +181 -0
  43. package/web-ui/styles.css +2 -0
@@ -0,0 +1,107 @@
1
+ /* 复用会话详情的留白;构成色只承担数据识别。 */
2
+ .context-health {
3
+ --context-system: oklch(62% 0.08 300);
4
+ --context-user: oklch(64% 0.08 155);
5
+ --context-assistant: oklch(64% 0.08 250);
6
+ --context-tools: oklch(72% 0.09 80);
7
+ --context-code: oklch(66% 0.08 25);
8
+ min-width: 0;
9
+ margin-block: 4px 4px;
10
+ padding-block: 0;
11
+ padding-inline: var(--spacing-sm);
12
+ background: transparent;
13
+ color: var(--color-text-primary);
14
+ font-size: var(--font-size-secondary);
15
+ }
16
+ #panel-sessions .context-health + .session-export-feedback:empty { display: none; }
17
+ .context-health-header {
18
+ display: grid;
19
+ grid-template-columns: minmax(0, 1fr) auto 44px;
20
+ align-items: center;
21
+ gap: 8px;
22
+ min-height: 44px;
23
+ }
24
+ .context-health-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
25
+ .context-health-title {
26
+ min-width: 0;
27
+ margin: 0;
28
+ overflow: hidden;
29
+ color: var(--color-text-primary);
30
+ font-size: var(--font-size-body);
31
+ font-weight: var(--font-weight-secondary);
32
+ line-height: 24px;
33
+ text-overflow: ellipsis;
34
+ white-space: nowrap;
35
+ }
36
+ .context-health-meta { margin: 0; overflow: hidden; color: var(--color-text-secondary); font-size: var(--font-size-secondary); line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
37
+ .context-health-summary { display: flex; align-items: center; justify-content: flex-end; min-width: 0; min-height: 44px; }
38
+ .context-health-total { min-width: 0; color: var(--color-text-primary); font-size: var(--font-size-body); font-weight: var(--font-weight-secondary); line-height: 24px; white-space: nowrap; font-variant-numeric: tabular-nums; }
39
+ .context-health-total small { color: var(--color-text-secondary); font-size: var(--font-size-secondary); font-weight: var(--font-weight-body); }
40
+ .context-health-rating { --context-status: var(--color-text-secondary); display: inline-block; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--context-status); }
41
+ .context-health-rating.healthy { --context-status: var(--color-success); }
42
+ .context-health-rating.heavy { --context-status: var(--color-brand); }
43
+ .context-health-rating.bloated { --context-status: var(--color-error); }
44
+ .context-health-refresh {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ min-width: 44px;
49
+ min-height: 44px;
50
+ padding: 8px;
51
+ border: 0;
52
+ border-radius: 4px;
53
+ background: transparent;
54
+ box-shadow: none;
55
+ color: var(--color-text-secondary);
56
+ cursor: pointer;
57
+ transition: color 160ms ease-out, background-color 160ms ease-out;
58
+ }
59
+ .context-health-header > .context-health-refresh { grid-column: 3; }
60
+ .context-health-refresh:hover:not(:disabled) { background: var(--color-brand-light); color: var(--color-brand-dark); }
61
+ .context-health-refresh:active:not(:disabled) { background: var(--color-brand-subtle); }
62
+ .context-health-refresh:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
63
+ .context-health-refresh:disabled { opacity: 0.45; cursor: not-allowed; }
64
+ .context-health-refresh svg { flex-shrink: 0; }
65
+ .context-health-bar { display: flex; height: 4px; margin-block: 4px 12px; overflow: hidden; border-radius: 2px; background: var(--color-border-soft); }
66
+ .context-health-segment { flex-basis: 0; min-width: 0; }
67
+ .context-health-segment.system, .context-health-dot.system { background: var(--context-system); }
68
+ .context-health-segment.user, .context-health-dot.user { background: var(--context-user); }
69
+ .context-health-segment.assistant, .context-health-dot.assistant { background: var(--context-assistant); }
70
+ .context-health-segment.tools, .context-health-dot.tools { background: var(--context-tools); }
71
+ .context-health-segment.code, .context-health-dot.code { background: var(--context-code); }
72
+ .context-health-legend { margin: 0; }
73
+ .context-health-legend > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 32px; padding-block: 4px; }
74
+ .context-health-legend dt { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--color-text-secondary); font-size: var(--font-size-secondary); line-height: 20px; }
75
+ .context-health-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
76
+ .context-health-legend dd { display: grid; grid-template-columns: minmax(64px, auto) 56px; gap: 8px; margin: 0; text-align: right; line-height: 20px; }
77
+ .context-health-category-tokens { color: var(--color-text-primary); font-size: var(--font-size-secondary); font-weight: var(--font-weight-secondary); }
78
+ .context-health-category-share { color: var(--color-text-secondary); font-size: var(--font-size-secondary); }
79
+ .context-health-note { max-width: 72ch; margin: 8px 0 0; color: var(--color-text-secondary); font-size: var(--font-size-secondary); line-height: 20px; overflow-wrap: anywhere; }
80
+ .context-health-error { margin-block: 8px 0; }
81
+ .context-health-value-skeleton, .context-health-share-skeleton, .context-health-summary-skeleton span { display: block; justify-self: end; height: 8px; border-radius: 2px; background: var(--color-border-soft); }
82
+ .context-health-value-skeleton { width: 48px; }
83
+ .context-health-share-skeleton { width: 32px; }
84
+ .context-health-summary-skeleton { width: 96px; }
85
+ .context-health-summary-skeleton span { width: 80px; }
86
+ .context-health-focused-message { min-width: 0; margin-block: 16px; scroll-margin-top: 64px; }
87
+ .context-health-focused-message header { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
88
+ .context-health-focused-message header > div { min-width: 0; }
89
+ .context-health-focused-message header .context-health-meta { display: block; margin-top: 4px; }
90
+ .context-health-focused-message pre { max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin-block: 12px 0; padding: 16px; background: var(--color-surface-alt); }
91
+ .context-health-focused-message:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 4px; }
92
+ @container session-preview (max-width: 480px) {
93
+ .context-health-header { grid-template-columns: minmax(0, 1fr) auto 44px; grid-template-rows: 24px 24px; }
94
+ .context-health-heading { grid-column: 1 / 3; grid-row: 1; }
95
+ .context-health-summary { grid-column: 1 / 3; grid-row: 2; justify-content: flex-start; min-height: 24px; }
96
+ .context-health-header > .context-health-refresh { grid-column: 3; grid-row: 1 / 3; }
97
+ }
98
+ @media (max-width: 480px) {
99
+ .context-health-header { grid-template-columns: minmax(0, 1fr) auto 44px; grid-template-rows: 24px 24px; }
100
+ .context-health-heading { grid-column: 1 / 3; grid-row: 1; }
101
+ .context-health-summary { grid-column: 1 / 3; grid-row: 2; justify-content: flex-start; min-height: 24px; }
102
+ .context-health-header > .context-health-refresh { grid-column: 3; grid-row: 1 / 3; }
103
+ .context-health-legend > div { gap: 8px; }
104
+ }
105
+ @media (prefers-reduced-motion: reduce) {
106
+ .context-health-refresh { transition: none; }
107
+ }
@@ -356,3 +356,26 @@
356
356
  opacity: 0.6;
357
357
  cursor: not-allowed;
358
358
  }
359
+
360
+ /* 模板调用弹窗:保持多行变量、焦点与窄屏可访问。 */
361
+ .prompt-invocation-dialog {
362
+ max-width: min(640px, calc(100vw - 32px));
363
+ }
364
+
365
+ .prompt-invocation-fields {
366
+ display: grid;
367
+ gap: 12px;
368
+ max-height: 60vh;
369
+ overflow-y: auto;
370
+ margin-block: 16px;
371
+ }
372
+
373
+ .prompt-invocation-dialog :is(textarea, button) {
374
+ min-height: 44px;
375
+ }
376
+
377
+ .prompt-history-diff {
378
+ max-height: 320px;
379
+ overflow: auto;
380
+ margin-block: 8px;
381
+ }
@@ -919,3 +919,24 @@
919
919
  min-height: 0;
920
920
  }
921
921
  }
922
+
923
+
924
+ /* 会话操作仅显示图标;保留旧标签节点与按钮契约。 */
925
+ #panel-sessions .session-preview-actions button[data-icon-only="true"] {
926
+ display: inline-flex;
927
+ align-items: center;
928
+ justify-content: center;
929
+ width: 44px;
930
+ min-width: 44px;
931
+ height: 44px;
932
+ min-height: 44px;
933
+ padding: 0;
934
+ gap: 0;
935
+ flex-shrink: 0;
936
+ }
937
+ #panel-sessions .session-preview-actions button[data-icon-only="true"] > .session-action-label { display: none; }
938
+ #panel-sessions .session-preview-actions button[data-icon-only="true"] svg { width: 16px; height: 16px; }
939
+ @container session-preview (max-width: 620px) {
940
+ #panel-sessions .session-preview-actions { align-items: flex-start; }
941
+ #panel-sessions .session-secondary-actions { flex-wrap: wrap; }
942
+ }
@@ -0,0 +1,181 @@
1
+ /* 面板子导航共享外观;保留模板、显隐条件与主题颜色。 */
2
+ :is(
3
+ #panel-prompts, #panel-settings, #panel-plugins, #panel-sessions, #panel-market,
4
+ #panel-config-provider, #panel-config-claude, #panel-config-openclaw,
5
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi
6
+ ) {
7
+ --sub-tab-gap: 2px;
8
+ --sub-tab-min-size: 44px;
9
+ --sub-tab-padding: 7px 10px 8px;
10
+ --sub-tab-line-width: 2px;
11
+ --sub-tab-focus-offset: -4px;
12
+ --sub-tab-transition: color var(--transition-fast) var(--ease-smooth),
13
+ border-color var(--transition-fast) var(--ease-smooth);
14
+ }
15
+
16
+ /* 不设置 display,保留移动端编辑/预览开关的原有显隐。 */
17
+ :is(
18
+ #panel-prompts .prompts-md-tabs,
19
+ #panel-prompts .prompts-mobile-view-switch,
20
+ #panel-settings .settings-tab-header > .segmented-control,
21
+ #panel-plugins .plugins-list,
22
+ #panel-plugins .prompt-templates-modebar,
23
+ #panel-sessions .session-source-pills,
24
+ #panel-market .skills-target-switch,
25
+ :is(#panel-config-provider, #panel-config-claude, #panel-config-openclaw,
26
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi) > .segmented-control
27
+ ) {
28
+ align-items: center;
29
+ justify-content: flex-start;
30
+ flex-direction: row;
31
+ flex-wrap: nowrap;
32
+ gap: var(--sub-tab-gap);
33
+ width: fit-content;
34
+ min-width: 0;
35
+ max-width: 100%;
36
+ padding: 0;
37
+ border: 0;
38
+ border-bottom: 1px solid var(--color-border-soft);
39
+ border-radius: 0;
40
+ background: transparent;
41
+ box-shadow: none;
42
+ backdrop-filter: none;
43
+ overflow-x: auto;
44
+ overflow-y: hidden;
45
+ }
46
+
47
+ :is(
48
+ #panel-prompts .prompts-md-tab,
49
+ #panel-prompts .prompts-mobile-view-btn,
50
+ #panel-settings .settings-tab-header .segmented-option,
51
+ #panel-plugins .plugins-item,
52
+ #panel-plugins .mode-pill,
53
+ #panel-sessions .session-source-pill,
54
+ #panel-market .skills-target-chip,
55
+ :is(#panel-config-provider, #panel-config-claude, #panel-config-openclaw,
56
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi) > .segmented-control > .segment
57
+ ) {
58
+ display: inline-flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ flex: 0 0 auto;
62
+ width: auto;
63
+ min-width: var(--sub-tab-min-size);
64
+ min-height: var(--sub-tab-min-size);
65
+ padding: var(--sub-tab-padding);
66
+ border: 0;
67
+ border-bottom: var(--sub-tab-line-width) solid transparent;
68
+ border-radius: 0;
69
+ background: transparent;
70
+ box-shadow: none;
71
+ color: var(--color-text-secondary);
72
+ font-family: var(--font-family);
73
+ font-size: var(--font-size-body);
74
+ font-weight: var(--font-weight-secondary);
75
+ line-height: 1.4;
76
+ letter-spacing: 0;
77
+ white-space: nowrap;
78
+ cursor: pointer;
79
+ outline: none;
80
+ transform: none;
81
+ transition: var(--sub-tab-transition);
82
+ }
83
+
84
+ :is(
85
+ #panel-prompts .prompts-md-tab,
86
+ #panel-prompts .prompts-mobile-view-btn,
87
+ #panel-settings .settings-tab-header .segmented-option,
88
+ #panel-plugins .plugins-item,
89
+ #panel-plugins .mode-pill,
90
+ #panel-sessions .session-source-pill,
91
+ #panel-market .skills-target-chip,
92
+ :is(#panel-config-provider, #panel-config-claude, #panel-config-openclaw,
93
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi) > .segmented-control > .segment
94
+ ):hover:not(:disabled):not(.active) {
95
+ color: var(--color-text-primary);
96
+ background: transparent;
97
+ transform: none;
98
+ }
99
+
100
+ :is(
101
+ #panel-prompts .prompts-md-tab,
102
+ #panel-prompts .prompts-mobile-view-btn,
103
+ #panel-settings .settings-tab-header .segmented-option,
104
+ #panel-plugins .plugins-item,
105
+ #panel-plugins .mode-pill,
106
+ #panel-sessions .session-source-pill,
107
+ #panel-market .skills-target-chip,
108
+ :is(#panel-config-provider, #panel-config-claude, #panel-config-openclaw,
109
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi) > .segmented-control > .segment
110
+ ).active {
111
+ color: var(--color-brand-dark);
112
+ border-bottom-color: var(--color-brand);
113
+ background: transparent;
114
+ box-shadow: none;
115
+ }
116
+
117
+ :is(
118
+ #panel-prompts .prompts-md-tab,
119
+ #panel-prompts .prompts-mobile-view-btn,
120
+ #panel-settings .settings-tab-header .segmented-option,
121
+ #panel-plugins .plugins-item,
122
+ #panel-plugins .mode-pill,
123
+ #panel-sessions .session-source-pill,
124
+ #panel-market .skills-target-chip,
125
+ :is(#panel-config-provider, #panel-config-claude, #panel-config-openclaw,
126
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi) > .segmented-control > .segment
127
+ ):focus-visible {
128
+ outline: var(--sub-tab-line-width) solid var(--color-brand-dark);
129
+ outline-offset: var(--sub-tab-focus-offset);
130
+ box-shadow: none;
131
+ }
132
+
133
+ :is(
134
+ #panel-prompts .prompts-md-tab,
135
+ #panel-prompts .prompts-mobile-view-btn,
136
+ #panel-settings .settings-tab-header .segmented-option,
137
+ #panel-plugins .plugins-item,
138
+ #panel-plugins .mode-pill,
139
+ #panel-sessions .session-source-pill,
140
+ #panel-market .skills-target-chip,
141
+ :is(#panel-config-provider, #panel-config-claude, #panel-config-openclaw,
142
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi) > .segmented-control > .segment
143
+ ):disabled {
144
+ opacity: 0.5;
145
+ cursor: not-allowed;
146
+ }
147
+
148
+ /* 使用一条底边框,移除插件模式按钮的第二条选中线。 */
149
+ #panel-plugins .mode-pill.active::after {
150
+ content: none;
151
+ }
152
+
153
+ #panel-plugins .plugins-item .plugins-item-title,
154
+ #panel-sessions .session-source-pill-label {
155
+ font-size: inherit;
156
+ font-weight: inherit;
157
+ line-height: inherit;
158
+ color: inherit;
159
+ }
160
+
161
+ /* 已知来源继续使用原有主题调色;其他来源不再保留白色选中圆点。 */
162
+ #panel-sessions .session-source-pill-dot {
163
+ box-shadow: none;
164
+ }
165
+
166
+ #panel-sessions .session-source-pill:not(:is(
167
+ [data-source="codex"], [data-source="claude"],
168
+ [data-source="gemini"], [data-source="codebuddy"]
169
+ )) .session-source-pill-dot {
170
+ background: var(--color-text-muted);
171
+ }
172
+
173
+ @media (prefers-reduced-motion: reduce) {
174
+ :is(
175
+ #panel-prompts, #panel-settings, #panel-plugins, #panel-sessions, #panel-market,
176
+ #panel-config-provider, #panel-config-claude, #panel-config-openclaw,
177
+ #panel-config-opencode, #panel-config-kilocode, #panel-config-pi
178
+ ) {
179
+ --sub-tab-transition: none;
180
+ }
181
+ }
package/web-ui/styles.css CHANGED
@@ -23,5 +23,7 @@
23
23
  @import url('./styles/trash-panel.css');
24
24
  @import url('./styles/system-prompt.css');
25
25
  @import url('./styles/prompts-editor.css');
26
+ @import url('./styles/context-health.css');
26
27
  @import url('./styles/theme-dark.css');
27
28
  @import url('./styles/theme-ocean.css');
29
+ @import url('./styles/sub-tabs.css');