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: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
"lint": "eslint .",
"test:integration": "pnpm run build && tsc --noEmit -p tsconfig.test.json && vitest run test/integration"
},
"knip": {
"ignore": [
"dist/**"
]
},
"dependencies": {
"@langfuse/otel": "^5.10.1",
"@opentelemetry/api": "^1.9.1",
Expand Down
2 changes: 1 addition & 1 deletion src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const LangfuseCredentialsSchema = Schema.Struct({

type LangfuseCredentials = typeof LangfuseCredentialsSchema.Type;

export class MissingLangfuseCredentials extends Data.TaggedError(
class MissingLangfuseCredentials extends Data.TaggedError(
"MissingLangfuseCredentials",
)<{ readonly message: string }> {}

Expand Down
2 changes: 1 addition & 1 deletion src/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const LangfusePlugin = {
generationDetails.get(input.messageID)?.toolCalls.set(input.id, {
id: input.id,
name: input.tool,
arguments: JSON.stringify(input.input) ?? "null",
arguments: JSON.stringify(input.input),
});
langfuse.rememberToolCall({
callID: input.id,
Expand Down
26 changes: 15 additions & 11 deletions test/integration/v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,20 @@ describe("OpenCode 2 package entrypoint", () => {
)(contextInput);

const cleanup = await SourcePlugin.setup(context);
await vi.waitFor(() => expect(prompt).toBeTypeOf("function"));
await vi.waitFor(() => {
expect(prompt).toBeTypeOf("function");
});
prompt?.({
sessionID: "session-1",
messageID: "user-1",
prompt: { text: "Say hello" },
});
await vi.waitFor(() => expect(executeBefore).toBeTypeOf("function"));
await vi.waitFor(() =>
expect(runtime.startActiveGenerationStep).toHaveBeenCalled(),
);
await vi.waitFor(() => {
expect(executeBefore).toBeTypeOf("function");
});
await vi.waitFor(() => {
expect(runtime.startActiveGenerationStep).toHaveBeenCalled();
});
executeBefore?.({
id: "call-1",
messageID: "assistant-1",
Expand All @@ -229,14 +233,14 @@ describe("OpenCode 2 package entrypoint", () => {
});
releaseStep?.();

await vi.waitFor(() =>
await vi.waitFor(() => {
expect(runtime.traceUserPrompt).toHaveBeenCalledWith({
sessionID: "session-1",
messageID: "user-1",
content: [{ type: "text", text: "Say hello" }],
}),
);
await vi.waitFor(() =>
});
});
await vi.waitFor(() => {
expect(runtime.traceGeneration).toHaveBeenCalledWith(
expect.objectContaining({
parentID: "user-1",
Expand All @@ -254,8 +258,8 @@ describe("OpenCode 2 package entrypoint", () => {
}),
],
}),
),
);
);
});
await cleanup?.();
});
});
Loading