raysurfer 0.4.3 → 0.5.1

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.
package/README.md CHANGED
@@ -20,107 +20,117 @@ Get your key from the [dashboard](https://raysurfer.com/dashboard/api-keys).
20
20
 
21
21
  ## Usage
22
22
 
23
- Swap your client class and method names. Options come directly from `@anthropic-ai/claude-agent-sdk`:
23
+ Swap your import everything else stays the same:
24
24
 
25
25
  ```typescript
26
26
  // Before
27
- import { ClaudeSDKClient, ClaudeAgentOptions } from "@anthropic-ai/claude-agent-sdk";
27
+ import { query } from "@anthropic-ai/claude-agent-sdk";
28
28
 
29
29
  // After
30
- import { RaysurferClient } from "raysurfer";
31
- import { ClaudeAgentOptions } from "@anthropic-ai/claude-agent-sdk";
32
-
33
- const options: ClaudeAgentOptions = {
34
- allowedTools: ["Read", "Write", "Bash"],
35
- systemPrompt: "You are a helpful assistant.",
36
- };
37
-
38
- const client = new RaysurferClient(options);
39
-
40
- for await (const msg of client.raysurferQuery("Generate quarterly report")) {
41
- console.log(msg);
30
+ import { query } from "raysurfer";
31
+
32
+ for await (const message of query({
33
+ prompt: "Fetch data from GitHub API",
34
+ options: {
35
+ model: "claude-opus-4-5-20250514",
36
+ systemPrompt: "You are a helpful assistant.",
37
+ },
38
+ })) {
39
+ console.log(message);
42
40
  }
43
41
  ```
44
42
 
45
- ## Method Mapping
43
+ All Claude SDK types are re-exported from `raysurfer`, so you don't need a separate import:
46
44
 
47
- | Claude SDK | Raysurfer |
48
- |------------|-----------|
49
- | `new ClaudeSDKClient(options)` | `new RaysurferClient(options)` |
50
- | `client.query(prompt)` | `client.raysurferQuery(prompt)` |
45
+ ```typescript
46
+ import { query, type Options, type SDKMessage, type Query } from "raysurfer";
47
+ ```
51
48
 
52
49
  ## How It Works
53
50
 
54
- 1. **On `raysurferQuery()`**: Retrieves cached code blocks matching your task
55
- 2. **Downloads to sandbox**: Files ready for the agent to execute
56
- 3. **Injects into prompt**: Agent sees proven code snippets
57
- 4. **After success**: New code is cached for next time
58
-
59
- Caching is enabled automatically when `RAYSURFER_API_KEY` is set.
51
+ 1. **On query**: Retrieves cached code blocks matching your task
52
+ 2. **Injects into prompt**: Agent sees proven code snippets
53
+ 3. **After success**: New code is cached for next time
60
54
 
61
- ## Snippet Retrieval Scope
55
+ Caching is enabled automatically when `RAYSURFER_API_KEY` is set. Without it, behaves exactly like the original SDK.
62
56
 
63
- Control which cached snippets are retrieved using `publicSnips` and `snipsDesired`:
57
+ ## Class-based API
64
58
 
65
59
  ```typescript
66
- import { RaysurferClient } from "raysurfer";
67
- import { ClaudeAgentOptions } from "@anthropic-ai/claude-agent-sdk";
60
+ import { ClaudeSDKClient } from "raysurfer";
68
61
 
69
- const options: ClaudeAgentOptions = {
70
- allowedTools: ["Read", "Write", "Bash"],
71
- };
72
-
73
- // Include both public and company snippets
74
- const client = new RaysurferClient(options, {
75
- publicSnips: true, // Include public/shared snippets
76
- snipsDesired: "company", // Also include company-level snippets
62
+ const client = new ClaudeSDKClient({
63
+ model: "claude-opus-4-5-20250514",
64
+ systemPrompt: "You are a helpful assistant.",
77
65
  });
78
66
 
79
- // Enterprise: Retrieve client-specific snippets only
80
- const enterpriseClient = new RaysurferClient(options, {
81
- snipsDesired: "client", // Client workspace snippets (Enterprise only)
82
- });
67
+ for await (const msg of client.query("Fetch data from GitHub API")) {
68
+ console.log(msg);
69
+ }
83
70
  ```
84
71
 
85
- | Configuration | Required Tier |
86
- |--------------|---------------|
87
- | `publicSnips: true` only | FREE (default) |
88
- | `snipsDesired: "company"` | TEAM or ENTERPRISE |
89
- | `snipsDesired: "client"` | ENTERPRISE only |
72
+ ## System Prompt Preset
90
73
 
91
- ## Full Example
74
+ Use the Claude Code preset system prompt with appended instructions:
92
75
 
93
76
  ```typescript
94
- import { RaysurferClient } from "raysurfer";
95
- import { ClaudeAgentOptions } from "@anthropic-ai/claude-agent-sdk";
77
+ for await (const message of query({
78
+ prompt: "Refactor the auth module",
79
+ options: {
80
+ systemPrompt: {
81
+ type: "preset",
82
+ preset: "claude_code",
83
+ append: "Always explain your reasoning.",
84
+ },
85
+ },
86
+ })) {
87
+ console.log(message);
88
+ }
89
+ ```
96
90
 
97
- process.env.RAYSURFER_API_KEY = "your_api_key";
91
+ ## Query Control Methods
98
92
 
99
- const options: ClaudeAgentOptions = {
100
- allowedTools: ["Read", "Write", "Bash"],
101
- systemPrompt: "You are a helpful assistant.",
102
- };
93
+ The `query()` function returns a `Query` object with full control methods:
103
94
 
104
- const client = new RaysurferClient(options);
95
+ ```typescript
96
+ const q = query({ prompt: "Build a REST API" });
97
+
98
+ await q.interrupt();
99
+ await q.setPermissionMode("acceptEdits");
100
+ await q.setModel("claude-sonnet-4-5-20250929");
101
+ await q.setMaxThinkingTokens(4096);
102
+ const models = await q.supportedModels();
103
+ const info = await q.accountInfo();
104
+ q.close();
105
+ ```
105
106
 
106
- // First run: generates and caches code
107
- for await (const msg of client.raysurferQuery("Fetch GitHub trending repos")) {
108
- console.log(msg);
109
- }
107
+ ## Snippet Retrieval Scope
110
108
 
111
- // Second run: retrieves from cache (instant)
112
- for await (const msg of client.raysurferQuery("Fetch GitHub trending repos")) {
113
- console.log(msg);
114
- }
115
- ```
109
+ Control which cached snippets are retrieved:
116
110
 
117
- ## Without Caching
111
+ ```typescript
112
+ import { ClaudeSDKClient } from "raysurfer";
118
113
 
119
- If `RAYSURFER_API_KEY` is not set, `RaysurferClient` behaves exactly like `ClaudeSDKClient` — no caching, just a pass-through wrapper.
114
+ // Include company-level snippets (Team/Enterprise)
115
+ const client = new ClaudeSDKClient({
116
+ snipsDesired: "company",
117
+ });
118
+
119
+ // Enterprise: client-specific snippets only
120
+ const enterpriseClient = new ClaudeSDKClient({
121
+ snipsDesired: "client",
122
+ });
123
+ ```
124
+
125
+ | Configuration | Required Tier |
126
+ |--------------|---------------|
127
+ | Default (public only) | FREE |
128
+ | `snipsDesired: "company"` | TEAM or ENTERPRISE |
129
+ | `snipsDesired: "client"` | ENTERPRISE only |
120
130
 
121
131
  ## Low-Level API
122
132
 
123
- For custom integrations, use the `RaySurfer` client directly with three core methods:
133
+ For custom integrations, use the `RaySurfer` client directly:
124
134
 
125
135
  ```typescript
126
136
  import { RaySurfer } from "raysurfer";
@@ -133,6 +143,12 @@ for (const match of snips.codeBlocks) {
133
143
  console.log(`${match.codeBlock.name}: ${match.score}`);
134
144
  }
135
145
 
146
+ // Or use the unified search endpoint
147
+ const searchResult = await client.search({ task: "Fetch GitHub trending repos" });
148
+ for (const match of searchResult.matches) {
149
+ console.log(`${match.codeBlock.name}: ${match.combinedScore}`);
150
+ }
151
+
136
152
  // 2. Upload new code snippets after execution
137
153
  await client.uploadNewCodeSnips(
138
154
  "Fetch GitHub trending repos",
@@ -150,14 +166,6 @@ await client.voteCodeSnip({
150
166
  });
151
167
  ```
152
168
 
153
- ### Method Reference
154
-
155
- | Method | Description |
156
- |--------|-------------|
157
- | `getCodeSnips({ task, topK?, minVerdictScore? })` | Retrieve cached code snippets by semantic search |
158
- | `uploadNewCodeSnips(task, filesWritten, succeeded)` | Store new code files for future reuse |
159
- | `voteCodeSnip({ task, codeBlockId, codeBlockName, codeBlockDescription, succeeded })` | Vote on snippet usefulness |
160
-
161
169
  ## License
162
170
 
163
171
  MIT
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * RaySurfer SDK client
3
3
  */
4
- export declare const VERSION = "0.4.3";
5
- import type { AgentReview, AgentVerdict, AutoReviewParams, AutoReviewResponse, ExecutionState, FewShotExample, FileWritten, GetCodeFilesResponse, GetExecutionsParams, RetrieveBestResponse, RetrieveCodeBlockResponse, RetrieveExecutionsResponse, SnipsDesired, StoreCodeBlockResponse, StoreExecutionResponse, SubmitExecutionResultResponse, TaskPattern } from "./types";
4
+ export declare const VERSION = "0.5.0";
5
+ import type { AgentReview, AgentVerdict, AutoReviewParams, AutoReviewResponse, ExecutionState, FewShotExample, FileWritten, GetCodeFilesResponse, GetExecutionsParams, RetrieveBestResponse, RetrieveCodeBlockResponse, RetrieveExecutionsResponse, SearchResponse, SnipsDesired, StoreCodeBlockResponse, StoreExecutionResponse, SubmitExecutionResultResponse, TaskPattern } from "./types";
6
6
  export interface RaySurferOptions {
7
7
  /** RaySurfer API key */
8
8
  apiKey?: string;
@@ -64,6 +64,13 @@ export interface GetTaskPatternsParams {
64
64
  minThumbsUp?: number;
65
65
  topK?: number;
66
66
  }
67
+ export interface SearchParams {
68
+ task: string;
69
+ topK?: number;
70
+ minVerdictScore?: number;
71
+ preferComplete?: boolean;
72
+ inputSchema?: Record<string, unknown>;
73
+ }
67
74
  /**
68
75
  * Async client for RaySurfer API
69
76
  */
@@ -98,6 +105,7 @@ export declare class RaySurfer {
98
105
  filename: string;
99
106
  description: string;
100
107
  }>, autoVote?: boolean, executionLogs?: string): Promise<SubmitExecutionResultResponse>;
108
+ search(params: SearchParams): Promise<SearchResponse>;
101
109
  /** Get cached code snippets for a task (semantic search) */
102
110
  getCodeSnips(params: RetrieveParams): Promise<RetrieveCodeBlockResponse>;
103
111
  /** Get the single best code block for a task using verdict-aware scoring */
@@ -106,17 +114,6 @@ export declare class RaySurfer {
106
114
  getFewShotExamples(task: string, k?: number): Promise<FewShotExample[]>;
107
115
  /** Retrieve proven task->code mappings */
108
116
  getTaskPatterns(params: GetTaskPatternsParams): Promise<TaskPattern[]>;
109
- /**
110
- * Get code files for a task, ready to download to sandbox.
111
- *
112
- * Returns code blocks with full source code, optimized for:
113
- * - High verdict scores (proven to work)
114
- * - More complete implementations (prefer longer source)
115
- * - Task relevance (semantic similarity)
116
- *
117
- * Also returns `addToLlmPrompt` - a pre-formatted string you can append
118
- * to your LLM system prompt to inform it about the cached files.
119
- */
120
117
  getCodeFiles(params: GetCodeFilesParams): Promise<GetCodeFilesResponse>;
121
118
  /**
122
119
  * Format a prompt string listing all retrieved code files.
@@ -150,6 +147,8 @@ export declare class RaySurfer {
150
147
  votePending: boolean;
151
148
  message: string;
152
149
  }>;
150
+ submitExecutionResult(task: string, filesWritten: FileWritten[], succeeded: boolean): Promise<SubmitExecutionResultResponse>;
151
+ retrieve(params: RetrieveParams): Promise<RetrieveCodeBlockResponse>;
153
152
  private parseCodeBlock;
154
153
  }
155
154
  export default RaySurfer;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEZ,gBAAgB,EAChB,kBAAkB,EAKlB,cAAc,EACd,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,WAAW,EACZ,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,gBAAgB;IAC/B,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC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QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IA0BlE,qBAAqB,CACzB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,WAAW,EAAE,EAC3B,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,6BAA6B,CAAC;IAKnC,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAS1E,OAAO,CAAC,cAAc;CAmBvB;AAGD,eAAe,SAAS,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,11 +11,13 @@
11
11
  *
12
12
  * Everything else works exactly the same. Set RAYSURFER_API_KEY to enable caching.
13
13
  */
14
- export type { GetCodeFilesParams, GetTaskPatternsParams, RaySurferOptions, RetrieveParams, StoreCodeBlockParams, StoreExecutionParams, } from "./client";
14
+ export type { GetCodeFilesParams, GetTaskPatternsParams, RaySurferOptions, RetrieveParams, SearchParams, StoreCodeBlockParams, StoreExecutionParams, } from "./client";
15
15
  export { default as RaySurferDefault, RaySurfer, VERSION } from "./client";
16
16
  export { APIError, AuthenticationError, CacheUnavailableError, RateLimitError, RaySurferError, ValidationError, } from "./errors";
17
- export type { QueryOptions, QueryParams, RaysurferAgentOptions, } from "./sdk-client";
17
+ export type { QueryOptions, QueryParams, RaysurferAgentOptions, RaysurferExtras, RaysurferQueryOptions, } from "./sdk-client";
18
18
  export { ClaudeSDKClient, default as queryDefault, query, RaysurferClient, } from "./sdk-client";
19
- export type { AgentReview, AlternativeCandidate, BestMatch, CodeBlock, CodeBlockMatch, CodeFile, ExecutionIO, ExecutionRecord, FewShotExample, FileWritten, GetCodeFilesResponse, RetrieveBestResponse, RetrieveCodeBlockResponse, RetrieveExecutionsResponse, StoreCodeBlockResponse, StoreExecutionResponse, SubmitExecutionResultRequest, SubmitExecutionResultResponse, TaskPattern, VoteCodeSnipParams, VoteCodeSnipResponse, } from "./types";
19
+ export type { AgentReview, AlternativeCandidate, BestMatch, CodeBlock, CodeBlockMatch, CodeFile, ExecutionIO, ExecutionRecord, FewShotExample, FileWritten, GetCodeFilesResponse, RetrieveBestResponse, RetrieveCodeBlockResponse, RetrieveExecutionsResponse, SearchMatch, SearchResponse, StoreCodeBlockResponse, StoreExecutionResponse, SubmitExecutionResultRequest, SubmitExecutionResultResponse, TaskPattern, VoteCodeSnipParams, VoteCodeSnipResponse, } from "./types";
20
20
  export { AgentVerdict, ExecutionState } from "./types";
21
+ export type { AccountInfo, AgentDefinition, AgentMcpServerSpec, AnyZodRawShape, ApiKeySource, AsyncHookJSONOutput, BaseHookInput, BaseOutputFormat, CanUseTool, ConfigScope, ExitReason, HookCallback, HookCallbackMatcher, HookEvent, HookInput, HookJSONOutput, InferShape, JsonSchemaOutputFormat, McpHttpServerConfig, McpSdkServerConfig, McpSdkServerConfigWithInstance, McpServerConfig, McpServerConfigForProcessTransport, McpServerStatus, McpSetServersResult, McpSSEServerConfig, McpStdioServerConfig, ModelInfo, ModelUsage, NonNullableUsage, NotificationHookInput, NotificationHookSpecificOutput, Options, OutputFormat, OutputFormatType, PermissionBehavior, PermissionMode, PermissionRequestHookInput, PermissionRequestHookSpecificOutput, PermissionResult, PermissionRuleValue, PermissionUpdate, PermissionUpdateDestination, PostToolUseFailureHookInput, PostToolUseFailureHookSpecificOutput, PostToolUseHookInput, PostToolUseHookSpecificOutput, PreCompactHookInput, PreToolUseHookInput, PreToolUseHookSpecificOutput, Query, RewindFilesResult, SandboxIgnoreViolations, SandboxNetworkConfig, SandboxSettings, SDKAssistantMessage, SDKAssistantMessageError, SDKAuthStatusMessage, SDKCompactBoundaryMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKHookStartedMessage, SDKMessage, SDKPartialAssistantMessage, SDKPermissionDenial, SDKResultError, SDKResultMessage, SDKResultSuccess, SDKStatus, SDKStatusMessage, SDKSystemMessage, SDKTaskNotificationMessage, SDKToolProgressMessage, SDKToolUseSummaryMessage, SDKUserMessage, SDKUserMessageReplay, SdkBeta, SdkMcpToolDefinition, SdkPluginConfig, SessionEndHookInput, SessionStartHookInput, SessionStartHookSpecificOutput, SettingSource, SetupHookInput, SetupHookSpecificOutput, SlashCommand, SpawnedProcess, SpawnOptions, StopHookInput, SubagentStartHookInput, SubagentStartHookSpecificOutput, SubagentStopHookInput, SyncHookJSONOutput, UserPromptSubmitHookInput, UserPromptSubmitHookSpecificOutput, } from "@anthropic-ai/claude-agent-sdk";
22
+ export { AbortError, createSdkMcpServer, EXIT_REASONS, HOOK_EVENTS, tool, } from "@anthropic-ai/claude-agent-sdk";
21
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE3E,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,OAAO,IAAI,YAAY,EACvB,KAAK,EACL,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,cAAc,EACd,QAAQ,EACR,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,WAAW,EACX,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE3E,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,OAAO,IAAI,YAAY,EACvB,KAAK,EACL,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,cAAc,EACd,QAAQ,EACR,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,WAAW,EACX,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAgBvD,YAAY,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,mB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,CAAC"}
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ class ValidationError extends RaySurferError {
69
69
  }
70
70
 
71
71
  // src/client.ts
72
- var VERSION = "0.4.3";
72
+ var VERSION = "0.5.0";
73
73
  var DEFAULT_BASE_URL = "https://api.raysurfer.com";
74
74
  var MAX_RETRIES = 3;
75
75
  var RETRY_BASE_DELAY = 500;
@@ -237,55 +237,83 @@ class RaySurfer {
237
237
  message: result.message
238
238
  };
239
239
  }
240
- async getCodeSnips(params) {
240
+ async search(params) {
241
241
  const data = {
242
242
  task: params.task,
243
- top_k: params.topK ?? 10,
244
- min_verdict_score: params.minVerdictScore ?? 0
243
+ top_k: params.topK ?? 5,
244
+ min_verdict_score: params.minVerdictScore ?? 0.3,
245
+ prefer_complete: params.preferComplete ?? false,
246
+ input_schema: params.inputSchema ?? null
245
247
  };
246
- const result = await this.request("POST", "/api/retrieve/code-blocks", data);
247
- const codeBlocks = result.code_blocks.map((cb) => ({
248
- codeBlock: this.parseCodeBlock(cb.code_block),
249
- score: cb.score,
250
- verdictScore: cb.verdict_score,
251
- thumbsUp: cb.thumbs_up,
252
- thumbsDown: cb.thumbs_down,
253
- recentExecutions: cb.recent_executions ?? []
254
- }));
248
+ const result = await this.request("POST", "/api/retrieve/search", data);
255
249
  return {
256
- codeBlocks,
257
- totalFound: result.total_found
250
+ matches: result.matches.map((m) => ({
251
+ codeBlock: this.parseCodeBlock(m.code_block),
252
+ combinedScore: m.combined_score,
253
+ vectorScore: m.vector_score,
254
+ verdictScore: m.verdict_score,
255
+ errorResilience: m.error_resilience,
256
+ thumbsUp: m.thumbs_up,
257
+ thumbsDown: m.thumbs_down,
258
+ filename: m.filename,
259
+ language: m.language,
260
+ entrypoint: m.entrypoint,
261
+ dependencies: m.dependencies ?? []
262
+ })),
263
+ totalFound: result.total_found,
264
+ cacheHit: result.cache_hit,
265
+ searchNamespaces: result.search_namespaces ?? []
258
266
  };
259
267
  }
260
- async retrieveBest(params) {
261
- const data = {
268
+ async getCodeSnips(params) {
269
+ const response = await this.search({
262
270
  task: params.task,
263
- top_k: params.topK ?? 10,
264
- min_verdict_score: params.minVerdictScore ?? 0
271
+ topK: params.topK ?? 10,
272
+ minVerdictScore: params.minVerdictScore ?? 0
273
+ });
274
+ return {
275
+ codeBlocks: response.matches.map((m) => ({
276
+ codeBlock: m.codeBlock,
277
+ score: m.combinedScore,
278
+ verdictScore: m.verdictScore,
279
+ thumbsUp: m.thumbsUp,
280
+ thumbsDown: m.thumbsDown,
281
+ recentExecutions: []
282
+ })),
283
+ totalFound: response.totalFound
265
284
  };
266
- const result = await this.request("POST", "/api/retrieve/best-for-task", data);
285
+ }
286
+ async retrieveBest(params) {
287
+ const response = await this.search({
288
+ task: params.task,
289
+ topK: params.topK ?? 10,
290
+ minVerdictScore: params.minVerdictScore ?? 0
291
+ });
267
292
  let bestMatch = null;
268
- if (result.best_match) {
293
+ let bestScore = 0;
294
+ const first = response.matches[0];
295
+ if (first) {
269
296
  bestMatch = {
270
- codeBlock: this.parseCodeBlock(result.best_match.code_block),
271
- combinedScore: result.best_match.combined_score,
272
- vectorScore: result.best_match.vector_score,
273
- verdictScore: result.best_match.verdict_score,
274
- errorResilience: result.best_match.error_resilience,
275
- thumbsUp: result.best_match.thumbs_up,
276
- thumbsDown: result.best_match.thumbs_down
297
+ codeBlock: first.codeBlock,
298
+ combinedScore: first.combinedScore,
299
+ vectorScore: first.vectorScore,
300
+ verdictScore: first.verdictScore,
301
+ errorResilience: first.errorResilience,
302
+ thumbsUp: first.thumbsUp,
303
+ thumbsDown: first.thumbsDown
277
304
  };
305
+ bestScore = first.combinedScore;
278
306
  }
279
- const alternativeCandidates = result.alternative_candidates.map((alt) => ({
280
- codeBlockId: alt.code_block_id,
281
- name: alt.name,
282
- combinedScore: alt.combined_score,
283
- reason: alt.reason
307
+ const alternativeCandidates = response.matches.slice(1, 4).map((m) => ({
308
+ codeBlockId: m.codeBlock.id,
309
+ name: m.codeBlock.name,
310
+ combinedScore: m.combinedScore,
311
+ reason: m.thumbsUp > 0 ? `${m.thumbsUp} thumbs up, ${m.thumbsDown} thumbs down` : "No execution history"
284
312
  }));
285
313
  return {
286
314
  bestMatch,
287
315
  alternativeCandidates,
288
- retrievalConfidence: result.retrieval_confidence
316
+ retrievalConfidence: bestMatch ? String(bestScore.toFixed(4)) : "0"
289
317
  };
290
318
  }
291
319
  async getFewShotExamples(task, k = 3) {
@@ -319,34 +347,33 @@ class RaySurfer {
319
347
  }));
320
348
  }
321
349
  async getCodeFiles(params) {
322
- const data = {
350
+ const response = await this.search({
323
351
  task: params.task,
324
- top_k: params.topK ?? 5,
325
- min_verdict_score: params.minVerdictScore ?? 0.3,
326
- prefer_complete: params.preferComplete ?? true
327
- };
328
- const result = await this.request("POST", "/api/retrieve/code-files", data);
329
- const files = result.files.map((f) => ({
330
- codeBlockId: f.code_block_id,
331
- filename: f.filename,
332
- source: f.source,
333
- entrypoint: f.entrypoint,
334
- description: f.description,
335
- inputSchema: f.input_schema,
336
- outputSchema: f.output_schema,
337
- language: f.language,
338
- dependencies: f.dependencies,
339
- verdictScore: f.verdict_score,
340
- thumbsUp: f.thumbs_up,
341
- thumbsDown: f.thumbs_down,
342
- similarityScore: f.similarity_score,
343
- combinedScore: f.combined_score
352
+ topK: params.topK ?? 5,
353
+ minVerdictScore: params.minVerdictScore ?? 0.3,
354
+ preferComplete: params.preferComplete ?? true
355
+ });
356
+ const files = response.matches.map((m) => ({
357
+ codeBlockId: m.codeBlock.id,
358
+ filename: m.filename,
359
+ source: m.codeBlock.source,
360
+ entrypoint: m.entrypoint,
361
+ description: m.codeBlock.description,
362
+ inputSchema: m.codeBlock.inputSchema,
363
+ outputSchema: m.codeBlock.outputSchema,
364
+ language: m.language,
365
+ dependencies: m.dependencies,
366
+ verdictScore: m.verdictScore,
367
+ thumbsUp: m.thumbsUp,
368
+ thumbsDown: m.thumbsDown,
369
+ similarityScore: m.vectorScore,
370
+ combinedScore: m.combinedScore
344
371
  }));
345
372
  const addToLlmPrompt = this.formatLlmPrompt(files, params.cacheDir ?? ".raysurfer_code");
346
373
  return {
347
374
  files,
348
- task: result.task,
349
- totalFound: result.total_found,
375
+ task: params.task,
376
+ totalFound: response.totalFound,
350
377
  addToLlmPrompt
351
378
  };
352
379
  }
@@ -481,6 +508,12 @@ class RaySurfer {
481
508
  message: result.message
482
509
  };
483
510
  }
511
+ async submitExecutionResult(task, filesWritten, succeeded) {
512
+ return this.uploadNewCodeSnips(task, filesWritten, succeeded);
513
+ }
514
+ async retrieve(params) {
515
+ return this.getCodeSnips(params);
516
+ }
484
517
  parseCodeBlock(data) {
485
518
  return {
486
519
  id: data.id,
@@ -552,31 +585,152 @@ var createDebugLogger = (enabled) => ({
552
585
  group: (label) => enabled && console.group(`[raysurfer] ${label}`),
553
586
  groupEnd: () => enabled && console.groupEnd()
554
587
  });
555
- async function* query(params) {
556
- const { prompt, options = {} } = params;
557
- const debugEnabled = options.debug || process.env.RAYSURFER_DEBUG === "true";
558
- const debug = createDebugLogger(debugEnabled);
559
- debug.group("Raysurfer Query Started");
560
- debug.log("Prompt:", prompt);
561
- debug.log("Options:", {
562
- ...options,
563
- systemPrompt: options.systemPrompt || undefined
564
- });
565
- const apiKey = process.env.RAYSURFER_API_KEY;
566
- const baseUrl = process.env.RAYSURFER_BASE_URL || DEFAULT_RAYSURFER_URL;
567
- const cacheEnabled = !!apiKey;
568
- if (!cacheEnabled) {
569
- console.warn("[raysurfer] RAYSURFER_API_KEY not set - caching disabled");
570
- }
571
- debug.log("Cache enabled:", cacheEnabled);
572
- debug.log("Base URL:", baseUrl);
573
- let raysurfer = null;
574
- let cachedFiles = [];
575
- const modifiedFilePaths = new Set;
576
- const bashGeneratedFiles = new Set;
577
- const executionLogs = [];
578
- let taskSucceeded = false;
579
- const extractBashOutputFiles = (command) => {
588
+ function augmentSystemPrompt(systemPrompt, addition) {
589
+ if (!addition)
590
+ return systemPrompt;
591
+ if (typeof systemPrompt === "string")
592
+ return systemPrompt + addition;
593
+ if (systemPrompt?.type === "preset") {
594
+ return { ...systemPrompt, append: (systemPrompt.append ?? "") + addition };
595
+ }
596
+ return addition;
597
+ }
598
+ function splitOptions(options) {
599
+ const { snipsDesired, namespace, debug, workingDirectory, ...sdkOptions } = options;
600
+ return {
601
+ sdkOptions,
602
+ extras: { snipsDesired, namespace, debug, workingDirectory }
603
+ };
604
+ }
605
+
606
+ class RaysurferQuery {
607
+ _inner = null;
608
+ _initPromise = null;
609
+ _raysurfer = null;
610
+ _cachedFiles = [];
611
+ _modifiedFilePaths = new Set;
612
+ _bashGeneratedFiles = new Set;
613
+ _executionLogs = [];
614
+ _taskSucceeded = false;
615
+ _generatedCodeBlocks = [];
616
+ _cacheUploadDone = false;
617
+ _messageCount = 0;
618
+ _startTime = 0;
619
+ _promptText;
620
+ _params;
621
+ _debug;
622
+ _cacheEnabled;
623
+ _workDir;
624
+ _apiKey;
625
+ _baseUrl;
626
+ _extras;
627
+ _sdkOptions;
628
+ constructor(params) {
629
+ this._params = params;
630
+ const options = params.options ?? {};
631
+ const { sdkOptions, extras } = splitOptions(options);
632
+ this._sdkOptions = sdkOptions;
633
+ this._extras = extras;
634
+ this._promptText = typeof params.prompt === "string" ? params.prompt : null;
635
+ const debugEnabled = extras.debug || process.env.RAYSURFER_DEBUG === "true";
636
+ this._debug = createDebugLogger(debugEnabled);
637
+ this._apiKey = process.env.RAYSURFER_API_KEY;
638
+ this._baseUrl = process.env.RAYSURFER_BASE_URL || DEFAULT_RAYSURFER_URL;
639
+ this._cacheEnabled = !!this._apiKey;
640
+ if (extras.workingDirectory && !sdkOptions.cwd) {
641
+ console.warn("[raysurfer] workingDirectory is deprecated, use cwd instead");
642
+ this._sdkOptions.cwd = extras.workingDirectory;
643
+ }
644
+ this._workDir = this._sdkOptions.cwd || process.cwd();
645
+ }
646
+ async _initialize() {
647
+ this._debug.group("Raysurfer Query Started");
648
+ this._debug.log("Prompt:", this._promptText ?? "<stream>");
649
+ this._debug.log("Cache enabled:", this._cacheEnabled);
650
+ this._debug.log("Base URL:", this._baseUrl);
651
+ if (!this._cacheEnabled) {
652
+ console.warn("[raysurfer] RAYSURFER_API_KEY not set - caching disabled");
653
+ }
654
+ let addToLlmPrompt = "";
655
+ if (this._cacheEnabled && this._promptText) {
656
+ this._raysurfer = new RaySurfer({
657
+ apiKey: this._apiKey,
658
+ baseUrl: this._baseUrl,
659
+ snipsDesired: this._extras.snipsDesired,
660
+ namespace: this._extras.namespace
661
+ });
662
+ try {
663
+ this._debug.time("Cache lookup");
664
+ const cacheDir = join(this._workDir, CACHE_DIR);
665
+ const response = await this._raysurfer.getCodeFiles({
666
+ task: this._promptText,
667
+ topK: 5,
668
+ minVerdictScore: 0.3,
669
+ preferComplete: true,
670
+ cacheDir
671
+ });
672
+ this._debug.timeEnd("Cache lookup");
673
+ this._cachedFiles = response.files;
674
+ addToLlmPrompt = response.addToLlmPrompt;
675
+ this._debug.log(`Found ${this._cachedFiles.length} cached files:`);
676
+ console.log("[raysurfer] Cache hit:", this._cachedFiles.length, "snippets retrieved");
677
+ if (this._cachedFiles.length > 0) {
678
+ this._debug.table(this._cachedFiles.map((f) => ({
679
+ filename: f.filename,
680
+ similarity: `${Math.round(f.similarityScore * 100)}%`,
681
+ verdict: `${Math.round(f.verdictScore * 100)}%`,
682
+ combined: `${Math.round(f.combinedScore * 100)}%`,
683
+ thumbs: `${f.thumbsUp}/${f.thumbsDown}`,
684
+ sourceLength: `${f.source.length} chars`
685
+ })));
686
+ try {
687
+ mkdirSync(cacheDir, { recursive: true });
688
+ for (const file of this._cachedFiles) {
689
+ const filePath = join(cacheDir, file.filename);
690
+ writeFileSync(filePath, file.source, "utf-8");
691
+ this._debug.log(` → Wrote cached file: ${filePath}`);
692
+ this._modifiedFilePaths.add(filePath);
693
+ }
694
+ } catch (writeErr) {
695
+ this._debug.log("Failed to write cached files:", writeErr);
696
+ }
697
+ }
698
+ } catch (error) {
699
+ this._debug.log("Cache lookup failed:", error);
700
+ console.warn("[raysurfer] Cache unavailable:", error instanceof Error ? error.message : error);
701
+ }
702
+ }
703
+ const augmented = augmentSystemPrompt(this._sdkOptions.systemPrompt, addToLlmPrompt);
704
+ const augmentedOptions = {
705
+ ...this._sdkOptions,
706
+ systemPrompt: augmented
707
+ };
708
+ this._debug.log("Augmented prompt addition:", addToLlmPrompt.length, "chars");
709
+ let sdkQueryFn;
710
+ try {
711
+ const sdk = await import("@anthropic-ai/claude-agent-sdk");
712
+ sdkQueryFn = sdk.query;
713
+ } catch {
714
+ throw new Error("Could not import @anthropic-ai/claude-agent-sdk. Install it with: npm install @anthropic-ai/claude-agent-sdk");
715
+ }
716
+ this._debug.time("Claude API call");
717
+ this._debug.log("Calling Claude Agent SDK...");
718
+ this._startTime = Date.now();
719
+ this._inner = sdkQueryFn({
720
+ prompt: this._params.prompt,
721
+ options: augmentedOptions
722
+ });
723
+ }
724
+ async _ensureInit() {
725
+ if (!this._inner) {
726
+ if (!this._initPromise) {
727
+ this._initPromise = this._initialize();
728
+ }
729
+ await this._initPromise;
730
+ }
731
+ return this._inner;
732
+ }
733
+ _extractBashOutputFiles(command) {
580
734
  for (const pattern of BASH_OUTPUT_PATTERNS) {
581
735
  pattern.lastIndex = 0;
582
736
  let match = pattern.exec(command);
@@ -585,103 +739,23 @@ async function* query(params) {
585
739
  if (filePath && filePath.length > 0) {
586
740
  const ext = filePath.substring(filePath.lastIndexOf(".")).toLowerCase();
587
741
  if (TRACKABLE_EXTENSIONS.has(ext)) {
588
- bashGeneratedFiles.add(filePath);
589
- debug.log(` → Bash output file detected: ${filePath}`);
742
+ this._bashGeneratedFiles.add(filePath);
743
+ this._debug.log(` → Bash output file detected: ${filePath}`);
590
744
  }
591
745
  }
592
746
  match = pattern.exec(command);
593
747
  }
594
748
  }
595
- };
596
- const workDir = options.workingDirectory || process.cwd();
597
- let addToLlmPrompt = "";
598
- if (cacheEnabled) {
599
- raysurfer = new RaySurfer({
600
- apiKey,
601
- baseUrl,
602
- snipsDesired: options.snipsDesired,
603
- namespace: options.namespace
604
- });
605
- try {
606
- debug.time("Cache lookup");
607
- const cacheDir = join(workDir, CACHE_DIR);
608
- const response2 = await raysurfer.getCodeFiles({
609
- task: prompt,
610
- topK: 5,
611
- minVerdictScore: 0.3,
612
- preferComplete: true,
613
- cacheDir
614
- });
615
- debug.timeEnd("Cache lookup");
616
- cachedFiles = response2.files;
617
- addToLlmPrompt = response2.addToLlmPrompt;
618
- debug.log(`Found ${cachedFiles.length} cached files:`);
619
- console.log("[raysurfer] Cache hit:", cachedFiles.length, "snippets retrieved");
620
- if (cachedFiles.length > 0) {
621
- debug.table(cachedFiles.map((f) => ({
622
- filename: f.filename,
623
- similarity: `${Math.round(f.similarityScore * 100)}%`,
624
- verdict: `${Math.round(f.verdictScore * 100)}%`,
625
- combined: `${Math.round(f.combinedScore * 100)}%`,
626
- thumbs: `${f.thumbsUp}/${f.thumbsDown}`,
627
- sourceLength: `${f.source.length} chars`
628
- })));
629
- try {
630
- mkdirSync(cacheDir, { recursive: true });
631
- for (const file of cachedFiles) {
632
- const filePath = join(cacheDir, file.filename);
633
- writeFileSync(filePath, file.source, "utf-8");
634
- debug.log(` → Wrote cached file: ${filePath}`);
635
- modifiedFilePaths.add(filePath);
636
- }
637
- } catch (writeErr) {
638
- debug.log("Failed to write cached files:", writeErr);
639
- }
640
- }
641
- } catch (error) {
642
- debug.log("Cache lookup failed:", error);
643
- console.warn("[raysurfer] Cache unavailable:", error instanceof Error ? error.message : error);
644
- }
645
749
  }
646
- const augmentedPrompt = (options.systemPrompt ?? "") + addToLlmPrompt;
647
- debug.log("System prompt length:", options.systemPrompt?.length ?? 0, "chars");
648
- debug.log("Augmented prompt length:", augmentedPrompt.length, "chars");
649
- debug.log("Added from cache:", addToLlmPrompt.length, "chars");
650
- if (addToLlmPrompt) {
651
- debug.log(`
652
- --- AUGMENTED PROMPT ADDITION ---`);
653
- debug.log(addToLlmPrompt);
654
- debug.log(`--- END AUGMENTED PROMPT ---
655
- `);
656
- }
657
- let sdkQuery;
658
- try {
659
- const sdk = await import("@anthropic-ai/claude-agent-sdk");
660
- sdkQuery = sdk.query;
661
- } catch {
662
- throw new Error("Could not import @anthropic-ai/claude-agent-sdk. Install it with: npm install @anthropic-ai/claude-agent-sdk");
663
- }
664
- debug.time("Claude API call");
665
- debug.log("Calling Claude Agent SDK...");
666
- const response = sdkQuery({
667
- prompt,
668
- options: {
669
- ...options,
670
- systemPrompt: augmentedPrompt
671
- }
672
- });
673
- let messageCount = 0;
674
- const startTime = Date.now();
675
- const generatedCodeBlocks = [];
676
- for await (const message of response) {
677
- messageCount++;
750
+ _trackMessage(message) {
751
+ this._messageCount++;
678
752
  const msg = message;
679
- const elapsed = Date.now() - startTime;
680
- debug.log(`
753
+ const elapsed = Date.now() - this._startTime;
754
+ this._debug.log(`
681
755
  ═══════════════════════════════════════════════════`);
682
- debug.log(`Message #${messageCount} [${elapsed}ms] type=${msg.type} subtype=${msg.subtype || "none"}`);
683
- debug.log(`═══════════════════════════════════════════════════`);
684
- debug.log(JSON.stringify(msg, null, 2));
756
+ this._debug.log(`Message #${this._messageCount} [${elapsed}ms] type=${msg.type} subtype=${msg.subtype || "none"}`);
757
+ this._debug.log(`═══════════════════════════════════════════════════`);
758
+ this._debug.log(JSON.stringify(msg, null, 2));
685
759
  if (msg.type === "assistant") {
686
760
  const content = msg.message;
687
761
  const contentBlocks = content?.content;
@@ -691,21 +765,21 @@ async function* query(params) {
691
765
  const input = block.input;
692
766
  const filePath = input?.file_path ?? input?.notebook_path;
693
767
  if (filePath) {
694
- debug.log(` → ${block.name} tool detected:`, filePath);
695
- modifiedFilePaths.add(filePath);
768
+ this._debug.log(` → ${block.name} tool detected:`, filePath);
769
+ this._modifiedFilePaths.add(filePath);
696
770
  }
697
771
  }
698
772
  if (block.type === "tool_use" && block.name === "Bash") {
699
773
  const input = block.input;
700
774
  const command = input?.command;
701
775
  if (command) {
702
- extractBashOutputFiles(command);
776
+ this._extractBashOutputFiles(command);
703
777
  }
704
778
  }
705
779
  if (block.type === "tool_result") {
706
- const content2 = block.content;
707
- if (content2) {
708
- executionLogs.push(content2.slice(0, 5000));
780
+ const resultContent = block.content;
781
+ if (resultContent) {
782
+ this._executionLogs.push(resultContent.slice(0, 5000));
709
783
  }
710
784
  }
711
785
  if (block.type === "text") {
@@ -715,8 +789,8 @@ async function* query(params) {
715
789
  for (const match of codeMatches) {
716
790
  const code = match.replace(/```(?:typescript|javascript|ts|js)?\n?/, "").replace(/\n?```$/, "");
717
791
  if (code.trim().length > 50) {
718
- generatedCodeBlocks.push(code.trim());
719
- debug.log(` → Extracted code block (${code.length} chars)`);
792
+ this._generatedCodeBlocks.push(code.trim());
793
+ this._debug.log(` → Extracted code block (${code.length} chars)`);
720
794
  }
721
795
  }
722
796
  }
@@ -725,93 +799,165 @@ async function* query(params) {
725
799
  }
726
800
  }
727
801
  if (msg.type === "result" && msg.subtype === "success") {
728
- taskSucceeded = true;
729
- debug.timeEnd("Claude API call");
730
- debug.log("Task succeeded!");
802
+ this._taskSucceeded = true;
803
+ this._debug.timeEnd("Claude API call");
804
+ this._debug.log("Task succeeded!");
731
805
  const result = msg;
732
- debug.log(" Duration:", result.duration_ms, "ms");
733
- debug.log(" Total cost:", result.total_cost_usd, "USD");
734
- debug.log(" Turns:", result.num_turns);
806
+ this._debug.log(" Duration:", result.duration_ms, "ms");
807
+ this._debug.log(" Total cost:", result.total_cost_usd, "USD");
808
+ this._debug.log(" Turns:", result.num_turns);
735
809
  }
736
810
  if (msg.type === "result" && msg.subtype !== "success") {
737
- debug.timeEnd("Claude API call");
738
- debug.log("Task failed:", msg.subtype);
739
- }
740
- yield message;
741
- }
742
- debug.log("Total messages streamed:", messageCount);
743
- debug.log("Modified files tracked:", modifiedFilePaths.size);
744
- debug.log("Code blocks extracted:", generatedCodeBlocks.length);
745
- const filesToCache = [];
746
- for (const filePath of modifiedFilePaths) {
747
- if (filePath.includes(CACHE_DIR)) {
748
- debug.log(" → Skipping cached file:", filePath);
749
- continue;
750
- }
751
- try {
752
- if (existsSync(filePath)) {
753
- const content = readFileSync(filePath, "utf-8");
754
- if (content.includes("\x00")) {
755
- debug.log(" → Skipping binary file:", filePath);
756
- continue;
757
- }
758
- filesToCache.push({ path: filePath, content });
759
- debug.log(" → Will cache file:", filePath, `(${content.length} chars)`);
760
- } else {
761
- debug.log(" → File not found:", filePath);
762
- }
763
- } catch (err) {
764
- debug.log(" → Failed to read file:", filePath, err);
811
+ this._debug.timeEnd("Claude API call");
812
+ this._debug.log("Task failed:", msg.subtype);
765
813
  }
766
814
  }
767
- for (const filePath of bashGeneratedFiles) {
768
- if (modifiedFilePaths.has(filePath))
769
- continue;
770
- try {
771
- if (existsSync(filePath)) {
772
- const content = readFileSync(filePath, "utf-8");
773
- if (!content.includes("\x00")) {
815
+ async _uploadCache() {
816
+ if (this._cacheUploadDone)
817
+ return;
818
+ this._cacheUploadDone = true;
819
+ this._debug.log("Total messages streamed:", this._messageCount);
820
+ this._debug.log("Modified files tracked:", this._modifiedFilePaths.size);
821
+ this._debug.log("Code blocks extracted:", this._generatedCodeBlocks.length);
822
+ const filesToCache = [];
823
+ for (const filePath of this._modifiedFilePaths) {
824
+ if (filePath.includes(CACHE_DIR)) {
825
+ this._debug.log(" → Skipping cached file:", filePath);
826
+ continue;
827
+ }
828
+ try {
829
+ if (existsSync(filePath)) {
830
+ const content = readFileSync(filePath, "utf-8");
831
+ if (content.includes("\x00")) {
832
+ this._debug.log(" → Skipping binary file:", filePath);
833
+ continue;
834
+ }
774
835
  filesToCache.push({ path: filePath, content });
775
- debug.log(" → Will cache Bash-generated file:", filePath, `(${content.length} chars)`);
836
+ this._debug.log(" → Will cache file:", filePath, `(${content.length} chars)`);
837
+ } else {
838
+ this._debug.log(" → File not found:", filePath);
776
839
  }
840
+ } catch (err) {
841
+ this._debug.log(" → Failed to read file:", filePath, err);
777
842
  }
778
- } catch {
779
- debug.log(" → Failed to read Bash-generated file:", filePath);
780
843
  }
781
- }
782
- if (generatedCodeBlocks.length > 0) {
783
- const largestBlock = generatedCodeBlocks.reduce((a, b) => a.length > b.length ? a : b);
784
- filesToCache.push({
785
- path: "generated-code.ts",
786
- content: largestBlock
787
- });
788
- debug.log(" → Will cache generated code block:", `(${largestBlock.length} chars)`);
789
- }
790
- debug.log("Total items to cache:", filesToCache.length);
791
- if (cacheEnabled && raysurfer && taskSucceeded) {
792
- const cachedBlocksForVoting = cachedFiles.map((f) => ({
793
- codeBlockId: f.codeBlockId,
794
- filename: f.filename,
795
- description: f.description
796
- }));
797
- if (filesToCache.length > 0 || cachedBlocksForVoting.length > 0) {
844
+ for (const filePath of this._bashGeneratedFiles) {
845
+ if (this._modifiedFilePaths.has(filePath))
846
+ continue;
798
847
  try {
799
- debug.time("Cache upload + voting");
800
- const joinedLogs = executionLogs.length > 0 ? executionLogs.join(`
848
+ if (existsSync(filePath)) {
849
+ const content = readFileSync(filePath, "utf-8");
850
+ if (!content.includes("\x00")) {
851
+ filesToCache.push({ path: filePath, content });
852
+ this._debug.log(" → Will cache Bash-generated file:", filePath, `(${content.length} chars)`);
853
+ }
854
+ }
855
+ } catch {
856
+ this._debug.log(" → Failed to read Bash-generated file:", filePath);
857
+ }
858
+ }
859
+ if (this._generatedCodeBlocks.length > 0) {
860
+ const largestBlock = this._generatedCodeBlocks.reduce((a, b) => a.length > b.length ? a : b);
861
+ filesToCache.push({
862
+ path: "generated-code.ts",
863
+ content: largestBlock
864
+ });
865
+ this._debug.log(" → Will cache generated code block:", `(${largestBlock.length} chars)`);
866
+ }
867
+ this._debug.log("Total items to cache:", filesToCache.length);
868
+ if (this._cacheEnabled && this._raysurfer && this._taskSucceeded && this._promptText) {
869
+ const cachedBlocksForVoting = this._cachedFiles.map((f) => ({
870
+ codeBlockId: f.codeBlockId,
871
+ filename: f.filename,
872
+ description: f.description
873
+ }));
874
+ if (filesToCache.length > 0 || cachedBlocksForVoting.length > 0) {
875
+ try {
876
+ this._debug.time("Cache upload + voting");
877
+ const joinedLogs = this._executionLogs.length > 0 ? this._executionLogs.join(`
801
878
  ---
802
879
  `) : undefined;
803
- debug.log("Uploading", filesToCache.length, "files, voting for", cachedBlocksForVoting.length, "cached blocks,", executionLogs.length, "log entries...");
804
- await raysurfer.uploadNewCodeSnips(prompt, filesToCache, true, cachedBlocksForVoting.length > 0 ? cachedBlocksForVoting : undefined, true, joinedLogs);
805
- debug.timeEnd("Cache upload + voting");
806
- debug.log("Cache upload successful, voting queued on backend");
807
- console.log("[raysurfer] Cache upload successful:", filesToCache.length, "files stored");
808
- } catch (error) {
809
- debug.log("Cache upload failed:", error);
810
- console.warn("[raysurfer] Cache upload failed:", error instanceof Error ? error.message : error);
880
+ this._debug.log("Uploading", filesToCache.length, "files, voting for", cachedBlocksForVoting.length, "cached blocks,", this._executionLogs.length, "log entries...");
881
+ await this._raysurfer.uploadNewCodeSnips(this._promptText, filesToCache, true, cachedBlocksForVoting.length > 0 ? cachedBlocksForVoting : undefined, true, joinedLogs);
882
+ this._debug.timeEnd("Cache upload + voting");
883
+ this._debug.log("Cache upload successful, voting queued on backend");
884
+ console.log("[raysurfer] Cache upload successful:", filesToCache.length, "files stored");
885
+ } catch (error) {
886
+ this._debug.log("Cache upload failed:", error);
887
+ console.warn("[raysurfer] Cache upload failed:", error instanceof Error ? error.message : error);
888
+ }
811
889
  }
812
890
  }
891
+ this._debug.groupEnd();
892
+ }
893
+ async next(...args) {
894
+ const inner = await this._ensureInit();
895
+ const result = await inner.next(...args);
896
+ if (!result.done) {
897
+ this._trackMessage(result.value);
898
+ } else {
899
+ await this._uploadCache();
900
+ }
901
+ return result;
902
+ }
903
+ async return(value) {
904
+ if (this._inner) {
905
+ await this._uploadCache();
906
+ return this._inner.return(value);
907
+ }
908
+ return { done: true, value: undefined };
909
+ }
910
+ async throw(e) {
911
+ if (this._inner)
912
+ return this._inner.throw(e);
913
+ throw e;
914
+ }
915
+ [Symbol.asyncIterator]() {
916
+ return this;
917
+ }
918
+ async[Symbol.asyncDispose]() {
919
+ this.close();
920
+ }
921
+ async interrupt() {
922
+ return (await this._ensureInit()).interrupt();
813
923
  }
814
- debug.groupEnd();
924
+ async setPermissionMode(mode) {
925
+ return (await this._ensureInit()).setPermissionMode(mode);
926
+ }
927
+ async setModel(model) {
928
+ return (await this._ensureInit()).setModel(model);
929
+ }
930
+ async setMaxThinkingTokens(maxThinkingTokens) {
931
+ return (await this._ensureInit()).setMaxThinkingTokens(maxThinkingTokens);
932
+ }
933
+ async supportedCommands() {
934
+ return (await this._ensureInit()).supportedCommands();
935
+ }
936
+ async supportedModels() {
937
+ return (await this._ensureInit()).supportedModels();
938
+ }
939
+ async mcpServerStatus() {
940
+ return (await this._ensureInit()).mcpServerStatus();
941
+ }
942
+ async accountInfo() {
943
+ return (await this._ensureInit()).accountInfo();
944
+ }
945
+ async rewindFiles(userMessageId, options) {
946
+ return (await this._ensureInit()).rewindFiles(userMessageId, options);
947
+ }
948
+ async setMcpServers(servers) {
949
+ return (await this._ensureInit()).setMcpServers(servers);
950
+ }
951
+ async streamInput(stream) {
952
+ return (await this._ensureInit()).streamInput(stream);
953
+ }
954
+ close() {
955
+ if (this._inner)
956
+ this._inner.close();
957
+ }
958
+ }
959
+ function query(params) {
960
+ return new RaysurferQuery(params);
815
961
  }
816
962
 
817
963
  class ClaudeSDKClient {
@@ -819,8 +965,8 @@ class ClaudeSDKClient {
819
965
  constructor(options = {}) {
820
966
  this.options = options;
821
967
  }
822
- async* query(prompt) {
823
- yield* query({ prompt, options: this.options });
968
+ query(prompt) {
969
+ return query({ prompt, options: this.options });
824
970
  }
825
971
  }
826
972
  var sdk_client_default = query;
@@ -838,9 +984,20 @@ var AgentVerdict;
838
984
  AgentVerdict2["THUMBS_DOWN"] = "thumbs_down";
839
985
  AgentVerdict2["PENDING"] = "pending";
840
986
  })(AgentVerdict ||= {});
987
+
988
+ // src/index.ts
989
+ import {
990
+ AbortError,
991
+ createSdkMcpServer,
992
+ EXIT_REASONS,
993
+ HOOK_EVENTS,
994
+ tool
995
+ } from "@anthropic-ai/claude-agent-sdk";
841
996
  export {
997
+ tool,
842
998
  sdk_client_default as queryDefault,
843
999
  query,
1000
+ createSdkMcpServer,
844
1001
  ValidationError,
845
1002
  VERSION,
846
1003
  ClaudeSDKClient as RaysurferClient,
@@ -848,10 +1005,13 @@ export {
848
1005
  client_default as RaySurferDefault,
849
1006
  RaySurfer,
850
1007
  RateLimitError,
1008
+ HOOK_EVENTS,
851
1009
  ExecutionState,
1010
+ EXIT_REASONS,
852
1011
  ClaudeSDKClient,
853
1012
  CacheUnavailableError,
854
1013
  AuthenticationError,
855
1014
  AgentVerdict,
1015
+ AbortError,
856
1016
  APIError
857
1017
  };
@@ -11,33 +11,29 @@
11
11
  *
12
12
  * Everything else works exactly the same. Set RAYSURFER_API_KEY to enable caching.
13
13
  */
14
+ import type { Options, Query, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
14
15
  import type { SnipsDesired } from "./types";
15
- /** Options for the query function - matches Claude Agent SDK */
16
- export interface QueryOptions {
17
- model?: string;
18
- workingDirectory?: string;
19
- systemPrompt?: string;
20
- permissionMode?: "default" | "acceptEdits" | "plan" | "bypassPermissions";
21
- maxBudgetUsd?: number;
22
- allowedTools?: string[];
23
- disallowedTools?: string[];
24
- maxTurns?: number;
25
- env?: Record<string, string>;
16
+ /** Raysurfer-specific options beyond Claude SDK Options */
17
+ export interface RaysurferExtras {
26
18
  /** Scope of private snippets - "company" (Team/Enterprise) or "client" (Enterprise only) */
27
19
  snipsDesired?: SnipsDesired;
28
20
  /** Custom namespace for code storage/retrieval */
29
21
  namespace?: string;
30
22
  /** Enable debug logging - also enabled via RAYSURFER_DEBUG=true env var */
31
23
  debug?: boolean;
32
- /** Path to Claude Code executable (required for SDK) */
33
- pathToClaudeCodeExecutable?: string;
34
- /** Allow dangerous permissions bypass */
35
- allowDangerouslySkipPermissions?: boolean;
24
+ /** @deprecated Use `cwd` instead */
25
+ workingDirectory?: string;
36
26
  }
27
+ /** Full query options: Claude SDK Options extended with Raysurfer extras */
28
+ export type RaysurferQueryOptions = Options & RaysurferExtras;
29
+ /**
30
+ * @deprecated Use RaysurferQueryOptions instead
31
+ */
32
+ export type QueryOptions = RaysurferQueryOptions;
37
33
  /** Query parameters - matches Claude Agent SDK */
38
34
  export interface QueryParams {
39
- prompt: string;
40
- options?: QueryOptions;
35
+ prompt: string | AsyncIterable<SDKUserMessage>;
36
+ options?: RaysurferQueryOptions;
41
37
  }
42
38
  /**
43
39
  * Drop-in replacement for Claude Agent SDK's query function with automatic caching.
@@ -52,7 +48,7 @@ export interface QueryParams {
52
48
  *
53
49
  * Set RAYSURFER_API_KEY environment variable to enable caching.
54
50
  */
55
- export declare function query(params: QueryParams): AsyncGenerator<unknown>;
51
+ export declare function query(params: QueryParams): Query;
56
52
  /**
57
53
  * ClaudeSDKClient - Class-based drop-in replacement.
58
54
  *
@@ -65,10 +61,10 @@ export declare function query(params: QueryParams): AsyncGenerator<unknown>;
65
61
  */
66
62
  export declare class ClaudeSDKClient {
67
63
  private options;
68
- constructor(options?: QueryOptions);
69
- query(prompt: string): AsyncGenerator<unknown>;
64
+ constructor(options?: RaysurferQueryOptions);
65
+ query(prompt: string | AsyncIterable<SDKUserMessage>): Query;
70
66
  }
71
67
  export { ClaudeSDKClient as RaysurferClient };
72
- export type { QueryOptions as RaysurferAgentOptions };
68
+ export type { RaysurferQueryOptions as RaysurferAgentOptions };
73
69
  export default query;
74
70
  //# sourceMappingURL=sdk-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../src/sdk-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,SAAS,CAAC;AA2DnE,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,SAAS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C;AAExC,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,SAAS,CAAC;AA2DnE,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oCAAoC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,4EAA4E;AAC5E,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,eAAe,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAEjD,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAmjBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAEhD;AAED;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAwB;gBAE3B,OAAO,GAAE,qBAA0B;IAI/C,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,CAAC,GAAG,KAAK;CAG7D;AAGD,OAAO,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC;AAC9C,YAAY,EAAE,qBAAqB,IAAI,qBAAqB,EAAE,CAAC;AAE/D,eAAe,KAAK,CAAC"}
package/dist/types.d.ts CHANGED
@@ -181,6 +181,27 @@ export interface GetCodeFilesResponse {
181
181
  /** Pre-formatted string to append to LLM system prompt with all file paths */
182
182
  addToLlmPrompt: string;
183
183
  }
184
+ /** A search match with full scoring from unified search */
185
+ export interface SearchMatch {
186
+ codeBlock: CodeBlock;
187
+ combinedScore: number;
188
+ vectorScore: number;
189
+ verdictScore: number;
190
+ errorResilience: number;
191
+ thumbsUp: number;
192
+ thumbsDown: number;
193
+ filename: string;
194
+ language: string;
195
+ entrypoint: string;
196
+ dependencies: string[];
197
+ }
198
+ /** Response from unified search endpoint */
199
+ export interface SearchResponse {
200
+ matches: SearchMatch[];
201
+ totalFound: number;
202
+ cacheHit: boolean;
203
+ searchNamespaces: string[];
204
+ }
184
205
  /** Request to vote on a code snippet */
185
206
  export interface VoteCodeSnipParams {
186
207
  task: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,2DAA2D;AAC3D,oBAAY,cAAc;IACxB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,0DAA0D;AAC1D,oBAAY,YAAY;IACtB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;CACpB;AAED,8CAA8C;AAC9C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhD,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,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@@
1
1
  {
2
2
  "name": "raysurfer",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "description": "Drop-in replacement for Claude Agent SDK with automatic code caching - just swap your import",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",