@ikyyofc/gemini-cli 5.0.3 → 5.0.4
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/agent.js +11 -42
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -23,11 +23,16 @@ function buildSystemPrompt(extra = "") {
|
|
|
23
23
|
const datetime = now.toLocaleString("id-ID", { timeZone: tz, dateStyle: "full", timeStyle: "long" });
|
|
24
24
|
|
|
25
25
|
const skillIndex = skills.length
|
|
26
|
-
?
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
? `\n## AVAILABLE SKILLS
|
|
27
|
+
Skills contain expert instructions. Before starting any task:
|
|
28
|
+
1. Review the list below
|
|
29
|
+
2. Identify which skill(s) apply
|
|
30
|
+
3. Read them with read_file BEFORE doing anything else
|
|
31
|
+
4. Follow the skill instructions exactly
|
|
32
|
+
|
|
33
|
+
${skills.map(s =>
|
|
34
|
+
`- **${s.slug}**: ${s.description}\n → read_file("${SKILLS_DIR}/${s.slug}/SKILL.md")`
|
|
35
|
+
).join("\n")}`
|
|
31
36
|
: "";
|
|
32
37
|
|
|
33
38
|
return `You are an autonomous AI coding agent running in the user's terminal.
|
|
@@ -58,31 +63,6 @@ ${toolList}
|
|
|
58
63
|
${extra ? `\n## EXTRA\n${extra}` : ""}`.trim();
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
// ─────────────────────────────────────────────────────────────────
|
|
62
|
-
// Build skill-selection primer message
|
|
63
|
-
// This is a SEPARATE first user message that forces the agent
|
|
64
|
-
// to select and read skills before proceeding to the actual task.
|
|
65
|
-
// The agent must use read_file on any relevant skill, then the
|
|
66
|
-
// skill content enters context naturally via tool results.
|
|
67
|
-
// ─────────────────────────────────────────────────────────────────
|
|
68
|
-
function buildSkillPrimer(userMessage, skills) {
|
|
69
|
-
if (!skills.length) return null;
|
|
70
|
-
|
|
71
|
-
const index = skills.map(s =>
|
|
72
|
-
`- ${s.slug}: ${s.description}`
|
|
73
|
-
).join("\n");
|
|
74
|
-
|
|
75
|
-
return `You have the following skills available. Before working on the task below, identify which skills (if any) are relevant and read their SKILL.md file using read_file. Only read skills that actually apply — do not read all of them.
|
|
76
|
-
|
|
77
|
-
Skills:
|
|
78
|
-
${index}
|
|
79
|
-
|
|
80
|
-
Skills path: ${SKILLS_DIR}/<slug>/SKILL.md
|
|
81
|
-
|
|
82
|
-
After reading the relevant skill(s), proceed with the task:
|
|
83
|
-
"${userMessage}"`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
66
|
// ─────────────────────────────────────────────────────────────────
|
|
87
67
|
// Display thinking block
|
|
88
68
|
// ─────────────────────────────────────────────────────────────────
|
|
@@ -106,18 +86,7 @@ export async function runAgentLoop(userMessage, history, {
|
|
|
106
86
|
} = {}) {
|
|
107
87
|
|
|
108
88
|
const fullSystem = buildSystemPrompt(systemInstruction ?? "");
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
// Use skill primer as first user message if skills are available.
|
|
112
|
-
// This forces the model to select + read relevant skills via read_file
|
|
113
|
-
// before doing anything else. Skill content enters context naturally
|
|
114
|
-
// through tool results — no injection needed.
|
|
115
|
-
const primer = buildSkillPrimer(userMessage, skills);
|
|
116
|
-
const firstMessage = primer
|
|
117
|
-
? { role: "user", content: primer }
|
|
118
|
-
: { role: "user", content: userMessage };
|
|
119
|
-
|
|
120
|
-
const messages = [...history, firstMessage];
|
|
89
|
+
const messages = [...history, { role: "user", content: userMessage }];
|
|
121
90
|
|
|
122
91
|
const spinner = new Spinner();
|
|
123
92
|
const deadline = Date.now() + TIMEOUT_MS;
|