@harperfast/agent 0.15.5 → 0.15.7

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/README.md CHANGED
@@ -39,7 +39,15 @@ You're ready to go!
39
39
 
40
40
  Once installed or running, you can ask harper-agent to help you with tasks in your current directory, such as applying patches or managing your Harper application.
41
41
 
42
- Press `Ctrl+C` or type "exit" or hit enter twice to exit.
42
+ Press `Ctrl+C` or type "/exit" or hit enter twice to exit.
43
+
44
+ ### Slash Commands
45
+
46
+ Harper Agent supports several slash commands for common tasks:
47
+
48
+ - `/clear`: Resets the chat history.
49
+ - `/skills`: Installs recommended agent skills via `npx skills add harperfast/skills`.
50
+ - `/exit`: Exits the agent.
43
51
 
44
52
  ### Non-interactive: pass an initial prompt
45
53
 
package/dist/agent.js CHANGED
@@ -3978,7 +3978,7 @@ function getInitialMessages() {
3978
3978
  })) : [{
3979
3979
  id: 0,
3980
3980
  type: "agent",
3981
- text: 'What shall we build today? (type "exit" or Ctrl+X to quit)',
3981
+ text: 'What shall we build today? (Type "/clear" to reset, "/skills" to add skills, or "/exit" to quit)',
3982
3982
  version: 1
3983
3983
  }];
3984
3984
  }
@@ -4031,6 +4031,15 @@ var ChatProvider = ({
4031
4031
  return updated;
4032
4032
  });
4033
4033
  }, []);
4034
+ useListener("ClearChatHistory", () => {
4035
+ agentManager.session?.clearSession();
4036
+ setMessages([{
4037
+ id: 0,
4038
+ type: "agent",
4039
+ text: "Chat cleared. What shall we build today?",
4040
+ version: 1
4041
+ }]);
4042
+ }, []);
4034
4043
  const value = useMemo3(() => ({
4035
4044
  messages,
4036
4045
  userInputMode,
@@ -5048,6 +5057,8 @@ function SettingsView({ isDense = false }) {
5048
5057
 
5049
5058
  // ink/components/UserInput.tsx
5050
5059
  import { Box as Box9, Text as Text9 } from "ink";
5060
+ import { exec as exec4 } from "child_process";
5061
+ import { promisify as promisify13 } from "util";
5051
5062
  import { useCallback as useCallback4, useState as useState13 } from "react";
5052
5063
 
5053
5064
  // ink/components/BlinkingTextInput.tsx
@@ -5210,11 +5221,12 @@ function BlinkingTextInput({
5210
5221
 
5211
5222
  // ink/components/UserInput.tsx
5212
5223
  import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
5224
+ var execAsync4 = promisify13(exec4);
5213
5225
  var modeSuggestion = {
5214
- approved: [],
5226
+ approved: ["/clear", "/skills", "/exit"],
5215
5227
  approving: ["yes", "approve", "no", "deny"],
5216
5228
  denied: [],
5217
- waiting: []
5229
+ waiting: ["/clear", "/skills", "/exit"]
5218
5230
  };
5219
5231
  function UserInput() {
5220
5232
  const { userInputMode, focusedArea } = useChat();
@@ -5225,10 +5237,49 @@ function UserInput() {
5225
5237
  }, []);
5226
5238
  const borderColor = focusedArea === "input" ? "cyan" : "gray";
5227
5239
  const placeholder = calculatePlaceholder(userInputMode);
5228
- const onSubmitResetKey = useCallback4((value) => {
5240
+ const onSubmitResetKey = useCallback4(async (value) => {
5229
5241
  if (value.length) {
5242
+ const trimmedValue = value.trim();
5243
+ if (trimmedValue === "/clear") {
5244
+ setResetKey((prev) => prev + 1);
5245
+ emitToListeners("ClearChatHistory", void 0);
5246
+ return;
5247
+ }
5248
+ if (trimmedValue === "/exit" || trimmedValue === "exit") {
5249
+ await handleExit();
5250
+ return;
5251
+ }
5252
+ if (trimmedValue === "/skills") {
5253
+ setResetKey((prev) => prev + 1);
5254
+ emitToListeners("PushNewMessages", [{
5255
+ type: "user",
5256
+ text: "/skills",
5257
+ version: 1
5258
+ }, {
5259
+ type: "agent",
5260
+ text: "Installing skills...",
5261
+ version: 1
5262
+ }]);
5263
+ try {
5264
+ const { stdout, stderr } = await execAsync4("npx skills add harperfast/skills");
5265
+ emitToListeners(
5266
+ "UpdateLastMessageText",
5267
+ `
5268
+
5269
+ Skills installation result:
5270
+ ${stdout}${stderr ? `
5271
+ Errors:
5272
+ ${stderr}` : ""}`
5273
+ );
5274
+ } catch (error) {
5275
+ emitToListeners("UpdateLastMessageText", `
5276
+
5277
+ Failed to install skills: ${error.message}`);
5278
+ }
5279
+ return;
5280
+ }
5230
5281
  setResetKey((prev) => prev + 1);
5231
- emitToListeners("PushNewMessages", [{ type: "user", text: value.trim(), version: 1 }]);
5282
+ emitToListeners("PushNewMessages", [{ type: "user", text: trimmedValue, version: 1 }]);
5232
5283
  setBlankLines(0);
5233
5284
  } else {
5234
5285
  setBlankLines((value2) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harperfast/agent",
3
3
  "description": "AI to help you with Harper app management",
4
- "version": "0.15.5",
4
+ "version": "0.15.7",
5
5
  "main": "dist/agent.js",
6
6
  "repository": "github:HarperFast/harper-agent",
7
7
  "bugs": {