@miphamai/cli 0.6.4 → 0.6.5
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 +1 -1
- package/src/core/engine.ts +8 -0
- package/src/index.tsx +8 -0
- package/src/shared/types.ts +2 -0
- package/src/skills/loader.ts +2 -1
- package/src/tools/agent/skill.ts +4 -3
package/package.json
CHANGED
package/src/core/engine.ts
CHANGED
|
@@ -8,12 +8,14 @@ import type { AgentRegistry } from '../agent/agent-registry'
|
|
|
8
8
|
import { analyzeForMemory } from './memory/memory-writer'
|
|
9
9
|
import { getMemoryManager } from './memory/memory-loader'
|
|
10
10
|
import type { AgentViewManager } from '../agent-view/agent-view-manager'
|
|
11
|
+
import type { SkillsLoader } from '../skills/loader'
|
|
11
12
|
|
|
12
13
|
export class QueryEngine {
|
|
13
14
|
private hookEngine?: HookEngine
|
|
14
15
|
private artifactServer?: ArtifactServer
|
|
15
16
|
private agentRegistry?: AgentRegistry
|
|
16
17
|
private agentViewManager?: AgentViewManager
|
|
18
|
+
private skillsLoader?: SkillsLoader
|
|
17
19
|
private goal?: string
|
|
18
20
|
private maxGoalLoops = 20
|
|
19
21
|
private lastAssistantContent?: string
|
|
@@ -55,6 +57,11 @@ export class QueryEngine {
|
|
|
55
57
|
return this.agentViewManager
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/** Register the SkillsLoader for Skill tool context injection. */
|
|
61
|
+
setSkillsLoader(loader: SkillsLoader): void {
|
|
62
|
+
this.skillsLoader = loader
|
|
63
|
+
}
|
|
64
|
+
|
|
58
65
|
/** Set the session goal for goal-driven execution. */
|
|
59
66
|
setGoal(goal: string): void {
|
|
60
67
|
this.goal = goal
|
|
@@ -393,6 +400,7 @@ export class QueryEngine {
|
|
|
393
400
|
sessionId: 'session-1',
|
|
394
401
|
provider: this.registry.getActive().config.id,
|
|
395
402
|
model: this.registry.getActiveModel(),
|
|
403
|
+
skillsLoader: this.skillsLoader,
|
|
396
404
|
registry: this.registry,
|
|
397
405
|
toolRegistry: this.tools,
|
|
398
406
|
artifactServer: this.artifactServer,
|
package/src/index.tsx
CHANGED
|
@@ -63,10 +63,17 @@ export async function runApp(options: RunOptions): Promise<void> {
|
|
|
63
63
|
// Load skills
|
|
64
64
|
const skillsLoader = new SkillsLoader()
|
|
65
65
|
skillsLoader.loadBuiltin(process.cwd())
|
|
66
|
+
skillsLoader.loadUserSkills()
|
|
66
67
|
if (config.skills?.paths) {
|
|
67
68
|
skillsLoader.loadExternal(config.skills.paths)
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
// Inject skills system-reminder into system prompt for AI auto-triggering
|
|
72
|
+
const skillsReminder = skillsLoader.buildSystemReminder()
|
|
73
|
+
if (skillsReminder) {
|
|
74
|
+
instructions.setSkillsReminder(skillsReminder)
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
// Initialize plugin manager
|
|
71
78
|
const pluginManager = new PluginManager()
|
|
72
79
|
|
|
@@ -134,6 +141,7 @@ export async function runApp(options: RunOptions): Promise<void> {
|
|
|
134
141
|
engine.setHookEngine(hookEngine)
|
|
135
142
|
engine.setArtifactServer(artifactServer)
|
|
136
143
|
engine.setAgentViewManager(agentViewManager)
|
|
144
|
+
engine.setSkillsLoader(skillsLoader)
|
|
137
145
|
engine.setupContextSummarizer()
|
|
138
146
|
|
|
139
147
|
// Auto-save session on exit
|
package/src/shared/types.ts
CHANGED
|
@@ -147,6 +147,8 @@ export interface SkillDefinition {
|
|
|
147
147
|
disableModelInvocation?: boolean
|
|
148
148
|
/** When true, users can invoke this skill directly via /<name> */
|
|
149
149
|
userInvocable?: boolean
|
|
150
|
+
/** The markdown body content of the skill file (instructions for the AI to follow). */
|
|
151
|
+
body?: string
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
// ── Hook Types ──
|
package/src/skills/loader.ts
CHANGED
|
@@ -98,13 +98,14 @@ export class SkillsLoader {
|
|
|
98
98
|
private tryLoad(path: string, type: 'standard' | 'mipham'): void {
|
|
99
99
|
try {
|
|
100
100
|
const raw = readFileSync(path, 'utf-8')
|
|
101
|
-
const { data } = parseFrontmatter(raw)
|
|
101
|
+
const { data, content } = parseFrontmatter(raw)
|
|
102
102
|
|
|
103
103
|
const skill: SkillDefinition = {
|
|
104
104
|
name: (data.name as string) || this.nameFromPath(path),
|
|
105
105
|
description: (data.description as string) || '',
|
|
106
106
|
version: (data.version as string) || '0.1.0',
|
|
107
107
|
type,
|
|
108
|
+
body: content.trim() || undefined,
|
|
108
109
|
tools: data.tools as SkillDefinition['tools'],
|
|
109
110
|
hooks: data.hooks as SkillDefinition['hooks'],
|
|
110
111
|
prompts: data.prompts as SkillDefinition['prompts'],
|
package/src/tools/agent/skill.ts
CHANGED
|
@@ -64,15 +64,16 @@ export const skillTool: ToolDefinition = {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
// Standard inline execution — return
|
|
67
|
+
// Standard inline execution — return skill body for AI to follow
|
|
68
68
|
const lines: string[] = [
|
|
69
69
|
`── Skill Invoked: ${skill.name} ──`,
|
|
70
70
|
`Type: ${skill.type} | Version: ${skill.version}`,
|
|
71
71
|
skill.description ? `Description: ${skill.description}` : '',
|
|
72
72
|
args ? `Arguments: ${args}` : '',
|
|
73
73
|
'',
|
|
74
|
-
'The AI should now follow
|
|
75
|
-
'
|
|
74
|
+
'The AI should now follow these instructions:',
|
|
75
|
+
'',
|
|
76
|
+
skill.body || '(no instructions body)',
|
|
76
77
|
].filter(Boolean)
|
|
77
78
|
|
|
78
79
|
return { success: true, content: lines.join('\n') }
|