@kabmo-labs/kabmo 0.15.0 → 0.17.0

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 (177) hide show
  1. package/README.md +3 -2
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +412 -394
  4. package/dist/client/static/js/index-3ve31rzx.css +1 -0
  5. package/dist/client/static/js/{index-mx658m43.js → index-rerjq5th.js} +846 -844
  6. package/marketplace/plugins/stats/README.md +27 -8
  7. package/marketplace/plugins/stats/package.json +2 -2
  8. package/marketplace/plugins/stats/src/HeaderReadout.test.tsx +2 -1
  9. package/marketplace/plugins/stats/src/HeaderReadout.tsx +6 -2
  10. package/marketplace/plugins/stats/src/KillConfirm.test.tsx +159 -0
  11. package/marketplace/plugins/stats/src/KillConfirm.tsx +145 -0
  12. package/marketplace/plugins/stats/src/ProcessTable.tsx +54 -8
  13. package/marketplace/plugins/stats/src/TotalsBar.test.tsx +5 -2
  14. package/marketplace/plugins/stats/src/TotalsBar.tsx +13 -3
  15. package/marketplace/plugins/stats/src/app.test.tsx +100 -4
  16. package/marketplace/plugins/stats/src/app.tsx +51 -4
  17. package/marketplace/plugins/stats/src/groups.test.ts +1 -1
  18. package/marketplace/plugins/stats/src/kill.test.ts +131 -0
  19. package/marketplace/plugins/stats/src/kill.ts +74 -0
  20. package/marketplace/plugins/stats/src/labels.test.ts +1 -0
  21. package/marketplace/plugins/stats/src/machine.test.ts +77 -0
  22. package/marketplace/plugins/stats/src/machine.ts +115 -0
  23. package/marketplace/plugins/stats/src/proc/darwin.ts +38 -0
  24. package/marketplace/plugins/stats/src/proc/linux.ts +4 -0
  25. package/marketplace/plugins/stats/src/proc/ps.ts +1 -0
  26. package/marketplace/plugins/stats/src/proc/types.ts +11 -0
  27. package/marketplace/plugins/stats/src/sampler.test.ts +42 -4
  28. package/marketplace/plugins/stats/src/sampler.ts +32 -18
  29. package/marketplace/plugins/stats/src/server.ts +29 -2
  30. package/marketplace/plugins/stats/src/snapshot.ts +31 -3
  31. package/package.json +3 -2
  32. package/src/client/components/common/Modal.tsx +7 -0
  33. package/src/client/components/common/code-surface/bracket-guide.test.ts +2 -2
  34. package/src/client/components/common/code-surface/bracket-guide.ts +2 -2
  35. package/src/client/components/common/code-surface/conflict-markers.ts +5 -5
  36. package/src/client/components/common/code-surface/extensions.ts +7 -4
  37. package/src/client/components/common/code-surface/theme.ts +34 -9
  38. package/src/client/components/common/code-surface/whitespace.test.ts +223 -0
  39. package/src/client/components/common/code-surface/whitespace.ts +140 -0
  40. package/src/client/components/common/{server-switcher/index.tsx → server-control/Panel.tsx} +73 -35
  41. package/src/client/components/common/{server-switcher → server-control}/index.test.tsx +98 -37
  42. package/src/client/components/common/server-control/index.tsx +118 -0
  43. package/src/client/components/layout/LeftDock.tsx +1 -0
  44. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +8 -50
  45. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +1 -0
  46. package/src/client/components/mobile/RightSidebar.tsx +1 -0
  47. package/src/client/components/mobile/mobile-main-view/Header.tsx +6 -12
  48. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +41 -13
  49. package/src/client/components/mobile/mobile-session-sidebar/use-dock.ts +1 -0
  50. package/src/client/components/settings/Modal.tsx +9 -3
  51. package/src/client/components/settings/ProjectSelectorDropdown.tsx +19 -9
  52. package/src/client/components/settings/categories/AgentSettings.tsx +27 -6
  53. package/src/client/components/settings/categories/ProjectSettings.tsx +122 -156
  54. package/src/client/components/settings/categories/SkillCatalogSettings.tsx +220 -260
  55. package/src/client/components/settings/categories/SkillSettings.tsx +6 -3
  56. package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +5 -0
  57. package/src/client/components/settings/categories/project-settings/AccentPalette.test.tsx +189 -0
  58. package/src/client/components/settings/categories/project-settings/AccentPalette.tsx +156 -24
  59. package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +175 -0
  60. package/src/client/components/settings/categories/project-settings/DeleteProjectModal.tsx +107 -0
  61. package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +40 -24
  62. package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +17 -7
  63. package/src/client/components/settings/categories/project-settings/IconGrid.tsx +164 -69
  64. package/src/client/components/settings/categories/project-settings/ModelDropdown.test.tsx +122 -0
  65. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +124 -53
  66. package/src/client/components/settings/categories/project-settings/NameInput.tsx +57 -11
  67. package/src/client/components/settings/categories/project-settings/PathField.tsx +122 -0
  68. package/src/client/components/settings/categories/project-settings/SidebarList.tsx +100 -59
  69. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +253 -0
  70. package/src/client/components/settings/categories/skill-catalog/SkillCard.tsx +89 -0
  71. package/src/client/components/settings/categories/skill-catalog/SourceRail.tsx +122 -0
  72. package/src/client/components/settings/categories/skill-catalog/catalog-ui.test.tsx +179 -0
  73. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +208 -0
  74. package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +137 -232
  75. package/src/client/components/settings/categories/skill-settings/InstructionsEditor.tsx +84 -0
  76. package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +123 -87
  77. package/src/client/components/settings/categories/skill-settings/pane.test.tsx +179 -0
  78. package/src/client/components/settings/categories/skill-settings/row-meta.ts +58 -0
  79. package/src/client/components/workspace/chat-timeline/index.tsx +6 -1
  80. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.test.ts +46 -0
  81. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -6
  82. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +29 -0
  83. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +11 -3
  84. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +24 -1
  85. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +6 -2
  86. package/src/client/components/workspace/editor/viewers/SvgPreview.tsx +18 -2
  87. package/src/client/components/workspace/editor/viewers/viewers.test.ts +39 -0
  88. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +18 -5
  89. package/src/client/components/workspace/file-explorer/Modals.tsx +15 -1
  90. package/src/client/components/workspace/file-explorer/RowLabel.tsx +68 -0
  91. package/src/client/components/workspace/file-explorer/TreeItem.tsx +47 -57
  92. package/src/client/components/workspace/file-explorer/collapsed-chain.test.ts +167 -0
  93. package/src/client/components/workspace/file-explorer/drag-props.ts +42 -0
  94. package/src/client/components/workspace/file-explorer/drag.test.ts +43 -0
  95. package/src/client/components/workspace/file-explorer/index.tsx +21 -20
  96. package/src/client/components/workspace/model-dropdown/Panel.tsx +7 -2
  97. package/src/client/components/workspace/model-dropdown/Section.test.tsx +13 -0
  98. package/src/client/components/workspace/model-dropdown/Section.tsx +5 -1
  99. package/src/client/components/workspace/panels/builtin.tsx +7 -0
  100. package/src/client/components/workspace/wiki-panel/NavModal.test.tsx +136 -0
  101. package/src/client/components/workspace/wiki-panel/NavModal.tsx +94 -0
  102. package/src/client/components/workspace/wiki-panel/PageView.tsx +16 -10
  103. package/src/client/components/workspace/wiki-panel/index.tsx +44 -9
  104. package/src/client/data/settings/omp-schema.json +91 -4
  105. package/src/client/data/settings/project.ts +9 -28
  106. package/src/client/data/settings/skill.ts +6 -32
  107. package/src/client/hooks/chat/timeline/pending-model.ts +28 -0
  108. package/src/client/hooks/settings/projects/index.ts +294 -0
  109. package/src/client/hooks/settings/projects.test.ts +237 -0
  110. package/src/client/hooks/settings/skill-catalog.ts +101 -9
  111. package/src/client/hooks/settings/skill-git-import.ts +153 -0
  112. package/src/client/hooks/shell/servers.test.ts +166 -0
  113. package/src/client/hooks/{desktop → shell}/servers.ts +17 -14
  114. package/src/client/hooks/ui/updates/shell-download.ts +1 -1
  115. package/src/client/hooks/ui/updates/shell-update.ts +2 -6
  116. package/src/client/hooks/workspace/file-row-drag.ts +41 -0
  117. package/src/client/hooks/workspace/file-tree-actions.ts +25 -1
  118. package/src/client/hooks/workspace/file-tree-edits.ts +23 -6
  119. package/src/client/hooks/workspace/root-drop-target.ts +77 -0
  120. package/src/client/hooks/workspace/unfolded-chains.ts +165 -0
  121. package/src/client/lib/desktop/dropped-paths.ts +1 -1
  122. package/src/client/lib/desktop/titlebar.test.ts +12 -3
  123. package/src/client/lib/desktop/titlebar.ts +1 -1
  124. package/src/client/lib/shell/desktop.ts +117 -0
  125. package/src/client/lib/shell/servers.ts +75 -0
  126. package/src/client/lib/shell/transport.ts +216 -0
  127. package/src/client/main.tsx +9 -0
  128. package/src/server/lib/db/schema.ts +11 -0
  129. package/src/server/lib/fs/git-merge-conflict.test.ts +14 -1
  130. package/src/server/lib/lifecycle/memory.test.ts +41 -1
  131. package/src/server/lib/lifecycle/memory.ts +131 -14
  132. package/src/server/lib/omp/config/skill-sources.ts +49 -0
  133. package/src/server/lib/omp/config/skills-git-install.ts +155 -0
  134. package/src/server/lib/omp/config/skills-git-repo.ts +288 -0
  135. package/src/server/lib/omp/config/skills-git.test.ts +220 -0
  136. package/src/server/lib/omp/session/subagent-presence-scan.test.ts +137 -0
  137. package/src/server/lib/omp/session/subagent-presence-scan.ts +120 -0
  138. package/src/server/lib/omp/session/subagent-presence-store.test.ts +120 -0
  139. package/src/server/lib/omp/session/subagent-presence-store.ts +65 -0
  140. package/src/server/lib/omp/session/subagent-presence.ts +52 -15
  141. package/src/server/lib/workspace/project-model.server.test.ts +102 -0
  142. package/src/server/lib/workspace/project-model.server.ts +47 -0
  143. package/src/server/lib/workspace/project-patch.server.ts +156 -0
  144. package/src/server/routes/agent/new.ts +8 -1
  145. package/src/server/routes/settings/agents.ts +19 -7
  146. package/src/server/routes/settings/projects.ts +53 -19
  147. package/src/server/routes/settings/settings-projects-routes.test.ts +214 -0
  148. package/src/server/routes/settings/settings-store-routes.test.ts +5 -2
  149. package/src/server/routes/settings/skills-catalog-actions.ts +195 -0
  150. package/src/server/routes/settings/skills.test.ts +225 -0
  151. package/src/server/routes/settings/skills.ts +18 -15
  152. package/src/shared/lib/fs/folder-chain.test.ts +81 -1
  153. package/src/shared/lib/fs/folder-chain.ts +84 -0
  154. package/src/shared/lib/omp/config/schema.test.ts +35 -0
  155. package/src/shared/lib/omp/session/job-progress.test.ts +37 -1
  156. package/src/shared/lib/omp/session/job-progress.ts +31 -0
  157. package/src/shared/lib/omp/session/proc.ts +5 -0
  158. package/src/shared/lib/omp/session/wait.ts +5 -0
  159. package/src/shared/lib/ui/mobile-overlay.ts +61 -0
  160. package/src/shared/lib/ui/svg-scope.test.ts +97 -0
  161. package/src/shared/lib/ui/svg-scope.ts +134 -0
  162. package/src/shared/lib/workspace/project-accent.test.ts +69 -0
  163. package/src/shared/lib/workspace/project-accent.ts +63 -0
  164. package/src/shared/lib/workspace/project-icon.ts +40 -0
  165. package/src/shared/lib/workspace/project-model.test.ts +79 -0
  166. package/src/shared/lib/workspace/project-model.ts +64 -0
  167. package/src/shared/types/settings/skill.ts +53 -3
  168. package/src/test-support/file-explorer-disk.test-util.ts +25 -1
  169. package/src/test-support/file-explorer-drag.test-util.ts +88 -0
  170. package/src/test-support/file-explorer.test-util.ts +47 -47
  171. package/dist/client/static/js/index-28pwtt69.css +0 -1
  172. package/src/client/components/common/code-surface/indent-guide.ts +0 -104
  173. package/src/client/components/settings/categories/skill-catalog/AddSourceModal.tsx +0 -133
  174. package/src/client/hooks/desktop/servers.test.ts +0 -73
  175. package/src/client/lib/desktop/bridge.ts +0 -203
  176. package/src/shared/lib/code/editor/indent-guide-rule.test.ts +0 -65
  177. package/src/shared/lib/code/editor/indent-guide-rule.ts +0 -47
