diff --git a/packages/core/src/config/normalize.ts b/packages/core/src/config/normalize.ts index caec9d4df3..6356bf71d8 100644 --- a/packages/core/src/config/normalize.ts +++ b/packages/core/src/config/normalize.ts @@ -793,7 +793,7 @@ function isPlainRecord(value: unknown): value is Record { } function own(value: Record, key: string) { - return Object.prototype.hasOwnProperty.call(value, key) + return Object.hasOwn(value, key) } function setOwn(value: Record, key: string, item: unknown) { diff --git a/packages/core/src/config/plugin/agent.ts b/packages/core/src/config/plugin/agent.ts index 6723b9368e..e2f3fe3216 100644 --- a/packages/core/src/config/plugin/agent.ts +++ b/packages/core/src/config/plugin/agent.ts @@ -157,8 +157,7 @@ function isPathAction(action: string): action is PathAction { } function expandHome(resource: string, home: string) { - if (resource === "~") return home - if (resource === "$HOME") return home + if (resource === "~" || resource === "$HOME") return home const relative = resource.startsWith("~/") ? resource.slice(2) : resource.startsWith("$HOME/") || resource.startsWith("$HOME\\") diff --git a/packages/core/src/config/variable.ts b/packages/core/src/config/variable.ts index 2825f5b1f9..15128128d1 100644 --- a/packages/core/src/config/variable.ts +++ b/packages/core/src/config/variable.ts @@ -37,11 +37,10 @@ const substituteFiles = Effect.fnUntraced(function* (input: SubstituteInput, tex const fs = yield* FSUtil.Service const configDir = input.type === "path" ? path.dirname(input.path) : input.dir const configSource = input.type === "path" ? input.path : input.source - const matches = Array.from(text.matchAll(/\{file:[^}]+\}/g)) let out = "" let cursor = 0 - for (const match of matches) { + for (const match of text.matchAll(/\{file:[^}]+\}/g)) { const token = match[0] const index = match.index out += text.slice(cursor, index) @@ -54,7 +53,7 @@ const substituteFiles = Effect.fnUntraced(function* (input: SubstituteInput, tex continue } - const filePath = token.replace(/^\{file:/, "").replace(/\}$/, "") + const filePath = token.slice("{file:".length, -1) const expandedPath = filePath.startsWith("~/") ? path.join(os.homedir(), filePath.slice(2)) : filePath const resolvedPath = path.isAbsolute(expandedPath) ? expandedPath : path.resolve(configDir, expandedPath) const fileContent = yield* fs.readFileString(resolvedPath).pipe( diff --git a/packages/core/src/skill.ts b/packages/core/src/skill.ts index 2d017d2e67..54c394a10f 100644 --- a/packages/core/src/skill.ts +++ b/packages/core/src/skill.ts @@ -19,7 +19,7 @@ export const EmbeddedSource = Skill.EmbeddedSource export type EmbeddedSource = Skill.EmbeddedSource export const Source = Skill.Source -export type Source = typeof Source.Type +export type Source = Skill.Source export const Info = Skill.Info export type Info = Skill.Info diff --git a/packages/core/src/skill/instructions.ts b/packages/core/src/skill/instructions.ts index ae4808f2fd..fbfafbee20 100644 --- a/packages/core/src/skill/instructions.ts +++ b/packages/core/src/skill/instructions.ts @@ -72,8 +72,7 @@ const layer = Layer.effect( load: Effect.fn("SkillInstructions.load")(function* (selection) { const agent = selection.info if (!agent) return Instructions.empty - const permitted = Skill.available(yield* skills.list(), agent) - const available = permitted + const available = Skill.available(yield* skills.list(), agent) .flatMap((skill) => skill.description === undefined || skill.autoinvoke === false ? [] diff --git a/packages/core/src/wellknown.ts b/packages/core/src/wellknown.ts index 9659883085..39c3207828 100644 --- a/packages/core/src/wellknown.ts +++ b/packages/core/src/wellknown.ts @@ -180,9 +180,9 @@ const layer = Layer.effect( }), ) }), - resolve: Effect.fn("WellKnown.resolveEntry")(function* (entry, variables) { - return yield* resolveEntry(entry, variables).pipe(Effect.provideService(HttpClient.HttpClient, http)) - }), + resolve: Effect.fn("WellKnown.resolveEntry")((entry, variables) => + resolveEntry(entry, variables).pipe(Effect.provideService(HttpClient.HttpClient, http)), + ), }) }), )