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
3 changes: 1 addition & 2 deletions js/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ export default [
...tseslint.configs.recommended.rules,
// TODO: Fix violations and re-enable as "error"
"@typescript-eslint/no-explicit-any": "warn",
// TODO: Fix violations and re-enable as "error"
"@typescript-eslint/no-unused-vars": [
"warn",
"error",
{
vars: "all",
args: "none",
Expand Down
3 changes: 0 additions & 3 deletions js/src/cli/functions/upload.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {
CodeBundle as CodeBundleSchema,
type CodeBundleType as CodeBundle,
Function as FunctionObjectSchema,
type FunctionType as FunctionObject,
IfExists as IfExistsSchema,
type IfExistsType as IfExists,
} from "../../generated_types";
import type { BuildSuccess, EvaluatorState, FileHandle } from "../types";
Expand Down
2 changes: 1 addition & 1 deletion js/src/cli/reporters/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function formatExperimentSummaryFancy(summary: ExperimentSummary) {
borderStyle: "round",
})
);
} catch (error) {
} catch {
return "\n" + chalk.gray("Experiment summary") + "\n" + boxContent + "\n";
}
}
Expand Down
2 changes: 0 additions & 2 deletions js/src/cli/util/pull.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
Function as functionSchema,
type FunctionType as FunctionObject,
SavedFunctionId as SavedFunctionIdSchema,
type SavedFunctionIdType as SavedFunctionId,
ToolFunctionDefinition as ToolFunctionDefinitionSchema,
type ToolFunctionDefinitionType as ToolFunctionDefinition,
} from "../../generated_types";
import { _internalGetGlobalState } from "../../logger";
Expand Down
5 changes: 0 additions & 5 deletions js/src/framework2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@ import { slugify } from "../util/string_util";
import { z } from "zod/v3";
import {
type FunctionTypeEnumType as FunctionType,
IfExists as IfExistsSchema,
type IfExistsType as IfExists,
SavedFunctionId as SavedFunctionIdSchema,
type SavedFunctionIdType as SavedFunctionId,
PromptBlockData as PromptBlockDataSchema,
type PromptBlockDataType as PromptBlockData,
PromptData as PromptDataSchema,
type PromptDataType as PromptData,
ToolFunctionDefinition as toolFunctionDefinitionSchema,
type ToolFunctionDefinitionType as ToolFunctionDefinition,
FunctionData as functionDataSchema,
Project as projectSchema,
ExtendedSavedFunctionId as ExtendedSavedFunctionIdSchema,
type ExtendedSavedFunctionIdType as ExtendedSavedFunctionId,
} from "./generated_types";
import { loadPrettyXact, TransactionId } from "../util/index";
Expand Down
1 change: 0 additions & 1 deletion js/src/functions/stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
CallEvent as CallEventSchemaImport,
type CallEventType as CallEventSchema,
CallEvent as callEventSchema,
SSEConsoleEventData as sseConsoleEventDataSchema,
Expand Down
8 changes: 3 additions & 5 deletions js/src/gitutil.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {
GitMetadataSettings as GitMetadataSettingsSchema,
type GitMetadataSettingsType as GitMetadataSettings,
RepoInfo as RepoInfoSchema,
type RepoInfoType as RepoInfo,
} from "./generated_types";
import { simpleGit } from "simple-git";
Expand All @@ -19,7 +17,7 @@ export async function currentRepo() {
} else {
return null;
}
} catch (e) {
} catch {
return null;
}
}
Expand Down Expand Up @@ -95,7 +93,7 @@ async function getBaseBranchAncestor(remote: string | undefined = undefined) {
`${remoteName}/${baseBranch}`,
]);
return ancestor.trim();
} catch (e) {
} catch {
/*
console.warn(
`Warning: Could not find a common ancestor with ${remoteName}/${baseBranch}`
Expand Down Expand Up @@ -133,7 +131,7 @@ export async function getPastNAncestors(
async function attempt<T>(fn: () => Promise<T>): Promise<T | undefined> {
try {
return await fn();
} catch (e) {
} catch {
return undefined;
}
}
Expand Down
5 changes: 0 additions & 5 deletions js/src/graph-framework.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { newId, Prompt } from "./logger";
import {
FunctionId as FunctionIdSchema,
type FunctionIdType as FunctionId,
GraphData as GraphDataSchema,
type GraphDataType as GraphData,
GraphNode as GraphNodeSchema,
type GraphNodeType as GraphNode,
GraphEdge as GraphEdgeSchema,
type GraphEdgeType as GraphEdge,
PromptBlockData as PromptBlockDataSchema,
type PromptBlockDataType as PromptBlockData,
} from "./generated_types";

Expand Down
6 changes: 3 additions & 3 deletions js/src/instrumentation/plugins/ai-sdk-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { tracingChannel } from "dc-browser";
import { BasePlugin, isAsyncIterable, patchStreamIfNeeded } from "../core";
import type { StartEvent, EndEvent, ErrorEvent } from "../core";
import { startSpan, Attachment } from "../../logger";
import type { StartEvent } from "../core";
import { startSpan } from "../../logger";
import type { Span } from "../../logger";
import { SpanTypeAttribute, isObject } from "../../../util/index";
import { SpanTypeAttribute } from "../../../util/index";
import { getCurrentUnixTimestamp } from "../../util";
import { processInputAttachments } from "../../wrappers/attachment-utils";

Expand Down
30 changes: 10 additions & 20 deletions js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { BasePlugin, isAsyncIterable, patchStreamIfNeeded } from "../core";
import type { StartEvent } from "../core";
import { startSpan } from "../../logger";
import type { Span } from "../../logger";
import { SpanTypeAttribute, isObject } from "../../../util/index";
import { SpanTypeAttribute } from "../../../util/index";
import { getCurrentUnixTimestamp } from "../../util";
import { processInputAttachments } from "../../wrappers/attachment-utils";
import {
extractAnthropicCacheTokens,
finalizeAnthropicTokens,
Expand Down Expand Up @@ -325,15 +324,6 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
return;
}

const {
span,
startTime,
conversationHistory,
currentMessages,
currentMessageStartTime,
accumulatedOutputTokens,
} = spanData;

// Check if result is a stream
if (isAsyncIterable(event.result)) {
// Patch the stream to collect chunks and trace them
Expand All @@ -357,7 +347,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
spanData.conversationHistory,
options,
spanData.currentMessageStartTime,
await span.export(),
await spanData.span.export(),
);

if (finalMessage) {
Expand Down Expand Up @@ -425,7 +415,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
result_metadata.session_id = message.session_id;
}
if (Object.keys(result_metadata).length > 0) {
span.log({
spanData.span.log({
metadata: result_metadata,
});
}
Expand All @@ -447,7 +437,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
spanData.conversationHistory,
options,
spanData.currentMessageStartTime,
await span.export(),
await spanData.span.export(),
);

if (finalMessage) {
Expand All @@ -456,7 +446,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
}

// Log final output to top-level span - just the last message content
span.log({
spanData.span.log({
output:
spanData.conversationHistory.length > 0
? spanData.conversationHistory[
Expand All @@ -470,15 +460,15 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
error,
);
} finally {
span.end();
spanData.span.end();
spans.delete(event);
}
},
onError: (error: Error) => {
span.log({
spanData.span.log({
error: error.message,
});
span.end();
spanData.span.end();
spans.delete(event);
},
});
Expand All @@ -487,7 +477,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
} else {
// Non-streaming response (shouldn't happen for query, but handle gracefully)
try {
span.log({
spanData.span.log({
output: event.result,
});
} catch (error) {
Expand All @@ -496,7 +486,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin {
error,
);
} finally {
span.end();
spanData.span.end();
spans.delete(event);
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/instrumentation/plugins/google-genai-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BasePlugin, isAsyncIterable, patchStreamIfNeeded } from "../core";
import type { StartEvent } from "../core";
import { startSpan, Attachment } from "../../logger";
import type { Span } from "../../logger";
import { SpanTypeAttribute, isObject } from "../../../util/index";
import { SpanTypeAttribute } from "../../../util/index";
import { getCurrentUnixTimestamp } from "../../util";

/**
Expand Down
2 changes: 1 addition & 1 deletion js/src/instrumentation/plugins/openai-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class OpenAIPlugin extends BasePlugin {

// Extract metadata - preserve response fields except usage and output
if (response) {
const { usage, output, ...metadata } = response;
const { usage: _usage, output: _output, ...metadata } = response;
if (Object.keys(metadata).length > 0) {
data.metadata = metadata;
}
Expand Down
2 changes: 0 additions & 2 deletions js/src/isomorph.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {
GitMetadataSettings as GitMetadataSettingsSchema,
type GitMetadataSettingsType as GitMetadataSettings,
RepoInfo as RepoInfoSchema,
type RepoInfoType as RepoInfo,
} from "./generated_types";

Expand Down
4 changes: 2 additions & 2 deletions js/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ import {
SyncLazyValue,
runCatchFinally,
} from "./util";
import { lintTemplate as lintMustacheTemplate } from "./template/mustache-utils";
import { lintTemplate as _lintMustacheTemplate } from "./template/mustache-utils";
import { prettifyXact } from "../util/index";
import { SpanCache, CachedSpan } from "./span-cache";
import type { EvalParameters, InferParameters } from "./eval-parameters";
Expand Down Expand Up @@ -1046,7 +1046,7 @@ class HTTPConnection {
try {
const resp = await this.get("ping");
return resp.status === 200;
} catch (e) {
} catch {
return false;
}
}
Expand Down
1 change: 0 additions & 1 deletion js/src/queue.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const partialData = Array.from({ length: 100 }, (_, i) => i);
// Initialize queues once
const fullQueue = new Queue<number>(1000);
const wrappedQueue = new Queue<number>(1000);
const smallQueue = new Queue<number>(50);
const partialQueue = new Queue<number>(1000);

bench
Expand Down
4 changes: 0 additions & 4 deletions js/src/wrappers/ai-sdk/ai-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1139,10 +1139,6 @@ const serializeError = (error: unknown) => {
return String(error);
};

const serializeModel = (model: any) => {
return typeof model === "string" ? model : model?.modelId;
};

/**
* Parses a gateway model string like "openai/gpt-5-mini" into provider and model.
* Returns { provider, model } if parseable, otherwise { model } only.
Expand Down
2 changes: 1 addition & 1 deletion js/src/wrappers/attachment-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function convertDataToBlob(data: any, mediaType: string): Blob | null {
} else if (typeof Buffer !== "undefined" && data instanceof Buffer) {
return new Blob([data as any], { type: mediaType });
}
} catch (error) {
} catch {
// If conversion fails, return null
return null;
}
Expand Down
26 changes: 0 additions & 26 deletions js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,9 @@ type QueryOptions = {
[key: string]: any;
};

type CallToolResult = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
content: Array<any>;
isError?: boolean;
};

type ToolHandler<T> = (
args: T,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
extra: any,
) => Promise<CallToolResult>;

type SdkMcpToolDefinition<T> = {
name: string;
description: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputSchema: any;
handler: ToolHandler<T>;
};

/**
* Hook types from @anthropic-ai/claude-agent-sdk
*/
type HookEvent =
| "PreToolUse"
| "PostToolUse"
| "PostToolUseFailure"
| "SubagentStart"
| "SubagentStop";

type BaseHookInput = {
session_id: string;
Expand Down
2 changes: 1 addition & 1 deletion js/src/wrappers/oai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function wrapChatCompletion<
const { data: ret, response } =
await completionResponse.withResponse();
logHeaders(response, span);
const { messages, ...rest } = params;
const { messages: _messages, ...rest } = params;
span.log({
metadata: {
...rest,
Expand Down
6 changes: 3 additions & 3 deletions js/src/wrappers/oai_responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function parseEventFromResponseCreateResult(result: any) {

// Extract metadata - preserve all response fields except output and usage
if (result) {
const { output, usage, ...metadata } = result;
const { output: _output, usage: _usage, ...metadata } = result;
if (Object.keys(metadata).length > 0) {
data.metadata = metadata;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ function parseEventFromResponseParseResult(result: any) {

// Extract metadata - preserve all response fields except output and usage
if (result) {
const { output, usage, ...metadata } = result;
const { output: _output, usage: _usage, ...metadata } = result;
if (Object.keys(metadata).length > 0) {
data.metadata = metadata;
}
Expand Down Expand Up @@ -214,7 +214,7 @@ function parseLogFromItem(item: any): {} {

// Extract metadata - preserve response fields except usage and output
if (response) {
const { usage, output, ...metadata } = response;
const { usage: _usage, output: _output, ...metadata } = response;
if (Object.keys(metadata).length > 0) {
data.metadata = metadata;
}
Expand Down
1 change: 0 additions & 1 deletion js/src/zod/zod-serialization-test-shared.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from "vitest";
/**
* Shared test expectations for zod serialization tests
*
Expand Down
Loading