GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): OpenCode steers keep their $skill mentions (#42141) · pingdotgg/t3code@94190c6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2/Adapters
    • OpenCode2AdapterV2.test.ts
  • packages/provider-opencode/src/server/v2
    • adapter.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
+50Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,6 +4137,56 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
41374137
}),
41384138
);
41394139

4140+
it.effect("sends a $skill named in a message that steers the running turn", () =>
4141+
Effect.gen(function* () {
4142+
const prompts: Array<unknown> = [];
4143+
const steerId = "msg_recorded_steer_skill";
4144+
const greet = {
4145+
id: "greet",
4146+
name: "greet",
4147+
path: `${WORK}/.opencode/skills/greet/SKILL.md`,
4148+
content: "Say hello.",
4149+
};
4150+
const { runtime, thread } = yield* resumed(
4151+
[
4152+
out("session.prompt", { sessionID: SESSION, text: "<any>" }),
4153+
promptAccepted,
4154+
event("session.execution.started", { sessionID: SESSION }),
4155+
out("skill.list", { "location[directory]": WORK }),
4156+
reply("skill.list", { location: { directory: WORK }, data: [greet] }),
4157+
out("session.prompt", { sessionID: SESSION, id: steerId, delivery: "steer" }),
4158+
replyData("session.prompt", {
4159+
id: steerId,
4160+
sessionID: SESSION,
4161+
time: { created: 1790656601500 },
4162+
type: "user",
4163+
payload: { text: "$greet first" },
4164+
delivery: "steer",
4165+
}),
4166+
event("session.inbox.delivered", { sessionID: SESSION, inboxID: steerId }),
4167+
event("session.execution.succeeded", { sessionID: SESSION }),
4168+
],
4169+
{ onPrompt: (input) => prompts.push(input) },
4170+
);
4171+
const terminal = yield* terminalOf(runtime).pipe(Effect.forkScoped);
4172+
const input = turnInput(thread);
4173+
yield* runtime.startTurn(input);
4174+
yield* runtime.steerTurn({
4175+
threadId,
4176+
runId: input.runId,
4177+
providerThread: thread,
4178+
providerTurnId: yield* providerTurnId,
4179+
message: {
4180+
...input.message,
4181+
messageId: MessageId.make("message:opencode2-adapter:steer"),
4182+
text: "$greet first",
4183+
},
4184+
});
4185+
assert.equal((yield* Fiber.join(terminal))?.status, "completed");
4186+
assert.deepInclude(prompts[1], { delivery: "steer", skills: [{ id: "greet" }] });
4187+
}),
4188+
);
4189+
41404190
it.effect.each([
41414191
{
41424192
server: "an external server keeps rejecting requests",
Collapse file

‎packages/provider-opencode/src/server/v2/adapter.ts‎

Copy file name to clipboardExpand all lines: packages/provider-opencode/src/server/v2/adapter.ts
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,8 +4741,10 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
47414741
// OpenCode 2.2.5 answers its model list only once the scan has ended (observed, not documented).
47424742
const skillsMentioned = Effect.fnUntraced(function* (
47434743
location: { readonly directory: string },
4744-
mentions: ReadonlyArray<string>,
4744+
text: string,
47454745
) {
4746+
const mentions = skillMentions(text);
4747+
if (mentions.length === 0) return [];
47464748
const known = yield* listSkills(location);
47474749
if (mentions.some((name) => !known.has(name))) {
47484750
yield* readModels(location.directory);
@@ -4846,8 +4848,7 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
48464848
);
48474849
}
48484850
}
4849-
const mentions = skillMentions(text);
4850-
const skills = mentions.length === 0 ? [] : yield* skillsMentioned(location, mentions);
4851+
const skills = yield* skillsMentioned(location, text);
48514852
const files = yield* promptFiles(turnInput.message.attachments);
48524853
const messageText = turnInput.resume ? "" : yield* promptText(turnInput);
48534854
if (!sending()) return;
@@ -5187,15 +5188,19 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
51875188
if (turn.settledInbox.has(inboxID)) return;
51885189
turn.steers.add(inboxID);
51895190
state.strandedSteers.delete(inboxID);
5190-
const { files, messageText } = yield* Effect.gen(function* () {
5191+
const { files, messageText, skills } = yield* Effect.gen(function* () {
51915192
const files = yield* promptFiles(steerInput.message.attachments);
51925193
const messageText = (yield* providerMessageTextWithAttachmentPaths({
51935194
text: steerInput.message.text,
51945195
attachments: steerInput.message.attachments,
51955196
resolveAttachmentPath: host.resolveAttachmentPath,
51965197
resolveExtractedTextPath: host.resolveExtractedTextPath,
51975198
})).trim();
5198-
return { files, messageText };
5199+
const skills = yield* skillsMentioned(
5200+
{ directory: directoryOf(turn.input.runtimePolicy.cwd) },
5201+
steerInput.message.text,
5202+
);
5203+
return { files, messageText, skills };
51995204
}).pipe(
52005205
Effect.onInterrupt(() =>
52015206
lock.withPermit(
@@ -5232,6 +5237,9 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
52325237
id: inboxID,
52335238
text: messageText,
52345239
...(files.length === 0 ? {} : { files }),
5240+
...(skills.length === 0
5241+
? {}
5242+
: { skills: skills.map((id) => ({ id: Skill.ID.make(id) })) }),
52355243
delivery: "steer",
52365244
})
52375245
.pipe(

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.