@@ -1,7 +1,15 @@
1
+ import { ChevronDown, ChevronRight, EyeOff, Lock, Plus, Search } from 'lucide-preact';
1
2
  import { useState } from 'preact/hooks';
2
- import { ChevronDown, ChevronRight, Plus } from 'lucide-preact';
3
3
  import type { SkillItem } from '@/shared/types';
4
4
  import { ProjectSelectorDropdown, type ProjectOption } from '@/client/components/settings/ProjectSelectorDropdown';
5
+ import {
6
+ SKILL_FILTERS,
7
+ filterCounts,
8
+ filterSkills,
9
+ scopeLabel,
10
+ sourceBadge,
11
+ type SkillFilter,
12
+ } from '@/client/components/settings/categories/skill-settings/row-meta';
5
13
 
6
14
  interface SkillSidebarListProps {
7
15
  skills: SkillItem[];
@@ -9,51 +17,77 @@ interface SkillSidebarListProps {
9
17
  isCreatingNew: boolean;
10
18
  onSelectSkill: (id: string) => void;
11
19
  onAddNewSkill: () => void;
20
+ onImportFromGit: () => void;
21
+ onOpenCatalog: () => void;
12
22
  selectedProject: string;
13
23
  onSelectProject: (project: string) => void;
14
24
  /** Real workspace folders; defaults to the shared placeholder list. */
15
25
  projectOptions?: ProjectOption[];
16
26
  }
17
27
 
28
+ /**
29
+ * The skills list: one omp scope at a time, searched and filtered in place.
30
+ *
31
+ * The counts on the filter chips are computed over the WHOLE list, so a chip
32
+ * never disappears when its own filter is active — that is what makes "4
33
+ * managed" a fact about the scope rather than about what is currently visible.
34
+ */
18
35
  export function SkillSidebarList({
19
36
  skills,
20
37
  selectedSkillId,
21
38
  isCreatingNew,
22
39
  onSelectSkill,
23
40
  onAddNewSkill,
41
+ onImportFromGit,
42
+ onOpenCatalog,
24
43
  selectedProject,
25
44
  onSelectProject,
26
45
  projectOptions,
27
46
  }: SkillSidebarListProps) {
28
47
  const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
48
+ const [query, setQuery] = useState('');
49
+ const [filter, setFilter] = useState<SkillFilter>('all');
29
50
 
30
- const toggleGroup = (groupName: string) => {
31
- setCollapsedGroups((prev) => ({
32
- ...prev,
33
- [groupName]: !prev[groupName],
34
- }));
35
- };
51
+ const visible = filterSkills(skills, query, filter);
52
+ const counts = filterCounts(skills);
36
53
 
37
- // Group skills by group property or standalone
38
54
  const groupedSkills: Record<string, SkillItem[]> = {};
39
55
  const standaloneSkills: SkillItem[] = [];
56
+ for (const skill of visible) {
57
+ if (skill.group) (groupedSkills[skill.group] ??= []).push(skill);
58
+ else standaloneSkills.push(skill);
59
+ }
40
60
 
41
- skills.forEach((skill) => {
42
- if (skill.group) {
43
- if (!groupedSkills[skill.group]) {
44
- groupedSkills[skill.group] = [];
45
- }
46
- groupedSkills[skill.group].push(skill);
47
- } else {
48
- standaloneSkills.push(skill);
49
- }
50
- });
61
+ const toggleGroup = (groupName: string) => {
62
+ setCollapsedGroups((prev) => ({ ...prev, [groupName]: !prev[groupName] }));
63
+ };
51
64
 
52
- const totalCount = skills.length;
65
+ const renderRow = (skill: SkillItem) => {
66
+ const isSelected = !isCreatingNew && selectedSkillId === skill.id;
67
+ return (
68
+ <button
69
+ key={skill.id}
70
+ type="button"
71
+ onClick={() => onSelectSkill(skill.id)}
72
+ className={`w-full text-left px-2 py-1.5 rounded-lg transition-colors cursor-pointer ${
73
+ isSelected ? 'bg-ink/10 text-ink shadow-2xs' : 'text-ink/75 hover:bg-ink/5 hover:text-ink'
74
+ }`}
75
+ >
76
+ <div className="flex items-center gap-1.5 min-w-0">
77
+ <span className="truncate text-xs font-medium">{skill.name}</span>
78
+ {skill.hidden ? <EyeOff size={11} className="text-ink/40 flex-shrink-0" title="Hidden from the model" /> : null}
79
+ {skill.managed !== true ? <Lock size={10} className="text-ink/35 flex-shrink-0" title="Read-only" /> : null}
80
+ </div>
81
+ <div className="flex items-center gap-1.5 text-[10px] text-ink/45 mt-0.5">
82
+ <span className="font-mono px-1 rounded bg-ink/5 flex-shrink-0">{sourceBadge(skill)}</span>
83
+ <span className="truncate">{scopeLabel(skill)}</span>
84
+ </div>
85
+ </button>
86
+ );
87
+ };
53
88
 
54
89
  return (
55
90
  <div className="w-full md:w-64 md:border-r border-ink/10 h-full flex flex-col bg-paper/50 flex-shrink-0">
56
- {/* Project Selector Dropdown */}
57
91
  <ProjectSelectorDropdown
58
92
  variant="compact"
59
93
  selectedProject={selectedProject}
@@ -64,37 +98,60 @@ export function SkillSidebarList({
64
98
  }
65
99
  />
66
100
 
67
- {/* Counter Header */}
68
- <div className="px-3.5 py-2.5 border-b border-ink/10 flex items-center justify-between">
69
- <span className="text-xs font-semibold text-ink">
70
- Total {totalCount}
71
- </span>
101
+ <div className="px-3 pt-2.5 pb-2 space-y-2 border-b border-ink/10">
102
+ <div className="relative">
103
+ <Search size={13} className="absolute left-2 top-1.5 text-ink/40 pointer-events-none" />
104
+ <input
105
+ type="text"
106
+ value={query}
107
+ onInput={(event) => setQuery(event.currentTarget.value)}
108
+ placeholder="Filter skills…"
109
+ className="w-full pl-7 pr-2 py-1 rounded-md border border-ink/20 bg-paper focus:outline-none focus:border-ink text-[11px] text-ink transition-colors"
110
+ />
111
+ </div>
112
+ <div className="flex flex-wrap gap-1">
113
+ {SKILL_FILTERS.map((entry) => (
114
+ <button
115
+ key={entry.id}
116
+ type="button"
117
+ onClick={() => setFilter(entry.id)}
118
+ className={`px-1.5 py-0.5 rounded-md text-[10px] font-medium transition-colors cursor-pointer ${
119
+ filter === entry.id ? 'bg-ink text-paper' : 'text-ink/60 hover:bg-ink/5 hover:text-ink'
120
+ }`}
121
+ >
122
+ {entry.label} {counts[entry.id]}
123
+ </button>
124
+ ))}
125
+ </div>
72
126
  <button
73
127
  type="button"
74
128
  onClick={onAddNewSkill}
75
- title="Create New Skill"
76
- className="p-1 rounded-md text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer"
129
+ className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-lg bg-ink text-paper text-[11px] font-medium hover:bg-ink/90 transition-colors cursor-pointer"
77
130
  >
78
- <Plus size={15} strokeWidth={2.2} />
131
+ <Plus size={13} />
132
+ <span>New skill</span>
79
133
  </button>
80
134
  </div>
81
135
 
82
- {/* Skills List */}
83
136
  <div className="flex-1 scrollbar-overlay-container p-1.5 space-y-2">
84
- {/* The picker above names the scope; the list is exactly that scope's
85
- skills, so a second scope claim here would only be able to lie. */}
86
- <div className="px-2 pt-1 pb-0.5 text-[10px] font-bold text-ink/50 uppercase tracking-wider">
87
- SKILLS
88
- </div>
137
+ {isCreatingNew ? (
138
+ <div className="px-2.5 py-1.5 rounded-lg bg-ink/10 text-ink font-medium text-xs">new-skill</div>
139
+ ) : null}
89
140
 
90
- {/* Temporary "New Skill" indicator item */}
91
- {isCreatingNew && (
92
- <div className="px-2.5 py-1.5 rounded-lg bg-ink/10 text-ink font-medium text-xs shadow-2xs">
93
- <span className="truncate">new-skill</span>
141
+ {visible.length === 0 ? (
142
+ <div className="px-2.5 py-6 text-center space-y-1">
143
+ <p className="text-[11px] text-ink/60">
144
+ {skills.length === 0 ? 'No skills in this scope.' : 'Nothing matches that filter.'}
145
+ </p>
146
+ {skills.length === 0 ? (
147
+ <p className="text-[10px] text-ink/45">
148
+ Create one with <span className="font-semibold">New skill</span>, import a repository, or browse the
149
+ catalog.
150
+ </p>
151
+ ) : null}
94
152
  </div>
95
- )}
153
+ ) : null}
96
154
 
97
- {/* Grouped Skills */}
98
155
  {Object.entries(groupedSkills).map(([groupName, groupItems]) => {
99
156
  const isCollapsed = !!collapsedGroups[groupName];
100
157
  return (
@@ -102,7 +159,7 @@ export function SkillSidebarList({
102
159
  <button
103
160
  type="button"
104
161
  onClick={() => toggleGroup(groupName)}
105
- className="w-full flex items-center justify-between px-2 py-1 rounded-md text-xs font-semibold text-ink/80 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer"
162
+ className="w-full flex items-center justify-between px-2 py-1 rounded-md text-ink/80 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer"
106
163
  >
107
164
  <div className="flex items-center gap-1.5 truncate">
108
165
  {isCollapsed ? (
@@ -110,60 +167,39 @@ export function SkillSidebarList({
110
167
  ) : (
111
168
  <ChevronDown size={13} className="text-ink/60" />
112
169
  )}
113
- <span className="truncate tracking-tight uppercase text-[11px] font-bold text-ink/90">
170
+ <span className="truncate text-[11px] font-bold uppercase tracking-tight text-ink/90">
114
171
  {groupName}
115
172
  </span>
116
173
  </div>
117
- <span className="text-[10px] font-mono text-ink/50 px-1.5 py-0.2 rounded bg-ink/5">
118
- {groupItems.length}
119
- </span>
174
+ <span className="text-[10px] font-mono text-ink/50 px-1.5 rounded bg-ink/5">{groupItems.length}</span>
120
175
  </button>
121
-
122
- {!isCollapsed && (
123
- <div className="pl-3 space-y-0.5 border-l border-ink/10 ml-2.5">
124
- {groupItems.map((skill) => {
125
- const isSelected = !isCreatingNew && selectedSkillId === skill.id;
126
- return (
127
- <button
128
- key={skill.id}
129
- type="button"
130
- onClick={() => onSelectSkill(skill.id)}
131
- className={`w-full text-left px-2.5 py-1.5 rounded-lg text-xs transition-colors cursor-pointer truncate block ${
132
- isSelected
133
- ? 'bg-ink/10 text-ink font-medium shadow-2xs'
134
- : 'text-ink/70 hover:bg-ink/5 hover:text-ink'
135
- }`}
136
- >
137
- {skill.name}
138
- </button>
139
- );
140
- })}
141
- </div>
142
- )}
176
+ {!isCollapsed ? (
177
+ <div className="pl-3 space-y-0.5 border-l border-ink/10 ml-2.5">{groupItems.map(renderRow)}</div>
178
+ ) : null}
143
179
  </div>
144
180
  );
145
181
  })}
146
182
 
147
- {/* Standalone Skills */}
148
- <div className="space-y-0.5 pt-1">
149
- {standaloneSkills.map((skill) => {
150
- const isSelected = !isCreatingNew && selectedSkillId === skill.id;
151
- return (
152
- <button
153
- key={skill.id}
154
- type="button"
155
- onClick={() => onSelectSkill(skill.id)}
156
- className={`w-full text-left px-2.5 py-1.5 rounded-lg text-xs transition-colors cursor-pointer truncate block ${
157
- isSelected
158
- ? 'bg-ink/10 text-ink font-medium shadow-2xs'
159
- : 'text-ink/70 hover:bg-ink/5 hover:text-ink'
160
- }`}
161
- >
162
- {skill.name}
163
- </button>
164
- );
165
- })}
166
- </div>
183
+ {standaloneSkills.length > 0 ? (
184
+ <div className="space-y-0.5 pt-1">{standaloneSkills.map(renderRow)}</div>
185
+ ) : null}
186
+ </div>
187
+
188
+ <div className="p-2 border-t border-ink/10 space-y-1">
189
+ <button
190
+ type="button"
191
+ onClick={onImportFromGit}
192
+ className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-lg border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink hover:bg-ink/5 transition-colors cursor-pointer"
193
+ >
194
+ Import from Git
195
+ </button>
196
+ <button
197
+ type="button"
198
+ onClick={onOpenCatalog}
199
+ className="w-full px-2 py-1.5 rounded-lg text-[11px] font-medium text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer"
200
+ >
201
+ Browse the catalog
202
+ </button>
167
203
  </div>
168
204
  </div>
169
205
  );
@@ -0,0 +1,179 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The skills sidebar's search/filter behaviour and the detail pane's save gating.
8
+ *
9
+ * Three facts are pinned, each of which was a way for the pane to lie:
10
+ *
11
+ * - **A filter chip's count is over the WHOLE scope.** Counting the visible rows
12
+ * made every chip read `0` as soon as it was not the active one, so "Read-only
13
+ * 5" disappeared the moment a user looked for it.
14
+ * - **Save stays disabled until the draft differs from disk.** The old pane
15
+ * offered a permanent "Save Changes" that rewrote an unchanged SKILL.md.
16
+ * - **A missing description is a blocking error, not a hint.** omp refuses to load
17
+ * a SKILL.md without one, so a save that succeeds would create a skill that
18
+ * never runs.
19
+ */
20
+
21
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
22
+ import { Window } from 'happy-dom';
23
+ import { h, render } from 'preact';
24
+ import { act } from 'preact/test-utils';
25
+ import type { SkillItem } from '@/shared/types';
26
+ import {
27
+ SKILL_FILTERS,
28
+ filterCounts,
29
+ filterSkills,
30
+ scopeLabel,
31
+ sourceBadge,
32
+ } from '@/client/components/settings/categories/skill-settings/row-meta';
33
+ import { SkillDetailPane } from '@/client/components/settings/categories/skill-settings/DetailPane';
34
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
35
+
36
+ let container: HTMLElement;
37
+
38
+ beforeAll(() => {
39
+ installDomGlobals(new Window({ url: 'http://localhost' }));
40
+ });
41
+
42
+ afterEach(() => {
43
+ if (container) render(null, container);
44
+ });
45
+
46
+ afterAll(() => {
47
+ restoreDomGlobals();
48
+ });
49
+
50
+ function mount(node: h.JSX.Element): HTMLElement {
51
+ container = document.createElement('div');
52
+ document.body.append(container);
53
+ act(() => render(node, container));
54
+ return container;
55
+ }
56
+
57
+ function skill(overrides: Partial<SkillItem> = {}): SkillItem {
58
+ return {
59
+ id: 'omp-user-alpha',
60
+ name: 'alpha',
61
+ description: 'First skill',
62
+ location: 'user',
63
+ instructions: '---\ndescription: First skill\n---\n\ndo the thing\n',
64
+ project: 'omp',
65
+ source: 'native:user',
66
+ managed: true,
67
+ ...overrides,
68
+ };
69
+ }
70
+
71
+ const LIST: SkillItem[] = [
72
+ skill(),
73
+ skill({
74
+ id: 'omp-project-beta',
75
+ name: 'beta',
76
+ description: 'Second skill',
77
+ source: 'native:project',
78
+ location: 'project',
79
+ hidden: true,
80
+ }),
81
+ skill({ id: 'omp-user-gamma', name: 'gamma', description: 'Third skill', source: 'agents:user', managed: false }),
82
+ ];
83
+
84
+ describe('row metadata', () => {
85
+ test('a discovery source reads as a short badge', () => {
86
+ expect(sourceBadge(LIST[0]!)).toBe('omp');
87
+ expect(sourceBadge(LIST[2]!)).toBe('agents');
88
+ expect(sourceBadge(skill({ source: undefined }))).toBe('other');
89
+ });
90
+
91
+ test('the scope comes from the source, not from the location field', () => {
92
+ expect(scopeLabel(LIST[0]!)).toBe('user');
93
+ expect(scopeLabel(LIST[1]!)).toBe('project');
94
+ });
95
+ });
96
+
97
+ describe('filterSkills and filterCounts', () => {
98
+ test('chips count the whole scope, not the visible rows', () => {
99
+ const counts = filterCounts(LIST);
100
+ expect(counts).toEqual({ all: 3, managed: 2, 'read-only': 1, hidden: 1 });
101
+ // The count of a filter that is NOT active is still its real count.
102
+ expect(counts[SKILL_FILTERS[1]!.id]).toBe(2);
103
+ });
104
+
105
+ test('managed and read-only partition the list', () => {
106
+ expect(filterSkills(LIST, '', 'managed').map((item) => item.name)).toEqual(['alpha', 'beta']);
107
+ expect(filterSkills(LIST, '', 'read-only').map((item) => item.name)).toEqual(['gamma']);
108
+ });
109
+
110
+ test('the search matches the name, the description and the source', () => {
111
+ expect(filterSkills(LIST, 'gam', 'all').map((item) => item.name)).toEqual(['gamma']);
112
+ expect(filterSkills(LIST, 'Second skill', 'all').map((item) => item.name)).toEqual(['beta']);
113
+ expect(filterSkills(LIST, 'agents', 'all').map((item) => item.name)).toEqual(['gamma']);
114
+ });
115
+ });
116
+
117
+ describe('SkillDetailPane', () => {
118
+ test('an unchanged draft cannot be saved', () => {
119
+ const el = mount(
120
+ h(SkillDetailPane, { skill: skill(), isCreatingNew: false, onSave: () => {} }),
121
+ );
122
+ const save = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Save changes'));
123
+ expect(save).toBeDefined();
124
+ expect((save as HTMLButtonElement).disabled).toBe(true);
125
+ expect(el.textContent).toContain('Saved — nothing to write');
126
+ });
127
+
128
+ test('a draft missing its description reports that omp would not load it', () => {
129
+ const el = mount(
130
+ h(SkillDetailPane, {
131
+ skill: skill({ description: '' }),
132
+ isCreatingNew: false,
133
+ onSave: () => {},
134
+ }),
135
+ );
136
+ expect(el.textContent).toContain('omp does not load a SKILL.md without one');
137
+ const save = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Save changes'));
138
+ expect((save as HTMLButtonElement).disabled).toBe(true);
139
+ });
140
+
141
+ test('a read-only skill offers no editor or save at all', () => {
142
+ const el = mount(
143
+ h(SkillDetailPane, { skill: skill({ managed: false, source: 'agents:user' }), isCreatingNew: false, onSave: () => {} }),
144
+ );
145
+ expect(el.textContent).toContain('read-only');
146
+ expect(el.textContent).not.toContain('Save changes');
147
+ expect((el.querySelector('textarea') as HTMLTextAreaElement).readOnly).toBe(true);
148
+ });
149
+
150
+ test('the body the pane saves carries no second frontmatter block', () => {
151
+ const saved: Partial<SkillItem>[] = [];
152
+ const el = mount(
153
+ h(SkillDetailPane, {
154
+ skill: skill({ instructions: '---\ndescription: First skill\n---\n\ndo the thing\n' }),
155
+ isCreatingNew: false,
156
+ onSave: (draft) => saved.push(draft),
157
+ }),
158
+ );
159
+ // The pane has two textareas: the description and the SKILL.md body.
160
+ const textarea = [...el.querySelectorAll('textarea')].at(-1) as HTMLTextAreaElement;
161
+ expect(textarea.value.trim()).toBe('do the thing');
162
+
163
+ const save = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Save changes'))!;
164
+ expect((save as HTMLButtonElement).disabled).toBe(true);
165
+ act(() => {
166
+ textarea.value = 'do a different thing';
167
+ textarea.dispatchEvent(new document.defaultView!.Event('input', { bubbles: true }));
168
+ });
169
+ const after = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Save changes'))!;
170
+ expect((after as HTMLButtonElement).disabled).toBe(false);
171
+ act(() => {
172
+ // happy-dom's window is installed as a global, so the event must come from
173
+ // the document's own realm rather than a bare constructor.
174
+ after.dispatchEvent(new document.defaultView!.MouseEvent('click', { bubbles: true }));
175
+ });
176
+ expect(saved[0]?.instructions).toBe('do a different thing');
177
+ expect(saved[0]?.instructions).not.toContain('---');
178
+ });
179
+ });
@@ -0,0 +1,58 @@
1
+ import type { SkillItem } from '@/shared/types';
2
+
3
+ /** How a discovery source reads in a 16px-wide badge slot. */
4
+ export function sourceBadge(skill: SkillItem): string {
5
+ const source = skill.source ?? '';
6
+ if (source.startsWith('native:')) return 'omp';
7
+ if (source.startsWith('agents:')) return 'agents';
8
+ if (source.startsWith('claude:')) return 'claude';
9
+ if (source.startsWith('codex:')) return 'codex';
10
+ if (source.startsWith('github:')) return 'github';
11
+ if (source.startsWith('opencode:')) return 'opencode';
12
+ return source.split(':')[0] || 'other';
13
+ }
14
+
15
+ /** The one-line provenance shown under a row's name. */
16
+ export function scopeLabel(skill: SkillItem): string {
17
+ if (skill.source?.endsWith(':project')) return 'project';
18
+ if (skill.source?.endsWith(':user')) return 'user';
19
+ return skill.location;
20
+ }
21
+
22
+ export type SkillFilter = 'all' | 'managed' | 'read-only' | 'hidden';
23
+
24
+ export const SKILL_FILTERS: Array<{ id: SkillFilter; label: string }> = [
25
+ { id: 'all', label: 'All' },
26
+ { id: 'managed', label: 'Managed' },
27
+ { id: 'read-only', label: 'Read-only' },
28
+ { id: 'hidden', label: 'Hidden' },
29
+ ];
30
+
31
+ /**
32
+ * Apply the sidebar's search and filter.
33
+ *
34
+ * `managed` and `read-only` are the distinction that decides whether the detail
35
+ * pane may offer a save, so they are filters rather than a note in the header: a
36
+ * user hunting for the file they can edit should be able to hide the ones they
37
+ * cannot.
38
+ */
39
+ export function filterSkills(skills: SkillItem[], query: string, filter: SkillFilter): SkillItem[] {
40
+ const needle = query.trim().toLowerCase();
41
+ return skills.filter((skill) => {
42
+ if (filter === 'managed' && skill.managed !== true) return false;
43
+ if (filter === 'read-only' && skill.managed === true) return false;
44
+ if (filter === 'hidden' && skill.hidden !== true) return false;
45
+ if (!needle) return true;
46
+ return `${skill.name} ${skill.description} ${skill.source ?? ''}`.toLowerCase().includes(needle);
47
+ });
48
+ }
49
+
50
+ /** Counts for the filter chips, over the unfiltered list. */
51
+ export function filterCounts(skills: SkillItem[]): Record<SkillFilter, number> {
52
+ return {
53
+ all: skills.length,
54
+ managed: skills.filter((skill) => skill.managed === true).length,
55
+ 'read-only': skills.filter((skill) => skill.managed !== true).length,
56
+ hidden: skills.filter((skill) => skill.hidden === true).length,
57
+ };
58
+ }
@@ -20,6 +20,7 @@ import { useToasts } from '@/client/hooks/ui/toasts';
20
20
  import { ChatOverlays } from '@/client/components/workspace/chat-timeline/ChatOverlays';
21
21
  import { ToastStack } from '@/client/components/common/ToastStack';
22
22
  import { composerRootFor } from '@/shared/lib/workspace/active-project';
23
+ import { usePendingProjectModel } from '@/client/hooks/chat/timeline/pending-model';
23
24
  import { useNewChatOpen } from '@/client/hooks/chat/timeline/new-chat-open';
24
25
  import { useSidebarData } from '@/client/hooks/chat/omp/session-list';
25
26
  import { useHeldWait } from '@/client/hooks/chat/waiting/held';
@@ -160,6 +161,10 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
160
161
 
161
162
  const { heldWait, cancelHeldWait } = useHeldWait(sessionId, isPendingSession, pushToast);
162
163
  const composerRoot = composerRootFor(folders, sessionId, selectedFolderId);
164
+ // The workspace's own default model, resolved by the same rule the spawn
165
+ // uses, so the pending composer's pill does not promise Kabmo's global pick.
166
+ const pendingProjectModel = usePendingProjectModel(folders, selectedFolderId);
167
+ const sessionDataModel = typeof sessionData?.model === 'object' ? sessionData.model : null;
163
168
 
164
169
  // The chat-level "a run is in flight" flag is computed in `useChatTimeline`
165
170
  // (it owns the queue-vs-send decision that depends on it) and consumed here
@@ -199,7 +204,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
199
204
  modes={modes}
200
205
  composerModelRef={composerModelRef}
201
206
  deferredComposerPickRef={deferredComposerPickRef}
202
- sessionModel={typeof sessionData?.model === 'object' ? sessionData.model : null}
207
+ sessionModel={sessionDataModel ?? pendingProjectModel}
203
208
  sessionThinkingLevel={sessionData?.thinkingLevel}
204
209
  generatingVerb={generatingVerb}
205
210
  variant={variant}
@@ -269,3 +269,49 @@ describe('Proc panel — legacy hub tool', () => {
269
269
  expect(text).toContain('22985');
270
270
  });
271
271
  });
272
+
273
+ /**
274
+ * omp 18.15.0 puts the caller's `i` intent on the job snapshot and leads its
275
+ * own `/jobs` rows with it. Kabmo drew `label` alone, so the purpose was
276
+ * dropped and the raw command stood in for it. Both lines are drawn now: the
277
+ * intent as the subject, the command beneath.
278
+ */
279
+ describe('Proc panel — a job the model gave a purpose to', () => {
280
+ test('leads with the intent and keeps the command line beneath it', async () => {
281
+ const el = await mount({
282
+ type: 'read',
283
+ name: 'read',
284
+ target: 'proc://',
285
+ input: { path: 'proc://' },
286
+ output: 'bg_1 [bash] running — Start the dev server — bun run dev',
287
+ status: 'success',
288
+ details: {
289
+ proc: {
290
+ jobs: [
291
+ { id: 'bg_1', type: 'bash', status: 'running', label: 'bun run dev', intent: 'Start the dev server', durationMs: 1200 },
292
+ ],
293
+ },
294
+ },
295
+ });
296
+ const text = el.textContent ?? '';
297
+ expect(text).toContain('Start the dev server');
298
+ expect(text).toContain('bun run dev');
299
+ // The subject precedes the command: the purpose is the first line.
300
+ expect(text.indexOf('Start the dev server')).toBeLessThan(text.indexOf('bun run dev'));
301
+ });
302
+
303
+ test('a job with no intent draws only its label', async () => {
304
+ const el = await mount({
305
+ type: 'read',
306
+ name: 'read',
307
+ target: 'proc://',
308
+ input: { path: 'proc://' },
309
+ output: '',
310
+ status: 'success',
311
+ details: {
312
+ proc: { jobs: [{ id: 'bg_2', type: 'task', status: 'running', label: 'audit', durationMs: 500 }] },
313
+ },
314
+ });
315
+ expect(el.textContent ?? '').toContain('audit');
316
+ });
317
+ });