@harperfast/agent 0.16.10 → 0.16.12
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/{chunk-LSVGOLBU.js → chunk-SEYUVI2L.js} +27 -52
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -710,31 +710,14 @@ function getEnv(newKey, oldKey) {
|
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
// tools/harper/getHarperSkillTool.ts
|
|
713
|
+
import { ruleNames, rules, skillSummary } from "@harperfast/skills";
|
|
713
714
|
import { tool as tool10 } from "@openai/agents";
|
|
714
|
-
import
|
|
715
|
-
import { createRequire } from "module";
|
|
716
|
-
import { dirname as dirname3, join as join6 } from "path";
|
|
715
|
+
import "fs";
|
|
717
716
|
import { z as z10 } from "zod";
|
|
718
|
-
var require2 = createRequire(import.meta.url);
|
|
719
|
-
var harperSkillsModuleDir = dirname3(
|
|
720
|
-
require2.resolve("@harperfast/skills/package.json")
|
|
721
|
-
);
|
|
722
|
-
var harperBestPracticesDir = join6(
|
|
723
|
-
harperSkillsModuleDir,
|
|
724
|
-
"harper-best-practices"
|
|
725
|
-
);
|
|
726
|
-
var skillRootFile = join6(
|
|
727
|
-
harperBestPracticesDir,
|
|
728
|
-
"SKILL.md"
|
|
729
|
-
);
|
|
730
|
-
var rulesDir = join6(
|
|
731
|
-
harperBestPracticesDir,
|
|
732
|
-
"rules"
|
|
733
|
-
);
|
|
734
717
|
var skillLinkRegex = /\[[^\]]+]\((?:rules|skills)\/([^)]+)\.md\)/g;
|
|
735
|
-
var skills =
|
|
718
|
+
var skills = ruleNames;
|
|
736
719
|
var ToolParameters10 = z10.object({
|
|
737
|
-
skill: z10.enum(
|
|
720
|
+
skill: z10.enum(ruleNames).describe(
|
|
738
721
|
"The name of the skill to retrieve."
|
|
739
722
|
)
|
|
740
723
|
});
|
|
@@ -746,25 +729,17 @@ var getHarperSkillTool = tool10({
|
|
|
746
729
|
});
|
|
747
730
|
function getSkillsDescription() {
|
|
748
731
|
try {
|
|
749
|
-
return
|
|
732
|
+
return skillSummary.replace("This repository contains", "This tool describes").replace(skillLinkRegex, "$1");
|
|
750
733
|
} catch {
|
|
751
734
|
return "Returns the contents of a Harper skill markdown file. Skills provide guidance on developing Harper applications.";
|
|
752
735
|
}
|
|
753
736
|
}
|
|
754
|
-
function getSkills() {
|
|
755
|
-
try {
|
|
756
|
-
return readdirSync(rulesDir).filter((file) => file.endsWith(".md")).map((file) => file.replace(".md", ""));
|
|
757
|
-
} catch {
|
|
758
|
-
return [];
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
737
|
async function execute10({ skill }) {
|
|
762
|
-
if (skill === "none") {
|
|
763
|
-
return "No skill requested.";
|
|
764
|
-
}
|
|
765
738
|
try {
|
|
766
|
-
const
|
|
767
|
-
|
|
739
|
+
const content = rules[skill];
|
|
740
|
+
if (!content) {
|
|
741
|
+
return `No skill found with the name ${skill}`;
|
|
742
|
+
}
|
|
768
743
|
agentManager.session?.addSkillRead?.(skill);
|
|
769
744
|
return content;
|
|
770
745
|
} catch (error) {
|
|
@@ -1414,14 +1389,14 @@ import { z as z19 } from "zod";
|
|
|
1414
1389
|
// utils/files/updateEnv.ts
|
|
1415
1390
|
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync } from "fs";
|
|
1416
1391
|
import { homedir as homedir3 } from "os";
|
|
1417
|
-
import { dirname as
|
|
1392
|
+
import { dirname as dirname3, join as join6 } from "path";
|
|
1418
1393
|
function updateEnv(key, value) {
|
|
1419
1394
|
const normalizedValue = key === "HARPER_AGENT_MODEL" && defaultModels.includes(value) ? defaultModelToken : key === "HARPER_AGENT_COMPACTION_MODEL" && defaultCompactionModels.includes(value) ? defaultModelToken : value;
|
|
1420
1395
|
process.env[key] = normalizedValue;
|
|
1421
|
-
const topLevelEnvPath =
|
|
1422
|
-
const localEnvPath =
|
|
1396
|
+
const topLevelEnvPath = join6(homedir3(), ".harper", "harper-agent-env");
|
|
1397
|
+
const localEnvPath = join6(trackedState.cwd, ".env");
|
|
1423
1398
|
const envPath = existsSync8(topLevelEnvPath) || !existsSync8(localEnvPath) ? topLevelEnvPath : localEnvPath;
|
|
1424
|
-
const dir =
|
|
1399
|
+
const dir = dirname3(envPath);
|
|
1425
1400
|
if (!existsSync8(dir)) {
|
|
1426
1401
|
mkdirSync2(dir, { recursive: true });
|
|
1427
1402
|
}
|
|
@@ -2025,8 +2000,8 @@ var createNewHarperApplicationTool = tool31({
|
|
|
2025
2000
|
// tools/harper/getHarperConfigSchemaTool.ts
|
|
2026
2001
|
import { tool as tool32 } from "@openai/agents";
|
|
2027
2002
|
import { readFile as readFile2 } from "fs/promises";
|
|
2028
|
-
import { createRequire
|
|
2029
|
-
import { dirname as
|
|
2003
|
+
import { createRequire } from "module";
|
|
2004
|
+
import { dirname as dirname4, join as join7 } from "path";
|
|
2030
2005
|
import { z as z32 } from "zod";
|
|
2031
2006
|
var ToolParameters19 = z32.object({
|
|
2032
2007
|
schemaType: z32.enum(["app", "root"]).describe(
|
|
@@ -2040,8 +2015,8 @@ var getHarperConfigSchemaTool = tool32({
|
|
|
2040
2015
|
async execute({ schemaType }) {
|
|
2041
2016
|
try {
|
|
2042
2017
|
return await readFile2(
|
|
2043
|
-
|
|
2044
|
-
|
|
2018
|
+
join7(
|
|
2019
|
+
dirname4(createRequire(import.meta.url).resolve("harperdb")),
|
|
2045
2020
|
`config-${schemaType}.schema.json`
|
|
2046
2021
|
),
|
|
2047
2022
|
"utf8"
|
|
@@ -2055,8 +2030,8 @@ var getHarperConfigSchemaTool = tool32({
|
|
|
2055
2030
|
// tools/harper/getHarperResourceInterfaceTool.ts
|
|
2056
2031
|
import { tool as tool33 } from "@openai/agents";
|
|
2057
2032
|
import { readFile as readFile3 } from "fs/promises";
|
|
2058
|
-
import { createRequire as
|
|
2059
|
-
import { dirname as
|
|
2033
|
+
import { createRequire as createRequire2 } from "module";
|
|
2034
|
+
import { dirname as dirname5, join as join8 } from "path";
|
|
2060
2035
|
import { z as z33 } from "zod";
|
|
2061
2036
|
var ToolParameters20 = z33.object({
|
|
2062
2037
|
resourceFile: z33.enum([
|
|
@@ -2076,8 +2051,8 @@ var getHarperResourceInterfaceTool = tool33({
|
|
|
2076
2051
|
async execute({ resourceFile }) {
|
|
2077
2052
|
try {
|
|
2078
2053
|
return await readFile3(
|
|
2079
|
-
|
|
2080
|
-
|
|
2054
|
+
join8(
|
|
2055
|
+
dirname5(createRequire2(import.meta.url).resolve("harperdb")),
|
|
2081
2056
|
"resources",
|
|
2082
2057
|
`${resourceFile}.d.ts`
|
|
2083
2058
|
),
|
|
@@ -2092,8 +2067,8 @@ var getHarperResourceInterfaceTool = tool33({
|
|
|
2092
2067
|
// tools/harper/getHarperSchemaGraphQLTool.ts
|
|
2093
2068
|
import { tool as tool34 } from "@openai/agents";
|
|
2094
2069
|
import { readFile as readFile4 } from "fs/promises";
|
|
2095
|
-
import { createRequire as
|
|
2096
|
-
import { dirname as
|
|
2070
|
+
import { createRequire as createRequire3 } from "module";
|
|
2071
|
+
import { dirname as dirname6, join as join9 } from "path";
|
|
2097
2072
|
import { z as z34 } from "zod";
|
|
2098
2073
|
var ToolParameters21 = z34.object({});
|
|
2099
2074
|
var getHarperSchemaGraphQLTool = tool34({
|
|
@@ -2103,8 +2078,8 @@ var getHarperSchemaGraphQLTool = tool34({
|
|
|
2103
2078
|
async execute() {
|
|
2104
2079
|
try {
|
|
2105
2080
|
return await readFile4(
|
|
2106
|
-
|
|
2107
|
-
|
|
2081
|
+
join9(
|
|
2082
|
+
dirname6(createRequire3(import.meta.url).resolve("harperdb")),
|
|
2108
2083
|
`schema.graphql`
|
|
2109
2084
|
),
|
|
2110
2085
|
"utf8"
|
|
@@ -2574,7 +2549,7 @@ Stack: ${String(err.stack).split("\n").slice(0, 8).join("\n")}` : "";
|
|
|
2574
2549
|
import { MemorySession } from "@openai/agents";
|
|
2575
2550
|
import { existsSync as existsSync10 } from "fs";
|
|
2576
2551
|
import { mkdir as mkdir2, readFile as readFile5, rename, writeFile as writeFile3 } from "fs/promises";
|
|
2577
|
-
import { dirname as
|
|
2552
|
+
import { dirname as dirname7 } from "path";
|
|
2578
2553
|
var DiskSession = class extends MemorySession {
|
|
2579
2554
|
filePath;
|
|
2580
2555
|
ready;
|
|
@@ -2640,7 +2615,7 @@ var DiskSession = class extends MemorySession {
|
|
|
2640
2615
|
async updateStorage(update) {
|
|
2641
2616
|
const storage = await this.loadStorage();
|
|
2642
2617
|
update(storage);
|
|
2643
|
-
const dir =
|
|
2618
|
+
const dir = dirname7(this.filePath);
|
|
2644
2619
|
if (!existsSync10(dir)) {
|
|
2645
2620
|
await mkdir2(dir, { recursive: true });
|
|
2646
2621
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
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.16.
|
|
4
|
+
"version": "0.16.12",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"repository": "github:HarperFast/harper-agent",
|
|
7
7
|
"bugs": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@ai-sdk/anthropic": "^3.0.41",
|
|
50
50
|
"@ai-sdk/google": "^3.0.24",
|
|
51
51
|
"@ai-sdk/openai": "^3.0.26",
|
|
52
|
-
"@harperfast/skills": "^1.
|
|
52
|
+
"@harperfast/skills": "^1.2.0",
|
|
53
53
|
"@inkjs/ui": "^2.0.0",
|
|
54
54
|
"@openai/agents": "^0.8.0",
|
|
55
55
|
"@openai/agents-extensions": "^0.8.0",
|