@ottocode/server 0.1.266 → 0.1.267

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/server",
3
- "version": "0.1.266",
3
+ "version": "0.1.267",
4
4
  "description": "HTTP API server for ottocode",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -61,8 +61,8 @@
61
61
  "typecheck": "tsc --noEmit"
62
62
  },
63
63
  "dependencies": {
64
- "@ottocode/database": "0.1.266",
65
- "@ottocode/sdk": "0.1.266",
64
+ "@ottocode/database": "0.1.267",
65
+ "@ottocode/sdk": "0.1.267",
66
66
  "@hono/zod-openapi": "^1.1.5",
67
67
  "ai-sdk-ollama": "^3.8.3",
68
68
  "drizzle-orm": "^0.44.5",
@@ -1,4 +1,4 @@
1
- import { providerBasePrompt } from '@ottocode/sdk';
1
+ import { discoverSkills, findGitRoot, providerBasePrompt } from '@ottocode/sdk';
2
2
  import { composeEnvironmentAndInstructions } from '../context/environment.ts';
3
3
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
4
4
  import BASE_PROMPT from '@ottocode/sdk/prompts/base.txt' with { type: 'text' };
@@ -130,8 +130,12 @@ export async function composeSystemPrompt(options: {
130
130
  }
131
131
  }
132
132
 
133
+ const repoRoot =
134
+ (await findGitRoot(options.projectRoot)) ?? options.projectRoot;
135
+ const skills = await discoverSkills(options.projectRoot, repoRoot);
133
136
  const capabilitySummary = buildCapabilitySummary({
134
137
  skillSettings: options.skillSettings,
138
+ skills,
135
139
  });
136
140
  if (capabilitySummary.prompt) {
137
141
  parts.push(capabilitySummary.prompt);
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  filterDiscoveredSkills,
3
- getDiscoveredSkills,
4
3
  getMCPManager,
5
4
  summarizeDescription,
6
5
  type DiscoveredSkill,
@@ -31,7 +30,9 @@ export function buildCapabilitySummary(options?: {
31
30
  skills?: DiscoveredSkill[];
32
31
  mcpTools?: CapabilitySummaryMCPTool[];
33
32
  }): CapabilitySummaryResult {
34
- const skillLines = buildSkillLines(options?.skills, options?.skillSettings);
33
+ const skillLines = options?.skills
34
+ ? buildSkillLines(options.skills, options.skillSettings)
35
+ : [];
35
36
  const mcpLines = buildMCPLines(options?.mcpTools);
36
37
  const components = ['capabilities'];
37
38
  const sections: string[] = [];
@@ -64,13 +65,10 @@ export function buildCapabilitySummary(options?: {
64
65
  }
65
66
 
66
67
  function buildSkillLines(
67
- providedSkills: DiscoveredSkill[] | undefined,
68
+ providedSkills: DiscoveredSkill[],
68
69
  skillSettings: OttoConfig['skills'] | undefined,
69
70
  ): string[] {
70
- const skills = filterDiscoveredSkills(
71
- providedSkills ?? getDiscoveredSkills(),
72
- skillSettings,
73
- );
71
+ const skills = filterDiscoveredSkills(providedSkills, skillSettings);
74
72
  const seen = new Set<string>();
75
73
  const unique: DiscoveredSkill[] = [];
76
74
 
@@ -81,7 +79,14 @@ function buildSkillLines(
81
79
  unique.push(skill);
82
80
  }
83
81
 
84
- unique.sort((a, b) => a.name.localeCompare(b.name));
82
+ unique.sort((a, b) => {
83
+ const aExplicitlyEnabled = skillSettings?.items?.[a.name]?.enabled === true;
84
+ const bExplicitlyEnabled = skillSettings?.items?.[b.name]?.enabled === true;
85
+ if (aExplicitlyEnabled !== bExplicitlyEnabled) {
86
+ return aExplicitlyEnabled ? -1 : 1;
87
+ }
88
+ return a.name.localeCompare(b.name);
89
+ });
85
90
 
86
91
  const visible = unique.slice(0, MAX_SKILLS).map((skill) => {
87
92
  const summary = finalizeSentence(summarizeDescription(skill.description));