@harperfast/agent 0.16.0 → 0.16.1
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/dist/agent.js +33 -9
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -1148,7 +1148,23 @@ async function execute11(operation) {
|
|
|
1148
1148
|
if (needed) {
|
|
1149
1149
|
const content = await execute10({ skill: needed });
|
|
1150
1150
|
console.error(`Understanding ${needed} is necessary before applying this patch.`);
|
|
1151
|
-
return {
|
|
1151
|
+
return {
|
|
1152
|
+
status: "skill_required",
|
|
1153
|
+
output: `apply_patch blocked: you must understand the "${needed}" skill before writing to "${operation.path}".
|
|
1154
|
+
|
|
1155
|
+
REQUIRED NEXT STEP: Call apply_patch again with the EXACT same arguments:
|
|
1156
|
+
type="${operation.type}", path="${operation.path}", diff=<same diff as before>
|
|
1157
|
+
|
|
1158
|
+
PROHIBITED \u2014 do NOT attempt any of the following to work around this:
|
|
1159
|
+
- Use the shell tool to write or create files
|
|
1160
|
+
- Call set_patch_auto_approve or set_shell_auto_approve
|
|
1161
|
+
- Use any other workaround
|
|
1162
|
+
|
|
1163
|
+
Read the skill content below, then retry apply_patch immediately.
|
|
1164
|
+
|
|
1165
|
+
--- Skill: ${needed} ---
|
|
1166
|
+
${content}`
|
|
1167
|
+
};
|
|
1152
1168
|
}
|
|
1153
1169
|
switch (operation.type) {
|
|
1154
1170
|
case "create_file":
|
|
@@ -1179,7 +1195,12 @@ async function execute11(operation) {
|
|
|
1179
1195
|
function createApplyPatchTool() {
|
|
1180
1196
|
return tool11({
|
|
1181
1197
|
name: "apply_patch",
|
|
1182
|
-
description:
|
|
1198
|
+
description: `Applies a patch (create, update, or delete a file) to the workspace.
|
|
1199
|
+
|
|
1200
|
+
SKILL GUARD: Some file paths require reading a specific Harper skill before writing. If this tool returns status "skill_required", you MUST:
|
|
1201
|
+
1. Read the skill content included in the response carefully.
|
|
1202
|
+
2. Call apply_patch again with the EXACT same type, path, and diff arguments.
|
|
1203
|
+
Do NOT use shell, set_patch_auto_approve, set_shell_auto_approve, or any other workaround to bypass this requirement.`,
|
|
1183
1204
|
parameters: ApplyPatchParameters,
|
|
1184
1205
|
needsApproval,
|
|
1185
1206
|
execute: execute11
|
|
@@ -3810,7 +3831,7 @@ async function runAgentForOnePass(agent, session, input, controller, isPrompt) {
|
|
|
3810
3831
|
}
|
|
3811
3832
|
|
|
3812
3833
|
// agent/AgentManager.ts
|
|
3813
|
-
var AgentManager = class {
|
|
3834
|
+
var AgentManager = class _AgentManager {
|
|
3814
3835
|
isInitialized = false;
|
|
3815
3836
|
controller = null;
|
|
3816
3837
|
queuedUserInputs = [];
|
|
@@ -3818,17 +3839,20 @@ var AgentManager = class {
|
|
|
3818
3839
|
agent = null;
|
|
3819
3840
|
session = null;
|
|
3820
3841
|
initialMessages = [];
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
return;
|
|
3824
|
-
}
|
|
3825
|
-
this.agent = new Agent3({
|
|
3842
|
+
static instantiateAgent(tools) {
|
|
3843
|
+
return new Agent3({
|
|
3826
3844
|
name: "Harper Agent",
|
|
3827
3845
|
model: isOpenAIModel(trackedState.model) ? trackedState.model : getModel(trackedState.model),
|
|
3828
3846
|
modelSettings: getModelSettings(trackedState.model),
|
|
3829
3847
|
instructions: readAgentSkillsRoot() || defaultInstructions(),
|
|
3830
|
-
tools
|
|
3848
|
+
tools
|
|
3831
3849
|
});
|
|
3850
|
+
}
|
|
3851
|
+
async initialize() {
|
|
3852
|
+
if (this.isInitialized) {
|
|
3853
|
+
return;
|
|
3854
|
+
}
|
|
3855
|
+
this.agent = _AgentManager.instantiateAgent(createTools());
|
|
3832
3856
|
this.session = createSession(trackedState.sessionPath);
|
|
3833
3857
|
try {
|
|
3834
3858
|
const plan = await this.session?.getPlanState?.();
|