@ycodium-ai/agent-opencode 0.2.2856 → 0.2.2860

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -565,6 +565,8 @@ var OPENCODE_CARD = {
565
565
  modelSlugAliases: null,
566
566
  mcpTransports: ["stdio", "http"],
567
567
  pluginManaged: true,
568
+ // 会话 server 的 `OPENCODE_CONFIG_DIR` 指向会话技能目录:OpenCode 1.18.34 实测模型列得出只在那个
569
+ // 目录里的技能(2026-10-06,见 0047「后续验证」)。
568
570
  verifiedSkills: true,
569
571
  everydayHarness: false,
570
572
  capabilities: {
@@ -7422,6 +7424,18 @@ function parseSkillsCliOutput(stdout) {
7422
7424
  }
7423
7425
  }
7424
7426
 
7427
+ // src/sessionSkills.ts
7428
+ function openCodeSessionConfigDir(skills, environment, log) {
7429
+ if (skills === void 0 || skills.names.length === 0) return void 0;
7430
+ if (environment["OPENCODE_CONFIG_DIR"] !== void 0 || process.env.OPENCODE_CONFIG_DIR !== void 0) {
7431
+ log.info(
7432
+ "OPENCODE_CONFIG_DIR is already set; Ycodium skills reach OpenCode through the built-in tools."
7433
+ );
7434
+ return void 0;
7435
+ }
7436
+ return skills.pluginDir;
7437
+ }
7438
+
7425
7439
  // src/server.ts
7426
7440
  async function collectText(stream, maxBytes = Number.POSITIVE_INFINITY) {
7427
7441
  const chunks = [];
@@ -7437,13 +7451,14 @@ async function collectText(stream, maxBytes = Number.POSITIVE_INFINITY) {
7437
7451
  }
7438
7452
  return Buffer.concat(chunks).toString("utf8");
7439
7453
  }
7440
- function buildSpawnEnv(recipe) {
7454
+ function buildSpawnEnv(recipe, configDir) {
7441
7455
  const xdgHome = makeOpenCodeEnvironment(recipe.homePath, {});
7442
7456
  return mergeLaunchEnv2({
7443
7457
  accountHome: xdgHome,
7444
7458
  instanceTable: recipe.environment,
7445
7459
  handOverrides: {
7446
- OPENCODE_CONFIG_CONTENT: resolveOpenCodeConfigContent(process.env)
7460
+ OPENCODE_CONFIG_CONTENT: resolveOpenCodeConfigContent(process.env),
7461
+ ...configDir === void 0 ? {} : { OPENCODE_CONFIG_DIR: configDir }
7447
7462
  }
7448
7463
  });
7449
7464
  }
@@ -7476,7 +7491,7 @@ async function terminateOwnedProcess(handle) {
7476
7491
  async function spawnOpenCodeServer(input) {
7477
7492
  const port = await reserveFetchSafePort();
7478
7493
  const hostname = DEFAULT_HOSTNAME;
7479
- const env = buildSpawnEnv(input.recipe);
7494
+ const env = buildSpawnEnv(input.recipe, input.configDir);
7480
7495
  const spawned = await input.host.process.spawn({
7481
7496
  program: input.program,
7482
7497
  args: ["serve", `--hostname=${hostname}`, `--port=${port}`],
@@ -7553,6 +7568,11 @@ async function spawnOpenCodeServer(input) {
7553
7568
  async function connectToOpenCodeServer(input) {
7554
7569
  const configured = input.recipe.serverUrl.trim();
7555
7570
  if (configured.length > 0) {
7571
+ if ((input.skills?.names.length ?? 0) > 0) {
7572
+ input.host.log.info(
7573
+ "OpenCode runs on an external server; Ycodium skills reach it through the built-in tools."
7574
+ );
7575
+ }
7556
7576
  return {
7557
7577
  url: configured,
7558
7578
  password: input.recipe.serverPassword,
@@ -7565,11 +7585,17 @@ async function connectToOpenCodeServer(input) {
7565
7585
  if (program.length === 0) {
7566
7586
  throw new Error("OpenCode program path is not configured");
7567
7587
  }
7588
+ const configDir = openCodeSessionConfigDir(
7589
+ input.skills,
7590
+ input.recipe.environment,
7591
+ input.host.log
7592
+ );
7568
7593
  return spawnOpenCodeServer({
7569
7594
  host: input.host,
7570
7595
  recipe: input.recipe,
7571
7596
  directory: input.directory,
7572
7597
  program,
7598
+ ...configDir === void 0 ? {} : { configDir },
7573
7599
  ...input.onSpawn === void 0 ? {} : { onSpawn: input.onSpawn }
7574
7600
  });
7575
7601
  }
@@ -9700,6 +9726,7 @@ function createOpenCodeInstance(config, host, attachments) {
9700
9726
  recipe,
9701
9727
  directory,
9702
9728
  program: recipe.binaryPath,
9729
+ ...input.skills === void 0 ? {} : { skills: input.skills },
9703
9730
  onSpawn: (resource) => {
9704
9731
  startingServer = resource;
9705
9732
  rememberPendingServer(input.threadId, resource);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-opencode",
3
- "version": "0.2.2856",
3
+ "version": "0.2.2860",
4
4
  "description": "OpenCode executor: OpenCode CLI via @opencode-ai/sdk/v2.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -24,7 +24,7 @@
24
24
  "@types/node": "24.12.4",
25
25
  "esbuild": "0.28.1",
26
26
  "vite-plus": "0.2.2",
27
- "@ycodium-ai/plugin-api": "0.2.2856",
27
+ "@ycodium-ai/plugin-api": "0.2.2860",
28
28
  "ycodium-executor-testing": "0.0.0",
29
29
  "ycodium-fetch-ports": "0.0.0"
30
30
  },