@zenobius/opencode-skillful 1.2.3 → 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 +43 -68
- 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
|
}
|
|
@@ -17881,7 +17882,7 @@ import { join as join2, relative as relative3, resolve as resolve2 } from "path"
|
|
|
17881
17882
|
import process2 from "process";
|
|
17882
17883
|
import { existsSync as existsSync22, mkdirSync, readdirSync, writeFileSync } from "fs";
|
|
17883
17884
|
import { dirname as dirname4, resolve } from "path";
|
|
17884
|
-
import
|
|
17885
|
+
import process3 from "process";
|
|
17885
17886
|
import { Buffer as Buffer2 } from "buffer";
|
|
17886
17887
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
17887
17888
|
import { closeSync, createReadStream, createWriteStream, existsSync as existsSync222, fsyncSync, openSync, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -17891,7 +17892,7 @@ import process5 from "process";
|
|
|
17891
17892
|
import { pipeline } from "stream/promises";
|
|
17892
17893
|
import { createGzip } from "zlib";
|
|
17893
17894
|
import process4 from "process";
|
|
17894
|
-
import
|
|
17895
|
+
import process32 from "process";
|
|
17895
17896
|
import { Buffer as Buffer22 } from "buffer";
|
|
17896
17897
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes2 } from "crypto";
|
|
17897
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";
|
|
@@ -18293,7 +18294,7 @@ async function loadConfig({
|
|
|
18293
18294
|
cwd,
|
|
18294
18295
|
defaultConfig
|
|
18295
18296
|
}) {
|
|
18296
|
-
const baseDir = cwd ||
|
|
18297
|
+
const baseDir = cwd || process3.cwd();
|
|
18297
18298
|
const extensions = [".ts", ".js", ".mjs", ".cjs", ".json"];
|
|
18298
18299
|
const configPaths = [
|
|
18299
18300
|
`${name}.config`,
|
|
@@ -18324,8 +18325,8 @@ async function loadConfig({
|
|
|
18324
18325
|
} catch {}
|
|
18325
18326
|
return defaultConfig;
|
|
18326
18327
|
}
|
|
18327
|
-
var defaultConfigDir = resolve(
|
|
18328
|
-
var defaultGeneratedDir = resolve(
|
|
18328
|
+
var defaultConfigDir = resolve(process3.cwd(), "config");
|
|
18329
|
+
var defaultGeneratedDir = resolve(process3.cwd(), "src/generated");
|
|
18329
18330
|
function getProjectRoot(filePath, options2 = {}) {
|
|
18330
18331
|
let path3 = process2.cwd();
|
|
18331
18332
|
while (path3.includes("storage"))
|
|
@@ -18374,24 +18375,24 @@ async function loadConfig2() {
|
|
|
18374
18375
|
}
|
|
18375
18376
|
var config2 = await loadConfig2();
|
|
18376
18377
|
function isBrowserProcess() {
|
|
18377
|
-
if (
|
|
18378
|
+
if (process32.env.NODE_ENV === "test" || process32.env.BUN_ENV === "test") {
|
|
18378
18379
|
return false;
|
|
18379
18380
|
}
|
|
18380
18381
|
return typeof window !== "undefined";
|
|
18381
18382
|
}
|
|
18382
18383
|
async function isServerProcess() {
|
|
18383
|
-
if (
|
|
18384
|
+
if (process32.env.NODE_ENV === "test" || process32.env.BUN_ENV === "test") {
|
|
18384
18385
|
return true;
|
|
18385
18386
|
}
|
|
18386
18387
|
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
18387
18388
|
return true;
|
|
18388
18389
|
}
|
|
18389
|
-
if (typeof
|
|
18390
|
-
const type =
|
|
18390
|
+
if (typeof process32 !== "undefined") {
|
|
18391
|
+
const type = process32.type;
|
|
18391
18392
|
if (type === "renderer" || type === "worker") {
|
|
18392
18393
|
return false;
|
|
18393
18394
|
}
|
|
18394
|
-
return !!(
|
|
18395
|
+
return !!(process32.versions && (process32.versions.node || process32.versions.bun));
|
|
18395
18396
|
}
|
|
18396
18397
|
return false;
|
|
18397
18398
|
}
|
|
@@ -22917,72 +22918,43 @@ var defaultConfigDir3 = resolve7(process12.cwd(), "config");
|
|
|
22917
22918
|
var defaultGeneratedDir3 = resolve7(process12.cwd(), "src/generated");
|
|
22918
22919
|
|
|
22919
22920
|
// src/config.ts
|
|
22921
|
+
import { homedir as homedir3 } from "os";
|
|
22920
22922
|
import { join as join4 } from "path";
|
|
22921
|
-
|
|
22922
|
-
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
|
|
22936
|
-
temp: path3.join(tmpdir, name)
|
|
22937
|
-
};
|
|
22938
|
-
};
|
|
22939
|
-
var windows = (name) => {
|
|
22940
|
-
const appData = env.APPDATA || path3.join(homedir3, "AppData", "Roaming");
|
|
22941
|
-
const localAppData = env.LOCALAPPDATA || path3.join(homedir3, "AppData", "Local");
|
|
22942
|
-
return {
|
|
22943
|
-
data: path3.join(localAppData, name, "Data"),
|
|
22944
|
-
config: path3.join(appData, name, "Config"),
|
|
22945
|
-
cache: path3.join(localAppData, name, "Cache"),
|
|
22946
|
-
log: path3.join(localAppData, name, "Log"),
|
|
22947
|
-
temp: path3.join(tmpdir, name)
|
|
22948
|
-
};
|
|
22949
|
-
};
|
|
22950
|
-
var linux = (name) => {
|
|
22951
|
-
const username = path3.basename(homedir3);
|
|
22952
|
-
return {
|
|
22953
|
-
data: path3.join(env.XDG_DATA_HOME || path3.join(homedir3, ".local", "share"), name),
|
|
22954
|
-
config: path3.join(env.XDG_CONFIG_HOME || path3.join(homedir3, ".config"), name),
|
|
22955
|
-
cache: path3.join(env.XDG_CACHE_HOME || path3.join(homedir3, ".cache"), name),
|
|
22956
|
-
log: path3.join(env.XDG_STATE_HOME || path3.join(homedir3, ".local", "state"), name),
|
|
22957
|
-
temp: path3.join(tmpdir, username, name)
|
|
22958
|
-
};
|
|
22959
|
-
};
|
|
22960
|
-
function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
22961
|
-
if (typeof name !== "string") {
|
|
22962
|
-
throw new TypeError(`Expected a string, got ${typeof name}`);
|
|
22963
|
-
}
|
|
22964
|
-
if (suffix) {
|
|
22965
|
-
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"));
|
|
22966
22938
|
}
|
|
22967
|
-
|
|
22968
|
-
|
|
22939
|
+
paths.push(join4(home, ".opencode"));
|
|
22940
|
+
return paths;
|
|
22941
|
+
}
|
|
22942
|
+
function expandTildePath(path3) {
|
|
22943
|
+
if (path3 === "~") {
|
|
22944
|
+
return homedir3();
|
|
22969
22945
|
}
|
|
22970
|
-
if (
|
|
22971
|
-
return
|
|
22946
|
+
if (path3.startsWith("~/")) {
|
|
22947
|
+
return join4(homedir3(), path3.slice(2));
|
|
22972
22948
|
}
|
|
22973
|
-
return
|
|
22949
|
+
return path3;
|
|
22974
22950
|
}
|
|
22975
|
-
|
|
22976
|
-
// src/config.ts
|
|
22977
|
-
var OpenCodePaths = envPaths("opencode", { suffix: "" });
|
|
22951
|
+
var defaultSkillBasePaths = getOpenCodeConfigPaths().map((configPath) => join4(configPath, "skills"));
|
|
22978
22952
|
var options2 = {
|
|
22979
22953
|
name: "opencode-skillful",
|
|
22980
22954
|
cwd: "./",
|
|
22981
22955
|
defaultConfig: {
|
|
22982
22956
|
debug: false,
|
|
22983
|
-
basePaths:
|
|
22984
|
-
join4(OpenCodePaths.config, "skills")
|
|
22985
|
-
],
|
|
22957
|
+
basePaths: defaultSkillBasePaths,
|
|
22986
22958
|
promptRenderer: "xml",
|
|
22987
22959
|
modelRenderers: {}
|
|
22988
22960
|
}
|
|
@@ -22990,6 +22962,7 @@ var options2 = {
|
|
|
22990
22962
|
async function getPluginConfig(ctx) {
|
|
22991
22963
|
const resolvedConfig = await loadConfig5(options2);
|
|
22992
22964
|
resolvedConfig.basePaths.push(join4(ctx.directory, ".opencode", "skills"));
|
|
22965
|
+
resolvedConfig.basePaths = resolvedConfig.basePaths.map(expandTildePath);
|
|
22993
22966
|
return resolvedConfig;
|
|
22994
22967
|
}
|
|
22995
22968
|
|
|
@@ -23452,7 +23425,8 @@ var SkillsPlugin = async (ctx) => {
|
|
|
23452
23425
|
const results = await api2.loadSkill(args.skill_names);
|
|
23453
23426
|
for await (const skill of results.loaded) {
|
|
23454
23427
|
await sendPrompt(renderer({ data: skill, type: "Skill" }), {
|
|
23455
|
-
sessionId: toolCtx.sessionID
|
|
23428
|
+
sessionId: toolCtx.sessionID,
|
|
23429
|
+
agent: toolCtx.agent
|
|
23456
23430
|
});
|
|
23457
23431
|
}
|
|
23458
23432
|
return JSON.stringify({
|
|
@@ -23502,7 +23476,8 @@ var SkillsPlugin = async (ctx) => {
|
|
|
23502
23476
|
throw new Error("Failed to read resource");
|
|
23503
23477
|
}
|
|
23504
23478
|
await sendPrompt(renderer({ data: result.injection, type: "SkillResource" }), {
|
|
23505
|
-
sessionId: toolCtx.sessionID
|
|
23479
|
+
sessionId: toolCtx.sessionID,
|
|
23480
|
+
agent: toolCtx.agent
|
|
23506
23481
|
});
|
|
23507
23482
|
return JSON.stringify({
|
|
23508
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",
|