@zenobius/opencode-skillful 1.2.2 → 1.2.4-next.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/index.js +96 -120
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -16152,6 +16152,7 @@ function createInstructionInjector(ctx) {
|
|
|
16152
16152
|
await ctx.client.session.prompt({
|
|
16153
16153
|
path: { id: props.sessionId },
|
|
16154
16154
|
body: {
|
|
16155
|
+
agent: props.agent,
|
|
16155
16156
|
noReply: true,
|
|
16156
16157
|
parts: [{ type: "text", text }]
|
|
16157
16158
|
}
|
|
@@ -17763,9 +17764,10 @@ function createSkillFinder(provider) {
|
|
|
17763
17764
|
}
|
|
17764
17765
|
|
|
17765
17766
|
// src/tools/SkillResourceReader.ts
|
|
17766
|
-
import
|
|
17767
|
+
import path2 from "path";
|
|
17767
17768
|
|
|
17768
17769
|
// src/services/SkillResourceResolver.ts
|
|
17770
|
+
import path from "path";
|
|
17769
17771
|
function createSkillResourceResolver(provider) {
|
|
17770
17772
|
const resolveResourceMap = (skill, type) => {
|
|
17771
17773
|
if (type === "script" || type === "scripts") {
|
|
@@ -17787,7 +17789,7 @@ function createSkillResourceResolver(provider) {
|
|
|
17787
17789
|
if (!resourceMap) {
|
|
17788
17790
|
throw new Error(`Skill "${args.skill_name}" does not have any resources of type "${args.type}"`);
|
|
17789
17791
|
}
|
|
17790
|
-
const resourceEntry = resourceMap.get(args.relative_path);
|
|
17792
|
+
const resourceEntry = resourceMap.get(path.join(args.type, args.relative_path));
|
|
17791
17793
|
if (!resourceEntry) {
|
|
17792
17794
|
throw new Error(`Resource not found: Skill "${args.skill_name}" does not have a ${args.type} at path "${args.relative_path}"`);
|
|
17793
17795
|
}
|
|
@@ -17813,7 +17815,7 @@ function createSkillResourceReader(provider) {
|
|
|
17813
17815
|
const resource = await skillResourceResolver({
|
|
17814
17816
|
skill_name: args.skill_name,
|
|
17815
17817
|
type,
|
|
17816
|
-
relative_path:
|
|
17818
|
+
relative_path: path2.join(...restPath)
|
|
17817
17819
|
});
|
|
17818
17820
|
const injection = {
|
|
17819
17821
|
skill_name: args.skill_name,
|
|
@@ -17880,7 +17882,7 @@ import { join as join2, relative as relative3, resolve as resolve2 } from "path"
|
|
|
17880
17882
|
import process2 from "process";
|
|
17881
17883
|
import { existsSync as existsSync22, mkdirSync, readdirSync, writeFileSync } from "fs";
|
|
17882
17884
|
import { dirname as dirname4, resolve } from "path";
|
|
17883
|
-
import
|
|
17885
|
+
import process3 from "process";
|
|
17884
17886
|
import { Buffer as Buffer2 } from "buffer";
|
|
17885
17887
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
17886
17888
|
import { closeSync, createReadStream, createWriteStream, existsSync as existsSync222, fsyncSync, openSync, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -17890,7 +17892,7 @@ import process5 from "process";
|
|
|
17890
17892
|
import { pipeline } from "stream/promises";
|
|
17891
17893
|
import { createGzip } from "zlib";
|
|
17892
17894
|
import process4 from "process";
|
|
17893
|
-
import
|
|
17895
|
+
import process32 from "process";
|
|
17894
17896
|
import { Buffer as Buffer22 } from "buffer";
|
|
17895
17897
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes2 } from "crypto";
|
|
17896
17898
|
import { closeSync as closeSync2, createReadStream as createReadStream2, createWriteStream as createWriteStream2, existsSync as existsSync4, fsyncSync as fsyncSync2, openSync as openSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
@@ -18292,7 +18294,7 @@ async function loadConfig({
|
|
|
18292
18294
|
cwd,
|
|
18293
18295
|
defaultConfig
|
|
18294
18296
|
}) {
|
|
18295
|
-
const baseDir = cwd ||
|
|
18297
|
+
const baseDir = cwd || process3.cwd();
|
|
18296
18298
|
const extensions = [".ts", ".js", ".mjs", ".cjs", ".json"];
|
|
18297
18299
|
const configPaths = [
|
|
18298
18300
|
`${name}.config`,
|
|
@@ -18323,13 +18325,13 @@ async function loadConfig({
|
|
|
18323
18325
|
} catch {}
|
|
18324
18326
|
return defaultConfig;
|
|
18325
18327
|
}
|
|
18326
|
-
var defaultConfigDir = resolve(
|
|
18327
|
-
var defaultGeneratedDir = resolve(
|
|
18328
|
+
var defaultConfigDir = resolve(process3.cwd(), "config");
|
|
18329
|
+
var defaultGeneratedDir = resolve(process3.cwd(), "src/generated");
|
|
18328
18330
|
function getProjectRoot(filePath, options2 = {}) {
|
|
18329
|
-
let
|
|
18330
|
-
while (
|
|
18331
|
-
|
|
18332
|
-
const finalPath = resolve2(
|
|
18331
|
+
let path3 = process2.cwd();
|
|
18332
|
+
while (path3.includes("storage"))
|
|
18333
|
+
path3 = resolve2(path3, "..");
|
|
18334
|
+
const finalPath = resolve2(path3, filePath || "");
|
|
18333
18335
|
if (options2?.relative)
|
|
18334
18336
|
return relative3(process2.cwd(), finalPath);
|
|
18335
18337
|
return finalPath;
|
|
@@ -18373,24 +18375,24 @@ async function loadConfig2() {
|
|
|
18373
18375
|
}
|
|
18374
18376
|
var config2 = await loadConfig2();
|
|
18375
18377
|
function isBrowserProcess() {
|
|
18376
|
-
if (
|
|
18378
|
+
if (process32.env.NODE_ENV === "test" || process32.env.BUN_ENV === "test") {
|
|
18377
18379
|
return false;
|
|
18378
18380
|
}
|
|
18379
18381
|
return typeof window !== "undefined";
|
|
18380
18382
|
}
|
|
18381
18383
|
async function isServerProcess() {
|
|
18382
|
-
if (
|
|
18384
|
+
if (process32.env.NODE_ENV === "test" || process32.env.BUN_ENV === "test") {
|
|
18383
18385
|
return true;
|
|
18384
18386
|
}
|
|
18385
18387
|
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
18386
18388
|
return true;
|
|
18387
18389
|
}
|
|
18388
|
-
if (typeof
|
|
18389
|
-
const type =
|
|
18390
|
+
if (typeof process32 !== "undefined") {
|
|
18391
|
+
const type = process32.type;
|
|
18390
18392
|
if (type === "renderer" || type === "worker") {
|
|
18391
18393
|
return false;
|
|
18392
18394
|
}
|
|
18393
|
-
return !!(
|
|
18395
|
+
return !!(process32.versions && (process32.versions.node || process32.versions.bun));
|
|
18394
18396
|
}
|
|
18395
18397
|
return false;
|
|
18396
18398
|
}
|
|
@@ -19776,10 +19778,10 @@ function applyEnvVarsToConfig(name, config3, verbose = false) {
|
|
|
19776
19778
|
return config3;
|
|
19777
19779
|
const envPrefix = name.toUpperCase().replace(/-/g, "_");
|
|
19778
19780
|
const result = { ...config3 };
|
|
19779
|
-
function processObject(obj,
|
|
19781
|
+
function processObject(obj, path3 = []) {
|
|
19780
19782
|
const result2 = { ...obj };
|
|
19781
19783
|
for (const [key, value] of Object.entries(obj)) {
|
|
19782
|
-
const envPath = [...
|
|
19784
|
+
const envPath = [...path3, key];
|
|
19783
19785
|
const formatKey = (k) => k.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
19784
19786
|
const envKey = `${envPrefix}_${envPath.map(formatKey).join("_")}`;
|
|
19785
19787
|
const oldEnvKey = `${envPrefix}_${envPath.map((p) => p.toUpperCase()).join("_")}`;
|
|
@@ -19961,10 +19963,10 @@ async function loadConfig3({
|
|
|
19961
19963
|
var defaultConfigDir2 = resolve3(process6.cwd(), "config");
|
|
19962
19964
|
var defaultGeneratedDir2 = resolve3(process6.cwd(), "src/generated");
|
|
19963
19965
|
function getProjectRoot2(filePath, options2 = {}) {
|
|
19964
|
-
let
|
|
19965
|
-
while (
|
|
19966
|
-
|
|
19967
|
-
const finalPath = resolve4(
|
|
19966
|
+
let path3 = process7.cwd();
|
|
19967
|
+
while (path3.includes("storage"))
|
|
19968
|
+
path3 = resolve4(path3, "..");
|
|
19969
|
+
const finalPath = resolve4(path3, filePath || "");
|
|
19968
19970
|
if (options2?.relative)
|
|
19969
19971
|
return relative2(process7.cwd(), finalPath);
|
|
19970
19972
|
return finalPath;
|
|
@@ -21401,10 +21403,10 @@ class EnvVarError extends BunfigError {
|
|
|
21401
21403
|
|
|
21402
21404
|
class FileSystemError extends BunfigError {
|
|
21403
21405
|
code = "FILE_SYSTEM_ERROR";
|
|
21404
|
-
constructor(operation,
|
|
21405
|
-
super(`File system ${operation} failed for "${
|
|
21406
|
+
constructor(operation, path3, cause) {
|
|
21407
|
+
super(`File system ${operation} failed for "${path3}": ${cause.message}`, {
|
|
21406
21408
|
operation,
|
|
21407
|
-
path:
|
|
21409
|
+
path: path3,
|
|
21408
21410
|
originalError: cause.name,
|
|
21409
21411
|
originalMessage: cause.message
|
|
21410
21412
|
});
|
|
@@ -21477,8 +21479,8 @@ var ErrorFactory = {
|
|
|
21477
21479
|
envVar(envKey, envValue, expectedType, configName) {
|
|
21478
21480
|
return new EnvVarError(envKey, envValue, expectedType, configName);
|
|
21479
21481
|
},
|
|
21480
|
-
fileSystem(operation,
|
|
21481
|
-
return new FileSystemError(operation,
|
|
21482
|
+
fileSystem(operation, path3, cause) {
|
|
21483
|
+
return new FileSystemError(operation, path3, cause);
|
|
21482
21484
|
},
|
|
21483
21485
|
typeGeneration(configDir, outputPath, cause) {
|
|
21484
21486
|
return new TypeGenerationError(configDir, outputPath, cause);
|
|
@@ -21614,9 +21616,9 @@ class EnvProcessor {
|
|
|
21614
21616
|
}
|
|
21615
21617
|
return key.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
21616
21618
|
}
|
|
21617
|
-
processObject(obj,
|
|
21619
|
+
processObject(obj, path3, envPrefix, options2) {
|
|
21618
21620
|
for (const [key, value] of Object.entries(obj)) {
|
|
21619
|
-
const envPath = [...
|
|
21621
|
+
const envPath = [...path3, key];
|
|
21620
21622
|
const formattedKeys = envPath.map((k) => this.formatEnvKey(k, options2.useCamelCase));
|
|
21621
21623
|
const envKey = `${envPrefix}_${formattedKeys.join("_")}`;
|
|
21622
21624
|
const oldEnvKey = options2.useBackwardCompatibility ? `${envPrefix}_${envPath.map((p) => p.toUpperCase()).join("_")}` : null;
|
|
@@ -21701,9 +21703,9 @@ class EnvProcessor {
|
|
|
21701
21703
|
return this.formatAsText(envVars, configName);
|
|
21702
21704
|
}
|
|
21703
21705
|
}
|
|
21704
|
-
extractEnvVarInfo(obj,
|
|
21706
|
+
extractEnvVarInfo(obj, path3, prefix, envVars) {
|
|
21705
21707
|
for (const [key, value] of Object.entries(obj)) {
|
|
21706
|
-
const envPath = [...
|
|
21708
|
+
const envPath = [...path3, key];
|
|
21707
21709
|
const envKey = `${prefix}_${envPath.map((k) => this.formatEnvKey(k, true)).join("_")}`;
|
|
21708
21710
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
21709
21711
|
this.extractEnvVarInfo(value, envPath, prefix, envVars);
|
|
@@ -22118,15 +22120,15 @@ class ConfigFileLoader {
|
|
|
22118
22120
|
}
|
|
22119
22121
|
async preloadConfigurations(configPaths, options2 = {}) {
|
|
22120
22122
|
const preloaded = new Map;
|
|
22121
|
-
await Promise.allSettled(configPaths.map(async (
|
|
22123
|
+
await Promise.allSettled(configPaths.map(async (path3) => {
|
|
22122
22124
|
try {
|
|
22123
|
-
const result = await this.loadFromPath(
|
|
22125
|
+
const result = await this.loadFromPath(path3, {}, options2);
|
|
22124
22126
|
if (result) {
|
|
22125
|
-
preloaded.set(
|
|
22127
|
+
preloaded.set(path3, result.config);
|
|
22126
22128
|
}
|
|
22127
22129
|
} catch (error45) {
|
|
22128
22130
|
if (options2.verbose) {
|
|
22129
|
-
console.warn(`Failed to preload ${
|
|
22131
|
+
console.warn(`Failed to preload ${path3}:`, error45);
|
|
22130
22132
|
}
|
|
22131
22133
|
}
|
|
22132
22134
|
}));
|
|
@@ -22205,13 +22207,13 @@ class ConfigValidator {
|
|
|
22205
22207
|
warnings
|
|
22206
22208
|
};
|
|
22207
22209
|
}
|
|
22208
|
-
validateObjectAgainstSchema(value, schema,
|
|
22210
|
+
validateObjectAgainstSchema(value, schema, path3, errors3, warnings, options2) {
|
|
22209
22211
|
if (options2.validateTypes && schema.type) {
|
|
22210
22212
|
const actualType = Array.isArray(value) ? "array" : typeof value;
|
|
22211
22213
|
const expectedTypes = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
22212
22214
|
if (!expectedTypes.includes(actualType)) {
|
|
22213
22215
|
errors3.push({
|
|
22214
|
-
path:
|
|
22216
|
+
path: path3,
|
|
22215
22217
|
message: `Expected type ${expectedTypes.join(" or ")}, got ${actualType}`,
|
|
22216
22218
|
expected: expectedTypes.join(" or "),
|
|
22217
22219
|
actual: actualType,
|
|
@@ -22223,7 +22225,7 @@ class ConfigValidator {
|
|
|
22223
22225
|
}
|
|
22224
22226
|
if (schema.enum && !schema.enum.includes(value)) {
|
|
22225
22227
|
errors3.push({
|
|
22226
|
-
path:
|
|
22228
|
+
path: path3,
|
|
22227
22229
|
message: `Value must be one of: ${schema.enum.join(", ")}`,
|
|
22228
22230
|
expected: schema.enum.join(", "),
|
|
22229
22231
|
actual: value,
|
|
@@ -22235,7 +22237,7 @@ class ConfigValidator {
|
|
|
22235
22237
|
if (typeof value === "string") {
|
|
22236
22238
|
if (schema.minLength !== undefined && value.length < schema.minLength) {
|
|
22237
22239
|
errors3.push({
|
|
22238
|
-
path:
|
|
22240
|
+
path: path3,
|
|
22239
22241
|
message: `String length must be at least ${schema.minLength}`,
|
|
22240
22242
|
expected: `>= ${schema.minLength}`,
|
|
22241
22243
|
actual: value.length,
|
|
@@ -22244,7 +22246,7 @@ class ConfigValidator {
|
|
|
22244
22246
|
}
|
|
22245
22247
|
if (schema.maxLength !== undefined && value.length > schema.maxLength) {
|
|
22246
22248
|
errors3.push({
|
|
22247
|
-
path:
|
|
22249
|
+
path: path3,
|
|
22248
22250
|
message: `String length must not exceed ${schema.maxLength}`,
|
|
22249
22251
|
expected: `<= ${schema.maxLength}`,
|
|
22250
22252
|
actual: value.length,
|
|
@@ -22255,7 +22257,7 @@ class ConfigValidator {
|
|
|
22255
22257
|
const regex = new RegExp(schema.pattern);
|
|
22256
22258
|
if (!regex.test(value)) {
|
|
22257
22259
|
errors3.push({
|
|
22258
|
-
path:
|
|
22260
|
+
path: path3,
|
|
22259
22261
|
message: `String does not match pattern ${schema.pattern}`,
|
|
22260
22262
|
expected: schema.pattern,
|
|
22261
22263
|
actual: value,
|
|
@@ -22267,7 +22269,7 @@ class ConfigValidator {
|
|
|
22267
22269
|
if (typeof value === "number") {
|
|
22268
22270
|
if (schema.minimum !== undefined && value < schema.minimum) {
|
|
22269
22271
|
errors3.push({
|
|
22270
|
-
path:
|
|
22272
|
+
path: path3,
|
|
22271
22273
|
message: `Value must be at least ${schema.minimum}`,
|
|
22272
22274
|
expected: `>= ${schema.minimum}`,
|
|
22273
22275
|
actual: value,
|
|
@@ -22276,7 +22278,7 @@ class ConfigValidator {
|
|
|
22276
22278
|
}
|
|
22277
22279
|
if (schema.maximum !== undefined && value > schema.maximum) {
|
|
22278
22280
|
errors3.push({
|
|
22279
|
-
path:
|
|
22281
|
+
path: path3,
|
|
22280
22282
|
message: `Value must not exceed ${schema.maximum}`,
|
|
22281
22283
|
expected: `<= ${schema.maximum}`,
|
|
22282
22284
|
actual: value,
|
|
@@ -22286,7 +22288,7 @@ class ConfigValidator {
|
|
|
22286
22288
|
}
|
|
22287
22289
|
if (Array.isArray(value) && schema.items) {
|
|
22288
22290
|
for (let i = 0;i < value.length; i++) {
|
|
22289
|
-
const itemPath =
|
|
22291
|
+
const itemPath = path3 ? `${path3}[${i}]` : `[${i}]`;
|
|
22290
22292
|
this.validateObjectAgainstSchema(value[i], schema.items, itemPath, errors3, warnings, options2);
|
|
22291
22293
|
if (options2.stopOnFirstError && errors3.length > 0)
|
|
22292
22294
|
return;
|
|
@@ -22298,7 +22300,7 @@ class ConfigValidator {
|
|
|
22298
22300
|
for (const requiredProp of schema.required) {
|
|
22299
22301
|
if (!(requiredProp in obj)) {
|
|
22300
22302
|
errors3.push({
|
|
22301
|
-
path:
|
|
22303
|
+
path: path3 ? `${path3}.${requiredProp}` : requiredProp,
|
|
22302
22304
|
message: `Missing required property '${requiredProp}'`,
|
|
22303
22305
|
expected: "required",
|
|
22304
22306
|
rule: "required"
|
|
@@ -22311,7 +22313,7 @@ class ConfigValidator {
|
|
|
22311
22313
|
if (schema.properties) {
|
|
22312
22314
|
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
22313
22315
|
if (propName in obj) {
|
|
22314
|
-
const propPath =
|
|
22316
|
+
const propPath = path3 ? `${path3}.${propName}` : propName;
|
|
22315
22317
|
this.validateObjectAgainstSchema(obj[propName], propSchema, propPath, errors3, warnings, options2);
|
|
22316
22318
|
if (options2.stopOnFirstError && errors3.length > 0)
|
|
22317
22319
|
return;
|
|
@@ -22323,7 +22325,7 @@ class ConfigValidator {
|
|
|
22323
22325
|
for (const propName of Object.keys(obj)) {
|
|
22324
22326
|
if (!allowedProps.has(propName)) {
|
|
22325
22327
|
warnings.push({
|
|
22326
|
-
path:
|
|
22328
|
+
path: path3 ? `${path3}.${propName}` : propName,
|
|
22327
22329
|
message: `Additional property '${propName}' is not allowed`,
|
|
22328
22330
|
rule: "additionalProperties"
|
|
22329
22331
|
});
|
|
@@ -22357,12 +22359,12 @@ class ConfigValidator {
|
|
|
22357
22359
|
warnings
|
|
22358
22360
|
};
|
|
22359
22361
|
}
|
|
22360
|
-
validateWithRule(value, rule,
|
|
22362
|
+
validateWithRule(value, rule, path3) {
|
|
22361
22363
|
const errors3 = [];
|
|
22362
22364
|
if (rule.required && (value === undefined || value === null)) {
|
|
22363
22365
|
errors3.push({
|
|
22364
|
-
path:
|
|
22365
|
-
message: rule.message || `Property '${
|
|
22366
|
+
path: path3,
|
|
22367
|
+
message: rule.message || `Property '${path3}' is required`,
|
|
22366
22368
|
expected: "required",
|
|
22367
22369
|
rule: "required"
|
|
22368
22370
|
});
|
|
@@ -22375,7 +22377,7 @@ class ConfigValidator {
|
|
|
22375
22377
|
const actualType = Array.isArray(value) ? "array" : typeof value;
|
|
22376
22378
|
if (actualType !== rule.type) {
|
|
22377
22379
|
errors3.push({
|
|
22378
|
-
path:
|
|
22380
|
+
path: path3,
|
|
22379
22381
|
message: rule.message || `Expected type ${rule.type}, got ${actualType}`,
|
|
22380
22382
|
expected: rule.type,
|
|
22381
22383
|
actual: actualType,
|
|
@@ -22387,7 +22389,7 @@ class ConfigValidator {
|
|
|
22387
22389
|
const length = Array.isArray(value) ? value.length : typeof value === "string" ? value.length : typeof value === "number" ? value : 0;
|
|
22388
22390
|
if (length < rule.min) {
|
|
22389
22391
|
errors3.push({
|
|
22390
|
-
path:
|
|
22392
|
+
path: path3,
|
|
22391
22393
|
message: rule.message || `Value must be at least ${rule.min}`,
|
|
22392
22394
|
expected: `>= ${rule.min}`,
|
|
22393
22395
|
actual: length,
|
|
@@ -22399,7 +22401,7 @@ class ConfigValidator {
|
|
|
22399
22401
|
const length = Array.isArray(value) ? value.length : typeof value === "string" ? value.length : typeof value === "number" ? value : 0;
|
|
22400
22402
|
if (length > rule.max) {
|
|
22401
22403
|
errors3.push({
|
|
22402
|
-
path:
|
|
22404
|
+
path: path3,
|
|
22403
22405
|
message: rule.message || `Value must not exceed ${rule.max}`,
|
|
22404
22406
|
expected: `<= ${rule.max}`,
|
|
22405
22407
|
actual: length,
|
|
@@ -22410,7 +22412,7 @@ class ConfigValidator {
|
|
|
22410
22412
|
if (rule.pattern && typeof value === "string") {
|
|
22411
22413
|
if (!rule.pattern.test(value)) {
|
|
22412
22414
|
errors3.push({
|
|
22413
|
-
path:
|
|
22415
|
+
path: path3,
|
|
22414
22416
|
message: rule.message || `Value does not match pattern ${rule.pattern}`,
|
|
22415
22417
|
expected: rule.pattern.toString(),
|
|
22416
22418
|
actual: value,
|
|
@@ -22420,7 +22422,7 @@ class ConfigValidator {
|
|
|
22420
22422
|
}
|
|
22421
22423
|
if (rule.enum && !rule.enum.includes(value)) {
|
|
22422
22424
|
errors3.push({
|
|
22423
|
-
path:
|
|
22425
|
+
path: path3,
|
|
22424
22426
|
message: rule.message || `Value must be one of: ${rule.enum.join(", ")}`,
|
|
22425
22427
|
expected: rule.enum.join(", "),
|
|
22426
22428
|
actual: value,
|
|
@@ -22431,7 +22433,7 @@ class ConfigValidator {
|
|
|
22431
22433
|
const customError = rule.validator(value);
|
|
22432
22434
|
if (customError) {
|
|
22433
22435
|
errors3.push({
|
|
22434
|
-
path:
|
|
22436
|
+
path: path3,
|
|
22435
22437
|
message: rule.message || customError,
|
|
22436
22438
|
rule: "custom"
|
|
22437
22439
|
});
|
|
@@ -22439,10 +22441,10 @@ class ConfigValidator {
|
|
|
22439
22441
|
}
|
|
22440
22442
|
return errors3;
|
|
22441
22443
|
}
|
|
22442
|
-
getValueByPath(obj,
|
|
22443
|
-
if (!
|
|
22444
|
+
getValueByPath(obj, path3) {
|
|
22445
|
+
if (!path3)
|
|
22444
22446
|
return obj;
|
|
22445
|
-
const keys =
|
|
22447
|
+
const keys = path3.split(".");
|
|
22446
22448
|
let current = obj;
|
|
22447
22449
|
for (const key of keys) {
|
|
22448
22450
|
if (current && typeof current === "object" && key in current) {
|
|
@@ -22868,10 +22870,10 @@ async function loadConfig5(options2) {
|
|
|
22868
22870
|
function applyEnvVarsToConfig2(name, config4, verbose = false) {
|
|
22869
22871
|
const _envProcessor = new EnvProcessor;
|
|
22870
22872
|
const envPrefix = name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
22871
|
-
function processConfigLevel(obj,
|
|
22873
|
+
function processConfigLevel(obj, path3 = []) {
|
|
22872
22874
|
const result = { ...obj };
|
|
22873
22875
|
for (const [key, value] of Object.entries(obj)) {
|
|
22874
|
-
const currentPath = [...
|
|
22876
|
+
const currentPath = [...path3, key];
|
|
22875
22877
|
const envKeys = [
|
|
22876
22878
|
`${envPrefix}_${currentPath.join("_").toUpperCase()}`,
|
|
22877
22879
|
`${envPrefix}_${currentPath.map((k) => k.toUpperCase()).join("")}`,
|
|
@@ -22916,72 +22918,43 @@ var defaultConfigDir3 = resolve7(process12.cwd(), "config");
|
|
|
22916
22918
|
var defaultGeneratedDir3 = resolve7(process12.cwd(), "src/generated");
|
|
22917
22919
|
|
|
22918
22920
|
// src/config.ts
|
|
22921
|
+
import { homedir as homedir3 } from "os";
|
|
22919
22922
|
import { join as join4 } from "path";
|
|
22920
|
-
|
|
22921
|
-
|
|
22922
|
-
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
temp: path2.join(tmpdir, name)
|
|
22936
|
-
};
|
|
22937
|
-
};
|
|
22938
|
-
var windows = (name) => {
|
|
22939
|
-
const appData = env.APPDATA || path2.join(homedir3, "AppData", "Roaming");
|
|
22940
|
-
const localAppData = env.LOCALAPPDATA || path2.join(homedir3, "AppData", "Local");
|
|
22941
|
-
return {
|
|
22942
|
-
data: path2.join(localAppData, name, "Data"),
|
|
22943
|
-
config: path2.join(appData, name, "Config"),
|
|
22944
|
-
cache: path2.join(localAppData, name, "Cache"),
|
|
22945
|
-
log: path2.join(localAppData, name, "Log"),
|
|
22946
|
-
temp: path2.join(tmpdir, name)
|
|
22947
|
-
};
|
|
22948
|
-
};
|
|
22949
|
-
var linux = (name) => {
|
|
22950
|
-
const username = path2.basename(homedir3);
|
|
22951
|
-
return {
|
|
22952
|
-
data: path2.join(env.XDG_DATA_HOME || path2.join(homedir3, ".local", "share"), name),
|
|
22953
|
-
config: path2.join(env.XDG_CONFIG_HOME || path2.join(homedir3, ".config"), name),
|
|
22954
|
-
cache: path2.join(env.XDG_CACHE_HOME || path2.join(homedir3, ".cache"), name),
|
|
22955
|
-
log: path2.join(env.XDG_STATE_HOME || path2.join(homedir3, ".local", "state"), name),
|
|
22956
|
-
temp: path2.join(tmpdir, username, name)
|
|
22957
|
-
};
|
|
22958
|
-
};
|
|
22959
|
-
function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
22960
|
-
if (typeof name !== "string") {
|
|
22961
|
-
throw new TypeError(`Expected a string, got ${typeof name}`);
|
|
22962
|
-
}
|
|
22963
|
-
if (suffix) {
|
|
22964
|
-
name += `-${suffix}`;
|
|
22923
|
+
function getOpenCodeConfigPaths() {
|
|
22924
|
+
const home = homedir3();
|
|
22925
|
+
const paths = [];
|
|
22926
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
22927
|
+
if (xdgConfig) {
|
|
22928
|
+
paths.push(join4(xdgConfig, "opencode"));
|
|
22929
|
+
}
|
|
22930
|
+
if (process.platform === "win32") {
|
|
22931
|
+
const localAppData = process.env.LOCALAPPDATA;
|
|
22932
|
+
if (localAppData) {
|
|
22933
|
+
paths.push(join4(localAppData, "opencode"));
|
|
22934
|
+
}
|
|
22935
|
+
paths.push(join4(home, ".config", "opencode"));
|
|
22936
|
+
} else {
|
|
22937
|
+
paths.push(join4(home, ".config", "opencode"));
|
|
22965
22938
|
}
|
|
22966
|
-
|
|
22967
|
-
|
|
22939
|
+
paths.push(join4(home, ".opencode"));
|
|
22940
|
+
return paths;
|
|
22941
|
+
}
|
|
22942
|
+
function expandTildePath(path3) {
|
|
22943
|
+
if (path3 === "~") {
|
|
22944
|
+
return homedir3();
|
|
22968
22945
|
}
|
|
22969
|
-
if (
|
|
22970
|
-
return
|
|
22946
|
+
if (path3.startsWith("~/")) {
|
|
22947
|
+
return join4(homedir3(), path3.slice(2));
|
|
22971
22948
|
}
|
|
22972
|
-
return
|
|
22949
|
+
return path3;
|
|
22973
22950
|
}
|
|
22974
|
-
|
|
22975
|
-
// src/config.ts
|
|
22976
|
-
var OpenCodePaths = envPaths("opencode", { suffix: "" });
|
|
22951
|
+
var defaultSkillBasePaths = getOpenCodeConfigPaths().map((configPath) => join4(configPath, "skills"));
|
|
22977
22952
|
var options2 = {
|
|
22978
22953
|
name: "opencode-skillful",
|
|
22979
22954
|
cwd: "./",
|
|
22980
22955
|
defaultConfig: {
|
|
22981
22956
|
debug: false,
|
|
22982
|
-
basePaths:
|
|
22983
|
-
join4(OpenCodePaths.config, "skills")
|
|
22984
|
-
],
|
|
22957
|
+
basePaths: defaultSkillBasePaths,
|
|
22985
22958
|
promptRenderer: "xml",
|
|
22986
22959
|
modelRenderers: {}
|
|
22987
22960
|
}
|
|
@@ -22989,6 +22962,7 @@ var options2 = {
|
|
|
22989
22962
|
async function getPluginConfig(ctx) {
|
|
22990
22963
|
const resolvedConfig = await loadConfig5(options2);
|
|
22991
22964
|
resolvedConfig.basePaths.push(join4(ctx.directory, ".opencode", "skills"));
|
|
22965
|
+
resolvedConfig.basePaths = resolvedConfig.basePaths.map(expandTildePath);
|
|
22992
22966
|
return resolvedConfig;
|
|
22993
22967
|
}
|
|
22994
22968
|
|
|
@@ -23451,7 +23425,8 @@ var SkillsPlugin = async (ctx) => {
|
|
|
23451
23425
|
const results = await api2.loadSkill(args.skill_names);
|
|
23452
23426
|
for await (const skill of results.loaded) {
|
|
23453
23427
|
await sendPrompt(renderer({ data: skill, type: "Skill" }), {
|
|
23454
|
-
sessionId: toolCtx.sessionID
|
|
23428
|
+
sessionId: toolCtx.sessionID,
|
|
23429
|
+
agent: toolCtx.agent
|
|
23455
23430
|
});
|
|
23456
23431
|
}
|
|
23457
23432
|
return JSON.stringify({
|
|
@@ -23501,7 +23476,8 @@ var SkillsPlugin = async (ctx) => {
|
|
|
23501
23476
|
throw new Error("Failed to read resource");
|
|
23502
23477
|
}
|
|
23503
23478
|
await sendPrompt(renderer({ data: result.injection, type: "SkillResource" }), {
|
|
23504
|
-
sessionId: toolCtx.sessionID
|
|
23479
|
+
sessionId: toolCtx.sessionID,
|
|
23480
|
+
agent: toolCtx.agent
|
|
23505
23481
|
});
|
|
23506
23482
|
return JSON.stringify({
|
|
23507
23483
|
result: "Resource injected successfully",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenobius/opencode-skillful",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4-next.1",
|
|
4
4
|
"description": "OpenCode Skills Plugin - Anthropic Agent Skills Specification implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"@opencode-ai/plugin": "1.0.85",
|
|
23
23
|
"bunfig": "^0.15.6",
|
|
24
24
|
"dedent": "^1.7.1",
|
|
25
|
-
"env-paths": "^3.0.0",
|
|
26
25
|
"gray-matter": "^4.0.3",
|
|
27
26
|
"mime": "^4.1.0",
|
|
28
27
|
"ramda": "^0.30.0",
|