Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@
},
"dependencies": {
"@langfuse/otel": "^5.10.1",
"@opencode-ai/plugin": "^1.18.19",
"@opentelemetry/api": "^1.9.1",
"@opentelemetry/resources": "^2.10.0",
"@opentelemetry/sdk-trace-base": "^2.10.0",
"@opentelemetry/sdk-trace-node": "^2.10.0",
"effect": "^3.22.1"
},
"peerDependencies": {
"@opencode-ai/plugin": "^1.18.19"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@opencode-ai/plugin": "^1.18.19",
"@types/node": "^26.1.2",
"eslint": "^10.8.1",
"knip": "^6.32.2",
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ type CurrentSessionNextEvent =
| SessionNextCompactionEndedEvent;

// https://github.com/anomalyco/opencode/blob/v1.18.19/packages/schema/src/session-event.ts#L479-L517
export type SessionNextEvent = LegacySessionNextEvent | CurrentSessionNextEvent;
type SessionNextEvent = LegacySessionNextEvent | CurrentSessionNextEvent;

// https://github.com/anomalyco/opencode/blob/v1.18.19/packages/plugin/src/index.ts#L222-L224
export type OpencodeEvent =
Expand Down Expand Up @@ -277,7 +277,7 @@ export const McpToolResultSchema = Schema.Struct({
});

// https://github.com/anomalyco/opencode/blob/v1.18.19/packages/opencode/src/session/tools.ts#L436-L461
export const McpResourceContentsSchema = Schema.Union(
const McpResourceContentsSchema = Schema.Union(
Schema.Struct({
uri: Schema.String,
mimeType: Schema.optional(Schema.String),
Expand Down
10 changes: 8 additions & 2 deletions test/integration/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import {
test,
} from "vitest";

import type { SessionNextEvent } from "../../src/schema.js";
import type { OpencodeEvent } from "../../src/schema.js";

type SessionNextEvent = Extract<
OpencodeEvent,
{ type: `session.next.${string}` }
>;

const OtlpValueSchema = Schema.Struct({
stringValue: Schema.optional(Schema.String),
Expand Down Expand Up @@ -276,7 +281,8 @@ const startGeneration = async (input: {
properties: {
sessionID: input.sessionID,
timestamp: input.started,
...(input.assistantMessageID
...(input.assistantMessageID !== undefined &&
input.assistantMessageID !== ""
? { assistantMessageID: input.assistantMessageID }
: {}),
agent: "build",
Expand Down