raysurfer 0.2.0 → 0.3.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 +27 -0
- package/dist/client.d.ts +16 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/index.d.ts +12 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -163
- package/dist/sdk-client.d.ts +47 -60
- package/dist/sdk-client.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -8
package/README.md
CHANGED
|
@@ -90,6 +90,33 @@ interface RaysurferAgentOptions {
|
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
## Snippet Retrieval Scope
|
|
94
|
+
|
|
95
|
+
Control which snippets are retrieved using `publicSnips` and `snipsDesired`:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { RaySurfer } from "raysurfer";
|
|
99
|
+
|
|
100
|
+
// Include both public and company snippets
|
|
101
|
+
const client = new RaySurfer({
|
|
102
|
+
apiKey: "rs_...",
|
|
103
|
+
publicSnips: true, // Include public/shared snippets
|
|
104
|
+
snipsDesired: "company", // Also include company-level snippets (Team/Enterprise)
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Enterprise: Retrieve client-specific snippets only
|
|
108
|
+
const enterpriseClient = new RaySurfer({
|
|
109
|
+
apiKey: "rs_...",
|
|
110
|
+
snipsDesired: "client", // Client workspace snippets (Enterprise only)
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Configuration | Required Tier |
|
|
115
|
+
|--------------|---------------|
|
|
116
|
+
| `publicSnips: true` only | FREE (default) |
|
|
117
|
+
| `snipsDesired: "company"` | TEAM or ENTERPRISE |
|
|
118
|
+
| `snipsDesired: "client"` | ENTERPRISE only |
|
|
119
|
+
|
|
93
120
|
## API Reference
|
|
94
121
|
|
|
95
122
|
### RaySurfer Client
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RaySurfer SDK client
|
|
3
3
|
*/
|
|
4
|
-
import type { AgentReview, AgentVerdict, ExecutionState, FewShotExample, FileWritten, GetCodeFilesResponse, RetrieveBestResponse, RetrieveCodeBlockResponse, StoreCodeBlockResponse, StoreExecutionResponse, SubmitExecutionResultResponse, TaskPattern } from "./types";
|
|
4
|
+
import type { AgentReview, AgentVerdict, ExecutionState, FewShotExample, FileWritten, GetCodeFilesResponse, RetrieveBestResponse, RetrieveCodeBlockResponse, SnipsDesired, StoreCodeBlockResponse, StoreExecutionResponse, SubmitExecutionResultResponse, TaskPattern } from "./types";
|
|
5
5
|
export interface RaySurferOptions {
|
|
6
|
+
/** RaySurfer API key */
|
|
6
7
|
apiKey?: string;
|
|
8
|
+
/** API base URL */
|
|
7
9
|
baseUrl?: string;
|
|
10
|
+
/** Request timeout in milliseconds */
|
|
8
11
|
timeout?: number;
|
|
12
|
+
/** Organization ID for dedicated namespace (team/enterprise tier) */
|
|
13
|
+
organizationId?: string;
|
|
14
|
+
/** Workspace ID for client-specific namespace (enterprise tier only) */
|
|
15
|
+
workspaceId?: string;
|
|
16
|
+
/** Whether to include public/shared snippets in retrieval (default: false) */
|
|
17
|
+
publicSnips?: boolean;
|
|
18
|
+
/** Scope of private snippets - "company" (Team/Enterprise) or "client" (Enterprise only) */
|
|
19
|
+
snipsDesired?: SnipsDesired;
|
|
9
20
|
}
|
|
10
21
|
export interface StoreCodeBlockParams {
|
|
11
22
|
name: string;
|
|
@@ -57,6 +68,10 @@ export declare class RaySurfer {
|
|
|
57
68
|
private apiKey?;
|
|
58
69
|
private baseUrl;
|
|
59
70
|
private timeout;
|
|
71
|
+
private organizationId?;
|
|
72
|
+
private workspaceId?;
|
|
73
|
+
private publicSnips;
|
|
74
|
+
private snipsDesired?;
|
|
60
75
|
constructor(options?: RaySurferOptions);
|
|
61
76
|
private request;
|
|
62
77
|
/** Store a new code block */
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAOZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAOZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,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,8EAA8E;IAC9E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,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GD,eAAe,SAAS,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RaySurfer TypeScript SDK
|
|
2
|
+
* RaySurfer TypeScript SDK - Drop-in replacement for Claude Agent SDK with caching.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* and verdict-aware scoring.
|
|
4
|
+
* Simply swap your import:
|
|
6
5
|
*
|
|
7
|
-
*
|
|
6
|
+
* // Before
|
|
7
|
+
* import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
8
|
+
*
|
|
9
|
+
* // After
|
|
10
|
+
* import { query } from "raysurfer";
|
|
11
|
+
*
|
|
12
|
+
* Everything else works exactly the same. Set RAYSURFER_API_KEY to enable caching.
|
|
8
13
|
*/
|
|
14
|
+
export { query, ClaudeSDKClient, RaysurferClient, default as queryDefault, } from "./sdk-client";
|
|
15
|
+
export type { QueryOptions, QueryParams, RaysurferAgentOptions, } from "./sdk-client";
|
|
9
16
|
export { RaySurfer, default as RaySurferDefault } from "./client";
|
|
10
17
|
export type { RaySurferOptions, StoreCodeBlockParams, StoreExecutionParams, RetrieveParams, GetCodeFilesParams, GetTaskPatternsParams, } from "./client";
|
|
11
|
-
export { RaysurferClient } from "./sdk-client";
|
|
12
|
-
export type { RaysurferAgentOptions } from "./sdk-client";
|
|
13
18
|
export { ExecutionState, AgentVerdict } from "./types";
|
|
14
19
|
export type { CodeBlock, ExecutionIO, AgentReview, ExecutionRecord, BestMatch, AlternativeCandidate, FewShotExample, TaskPattern, FileWritten, StoreCodeBlockResponse, StoreExecutionResponse, CodeBlockMatch, RetrieveCodeBlockResponse, RetrieveBestResponse, SubmitExecutionResultRequest, SubmitExecutionResultResponse, CodeFile, GetCodeFilesResponse, } from "./types";
|
|
15
20
|
export { RaySurferError, APIError, AuthenticationError } from "./errors";
|
|
16
|
-
export declare const VERSION = "0.
|
|
21
|
+
export declare const VERSION = "0.3.1";
|
|
17
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,KAAK,EACL,eAAe,EACf,eAAe,EACf,OAAO,IAAI,YAAY,GACxB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,SAAS,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAClE,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvD,YAAY,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,eAAe,EACf,SAAS,EACT,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20999,10 +20999,18 @@ class RaySurfer {
|
|
|
20999
20999
|
apiKey;
|
|
21000
21000
|
baseUrl;
|
|
21001
21001
|
timeout;
|
|
21002
|
+
organizationId;
|
|
21003
|
+
workspaceId;
|
|
21004
|
+
publicSnips;
|
|
21005
|
+
snipsDesired;
|
|
21002
21006
|
constructor(options = {}) {
|
|
21003
21007
|
this.apiKey = options.apiKey;
|
|
21004
21008
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
21005
21009
|
this.timeout = options.timeout ?? 30000;
|
|
21010
|
+
this.organizationId = options.organizationId;
|
|
21011
|
+
this.workspaceId = options.workspaceId;
|
|
21012
|
+
this.publicSnips = options.publicSnips ?? false;
|
|
21013
|
+
this.snipsDesired = options.snipsDesired;
|
|
21006
21014
|
}
|
|
21007
21015
|
async request(method, path, body) {
|
|
21008
21016
|
const headers = {
|
|
@@ -21011,6 +21019,18 @@ class RaySurfer {
|
|
|
21011
21019
|
if (this.apiKey) {
|
|
21012
21020
|
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
21013
21021
|
}
|
|
21022
|
+
if (this.organizationId) {
|
|
21023
|
+
headers["X-Raysurfer-Org-Id"] = this.organizationId;
|
|
21024
|
+
}
|
|
21025
|
+
if (this.workspaceId) {
|
|
21026
|
+
headers["X-Raysurfer-Workspace-Id"] = this.workspaceId;
|
|
21027
|
+
}
|
|
21028
|
+
if (this.publicSnips) {
|
|
21029
|
+
headers["X-Raysurfer-Public-Snips"] = "true";
|
|
21030
|
+
}
|
|
21031
|
+
if (this.snipsDesired) {
|
|
21032
|
+
headers["X-Raysurfer-Snips-Desired"] = this.snipsDesired;
|
|
21033
|
+
}
|
|
21014
21034
|
const controller = new AbortController;
|
|
21015
21035
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
21016
21036
|
try {
|
|
@@ -21225,196 +21245,121 @@ class RaySurfer {
|
|
|
21225
21245
|
}
|
|
21226
21246
|
}
|
|
21227
21247
|
var client_default = RaySurfer;
|
|
21228
|
-
// src/sdk-client.ts
|
|
21229
|
-
import { mkdir, writeFile, rm, readdir, stat } from "node:fs/promises";
|
|
21230
|
-
import { homedir as homedir2 } from "node:os";
|
|
21231
|
-
import { join as join6 } from "node:path";
|
|
21232
|
-
var DEFAULT_SANDBOX_DIR = join6(homedir2(), ".raysurfer", "sandbox");
|
|
21233
21248
|
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
|
|
21238
|
-
|
|
21239
|
-
|
|
21240
|
-
|
|
21241
|
-
|
|
21242
|
-
|
|
21243
|
-
|
|
21244
|
-
|
|
21245
|
-
|
|
21246
|
-
|
|
21247
|
-
|
|
21248
|
-
|
|
21249
|
-
|
|
21250
|
-
|
|
21251
|
-
};
|
|
21252
|
-
this.raysurfer = new RaySurfer({
|
|
21253
|
-
apiKey: options.raysurferApiKey,
|
|
21254
|
-
baseUrl: options.raysurferBaseUrl
|
|
21249
|
+
// src/sdk-client.ts
|
|
21250
|
+
var DEFAULT_RAYSURFER_URL = "https://web-production-3d338.up.railway.app";
|
|
21251
|
+
async function* query2(params) {
|
|
21252
|
+
const { prompt, options = {} } = params;
|
|
21253
|
+
const apiKey = process.env.RAYSURFER_API_KEY;
|
|
21254
|
+
const baseUrl = process.env.RAYSURFER_BASE_URL || DEFAULT_RAYSURFER_URL;
|
|
21255
|
+
const cacheEnabled = !!apiKey;
|
|
21256
|
+
let raysurfer = null;
|
|
21257
|
+
let cachedFiles = [];
|
|
21258
|
+
const generatedFiles = [];
|
|
21259
|
+
let taskSucceeded = false;
|
|
21260
|
+
if (cacheEnabled) {
|
|
21261
|
+
raysurfer = new RaySurfer({
|
|
21262
|
+
apiKey,
|
|
21263
|
+
baseUrl,
|
|
21264
|
+
publicSnips: options.publicSnips,
|
|
21265
|
+
snipsDesired: options.snipsDesired
|
|
21255
21266
|
});
|
|
21256
|
-
}
|
|
21257
|
-
async* query(prompt) {
|
|
21258
|
-
this.currentQuery = prompt;
|
|
21259
|
-
this.generatedFiles = [];
|
|
21260
|
-
this.taskSucceeded = false;
|
|
21261
|
-
this.prefetchedFiles = await this.prefetchCodeFiles(prompt);
|
|
21262
|
-
await this.downloadFilesToSandbox();
|
|
21263
|
-
const systemPrompt = this.buildSystemPrompt();
|
|
21264
|
-
let queryFn;
|
|
21265
21267
|
try {
|
|
21266
|
-
const
|
|
21267
|
-
|
|
21268
|
-
|
|
21269
|
-
|
|
21270
|
-
|
|
21271
|
-
|
|
21272
|
-
|
|
21273
|
-
|
|
21274
|
-
|
|
21275
|
-
|
|
21276
|
-
|
|
21277
|
-
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
|
|
21281
|
-
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
|
|
21289
|
-
|
|
21290
|
-
|
|
21291
|
-
|
|
21292
|
-
|
|
21293
|
-
|
|
21294
|
-
|
|
21295
|
-
|
|
21296
|
-
|
|
21268
|
+
const response2 = await raysurfer.getCodeFiles({
|
|
21269
|
+
task: prompt,
|
|
21270
|
+
topK: 5,
|
|
21271
|
+
minVerdictScore: 0.3,
|
|
21272
|
+
preferComplete: true
|
|
21273
|
+
});
|
|
21274
|
+
cachedFiles = response2.files;
|
|
21275
|
+
} catch {}
|
|
21276
|
+
}
|
|
21277
|
+
const augmentedPrompt = buildSystemPrompt(options.systemPrompt, cachedFiles);
|
|
21278
|
+
let sdkQuery;
|
|
21279
|
+
try {
|
|
21280
|
+
const sdk = await Promise.resolve().then(() => (init_sdk(), exports_sdk));
|
|
21281
|
+
sdkQuery = sdk.query;
|
|
21282
|
+
} catch {
|
|
21283
|
+
throw new Error("Could not import @anthropic-ai/claude-agent-sdk. Install it with: npm install @anthropic-ai/claude-agent-sdk");
|
|
21284
|
+
}
|
|
21285
|
+
const response = sdkQuery({
|
|
21286
|
+
prompt,
|
|
21287
|
+
options: {
|
|
21288
|
+
...options,
|
|
21289
|
+
systemPrompt: augmentedPrompt
|
|
21290
|
+
}
|
|
21291
|
+
});
|
|
21292
|
+
for await (const message of response) {
|
|
21293
|
+
const msg = message;
|
|
21294
|
+
if (msg.type === "assistant" && Array.isArray(msg.content)) {
|
|
21295
|
+
for (const block of msg.content) {
|
|
21296
|
+
if (block.type === "tool_use" && block.name === "Write") {
|
|
21297
|
+
const input = block.input;
|
|
21298
|
+
if (input?.file_path && input?.content) {
|
|
21299
|
+
generatedFiles.push({
|
|
21300
|
+
path: input.file_path,
|
|
21301
|
+
content: input.content
|
|
21302
|
+
});
|
|
21297
21303
|
}
|
|
21298
21304
|
}
|
|
21299
21305
|
}
|
|
21300
|
-
if (msg.type === "result") {
|
|
21301
|
-
const subtype = msg.subtype;
|
|
21302
|
-
if (subtype === "success") {
|
|
21303
|
-
this.taskSucceeded = true;
|
|
21304
|
-
}
|
|
21305
|
-
}
|
|
21306
|
-
yield message;
|
|
21307
21306
|
}
|
|
21308
|
-
if (
|
|
21309
|
-
|
|
21307
|
+
if (msg.type === "result" && msg.subtype === "success") {
|
|
21308
|
+
taskSucceeded = true;
|
|
21310
21309
|
}
|
|
21311
|
-
|
|
21312
|
-
if (shouldCleanup) {
|
|
21313
|
-
await this.cleanupSandbox();
|
|
21314
|
-
}
|
|
21315
|
-
}
|
|
21316
|
-
get files() {
|
|
21317
|
-
return this.prefetchedFiles;
|
|
21318
|
-
}
|
|
21319
|
-
get sandbox() {
|
|
21320
|
-
return this.options.sandboxDir;
|
|
21321
|
-
}
|
|
21322
|
-
async cleanup() {
|
|
21323
|
-
await this.cleanupSandbox();
|
|
21310
|
+
yield message;
|
|
21324
21311
|
}
|
|
21325
|
-
|
|
21312
|
+
if (cacheEnabled && raysurfer && taskSucceeded && generatedFiles.length > 0) {
|
|
21326
21313
|
try {
|
|
21327
|
-
|
|
21328
|
-
|
|
21329
|
-
topK: this.options.prefetchCount,
|
|
21330
|
-
minVerdictScore: this.options.minVerdictScore,
|
|
21331
|
-
preferComplete: this.options.preferComplete
|
|
21332
|
-
});
|
|
21333
|
-
return response.files;
|
|
21334
|
-
} catch {
|
|
21335
|
-
return [];
|
|
21336
|
-
}
|
|
21314
|
+
await raysurfer.submitExecutionResult(prompt, generatedFiles, true);
|
|
21315
|
+
} catch {}
|
|
21337
21316
|
}
|
|
21338
|
-
|
|
21339
|
-
|
|
21340
|
-
|
|
21341
|
-
|
|
21342
|
-
|
|
21343
|
-
|
|
21317
|
+
}
|
|
21318
|
+
|
|
21319
|
+
class ClaudeSDKClient {
|
|
21320
|
+
options;
|
|
21321
|
+
constructor(options = {}) {
|
|
21322
|
+
this.options = options;
|
|
21344
21323
|
}
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
if (this.prefetchedFiles.length === 0) {
|
|
21348
|
-
return basePrompt;
|
|
21349
|
-
}
|
|
21350
|
-
return basePrompt + this.formatCodeSnippets();
|
|
21324
|
+
async* query(prompt) {
|
|
21325
|
+
yield* query2({ prompt, options: this.options });
|
|
21351
21326
|
}
|
|
21352
|
-
|
|
21353
|
-
|
|
21354
|
-
|
|
21355
|
-
|
|
21327
|
+
}
|
|
21328
|
+
function buildSystemPrompt(basePrompt, files) {
|
|
21329
|
+
const base = basePrompt ?? "";
|
|
21330
|
+
if (files.length === 0)
|
|
21331
|
+
return base;
|
|
21332
|
+
return base + formatCodeSnippets(files);
|
|
21333
|
+
}
|
|
21334
|
+
function formatCodeSnippets(files) {
|
|
21335
|
+
let snippets = `
|
|
21356
21336
|
|
|
21357
|
-
|
|
21358
|
-
snippets += "The following pre-validated code files are available in your working directory. ";
|
|
21359
|
-
snippets += `You can execute them directly using the Bash tool.
|
|
21337
|
+
## Cached Code (from Raysurfer)
|
|
21360
21338
|
|
|
21361
21339
|
`;
|
|
21362
|
-
|
|
21363
|
-
|
|
21340
|
+
snippets += "The following pre-validated code is available for this task. ";
|
|
21341
|
+
snippets += `Use it directly or adapt it as needed.
|
|
21364
21342
|
|
|
21365
21343
|
`;
|
|
21366
|
-
|
|
21367
|
-
|
|
21344
|
+
for (const f of files) {
|
|
21345
|
+
snippets += `### ${f.filename}
|
|
21368
21346
|
`;
|
|
21369
|
-
|
|
21370
|
-
|
|
21347
|
+
snippets += `**Description**: ${f.description}
|
|
21371
21348
|
`;
|
|
21372
|
-
|
|
21373
|
-
|
|
21349
|
+
snippets += `**Entrypoint**: \`${f.entrypoint}\`
|
|
21374
21350
|
`;
|
|
21375
|
-
|
|
21376
|
-
snippets += `**Dependencies**: ${f.dependencies.join(", ")}
|
|
21351
|
+
snippets += `**Confidence**: ${Math.round(f.verdictScore * 100)}%
|
|
21377
21352
|
|
|
21378
21353
|
`;
|
|
21379
|
-
|
|
21380
|
-
snippets += `\`\`\`${f.language}
|
|
21354
|
+
snippets += `\`\`\`${f.language}
|
|
21381
21355
|
${f.source}
|
|
21382
21356
|
\`\`\`
|
|
21383
21357
|
|
|
21384
21358
|
`;
|
|
21385
|
-
snippets += `---
|
|
21386
|
-
|
|
21387
|
-
`;
|
|
21388
|
-
}
|
|
21389
|
-
return snippets;
|
|
21390
|
-
}
|
|
21391
|
-
async storeGeneratedCode() {
|
|
21392
|
-
if (!this.currentQuery)
|
|
21393
|
-
return;
|
|
21394
|
-
try {
|
|
21395
|
-
const result = await this.raysurfer.submitExecutionResult(this.currentQuery, this.generatedFiles, this.taskSucceeded);
|
|
21396
|
-
if (result.codeBlocksStored > 0) {
|
|
21397
|
-
console.log(`Raysurfer: stored ${result.codeBlocksStored} code blocks`);
|
|
21398
|
-
}
|
|
21399
|
-
} catch (error2) {
|
|
21400
|
-
console.warn("Raysurfer: failed to submit execution result:", error2);
|
|
21401
|
-
}
|
|
21402
|
-
}
|
|
21403
|
-
async cleanupSandbox() {
|
|
21404
|
-
try {
|
|
21405
|
-
const items = await readdir(this.options.sandboxDir);
|
|
21406
|
-
for (const item of items) {
|
|
21407
|
-
const itemPath = join6(this.options.sandboxDir, item);
|
|
21408
|
-
const stats = await stat(itemPath);
|
|
21409
|
-
if (stats.isDirectory()) {
|
|
21410
|
-
await rm(itemPath, { recursive: true });
|
|
21411
|
-
} else {
|
|
21412
|
-
await rm(itemPath);
|
|
21413
|
-
}
|
|
21414
|
-
}
|
|
21415
|
-
} catch {}
|
|
21416
21359
|
}
|
|
21360
|
+
return snippets;
|
|
21417
21361
|
}
|
|
21362
|
+
var sdk_client_default = query2;
|
|
21418
21363
|
// src/types.ts
|
|
21419
21364
|
var ExecutionState;
|
|
21420
21365
|
((ExecutionState2) => {
|
|
@@ -21431,14 +21376,17 @@ var AgentVerdict;
|
|
|
21431
21376
|
})(AgentVerdict ||= {});
|
|
21432
21377
|
|
|
21433
21378
|
// src/index.ts
|
|
21434
|
-
var VERSION = "0.
|
|
21379
|
+
var VERSION = "0.3.1";
|
|
21435
21380
|
export {
|
|
21381
|
+
sdk_client_default as queryDefault,
|
|
21382
|
+
query2 as query,
|
|
21436
21383
|
VERSION,
|
|
21437
|
-
RaysurferClient,
|
|
21384
|
+
ClaudeSDKClient as RaysurferClient,
|
|
21438
21385
|
RaySurferError,
|
|
21439
21386
|
client_default as RaySurferDefault,
|
|
21440
21387
|
RaySurfer,
|
|
21441
21388
|
ExecutionState,
|
|
21389
|
+
ClaudeSDKClient,
|
|
21442
21390
|
AuthenticationError,
|
|
21443
21391
|
AgentVerdict,
|
|
21444
21392
|
APIError
|
package/dist/sdk-client.d.ts
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Drop-in replacement for Claude Agent SDK with automatic code caching.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Simply swap your import:
|
|
5
|
+
*
|
|
6
|
+
* // Before
|
|
7
|
+
* import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
8
|
+
*
|
|
9
|
+
* // After
|
|
10
|
+
* import { query } from "raysurfer";
|
|
11
|
+
*
|
|
12
|
+
* Everything else works exactly the same. Set RAYSURFER_API_KEY to enable caching.
|
|
10
13
|
*/
|
|
11
|
-
import type {
|
|
12
|
-
/** Options for
|
|
13
|
-
export interface
|
|
14
|
-
raysurferApiKey?: string;
|
|
15
|
-
raysurferBaseUrl?: string;
|
|
16
|
-
prefetchCount?: number;
|
|
17
|
-
minVerdictScore?: number;
|
|
18
|
-
preferComplete?: boolean;
|
|
19
|
-
sandboxDir?: string;
|
|
20
|
-
cleanupSandbox?: boolean;
|
|
21
|
-
cleanupOnError?: boolean;
|
|
14
|
+
import type { SnipsDesired } from "./types";
|
|
15
|
+
/** Options for the query function - matches Claude Agent SDK */
|
|
16
|
+
export interface QueryOptions {
|
|
22
17
|
model?: string;
|
|
23
18
|
workingDirectory?: string;
|
|
24
19
|
systemPrompt?: string;
|
|
@@ -28,54 +23,46 @@ export interface RaysurferAgentOptions {
|
|
|
28
23
|
disallowedTools?: string[];
|
|
29
24
|
maxTurns?: number;
|
|
30
25
|
env?: Record<string, string>;
|
|
26
|
+
/** Whether to include public/shared snippets in retrieval (default: false) */
|
|
27
|
+
publicSnips?: boolean;
|
|
28
|
+
/** Scope of private snippets - "company" (Team/Enterprise) or "client" (Enterprise only) */
|
|
29
|
+
snipsDesired?: SnipsDesired;
|
|
31
30
|
}
|
|
31
|
+
/** Query parameters - matches Claude Agent SDK */
|
|
32
|
+
export interface QueryParams {
|
|
33
|
+
prompt: string;
|
|
34
|
+
options?: QueryOptions;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Drop-in replacement for Claude Agent SDK's query function with automatic caching.
|
|
38
|
+
*
|
|
39
|
+
* Usage is identical to the original:
|
|
40
|
+
*
|
|
41
|
+
* import { query } from "raysurfer";
|
|
42
|
+
*
|
|
43
|
+
* for await (const message of query({ prompt: "Hello" })) {
|
|
44
|
+
* console.log(message);
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* Set RAYSURFER_API_KEY environment variable to enable caching.
|
|
48
|
+
*/
|
|
49
|
+
export declare function query(params: QueryParams): AsyncGenerator<unknown>;
|
|
32
50
|
/**
|
|
33
|
-
*
|
|
51
|
+
* ClaudeSDKClient - Class-based drop-in replacement.
|
|
34
52
|
*
|
|
35
|
-
*
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const client = new RaysurferClient({
|
|
38
|
-
* raysurferApiKey: "rs_...",
|
|
39
|
-
* model: "claude-sonnet-4-5",
|
|
40
|
-
* systemPrompt: "You are a helpful assistant.",
|
|
41
|
-
* });
|
|
53
|
+
* For users who prefer the Python-style class interface:
|
|
42
54
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
55
|
+
* const client = new ClaudeSDKClient(options);
|
|
56
|
+
* for await (const msg of client.query("Hello")) {
|
|
57
|
+
* console.log(msg);
|
|
58
|
+
* }
|
|
47
59
|
*/
|
|
48
|
-
export declare class
|
|
60
|
+
export declare class ClaudeSDKClient {
|
|
49
61
|
private options;
|
|
50
|
-
|
|
51
|
-
private prefetchedFiles;
|
|
52
|
-
private currentQuery;
|
|
53
|
-
private generatedFiles;
|
|
54
|
-
private taskSucceeded;
|
|
55
|
-
constructor(options?: RaysurferAgentOptions);
|
|
56
|
-
/**
|
|
57
|
-
* Query Claude with pre-fetched code files from Raysurfer.
|
|
58
|
-
*
|
|
59
|
-
* This method:
|
|
60
|
-
* 1. Pre-fetches relevant code files from Raysurfer backend
|
|
61
|
-
* 2. Downloads files to sandbox directory
|
|
62
|
-
* 3. Injects file contents into system prompt
|
|
63
|
-
* 4. Delegates to Claude Agent SDK
|
|
64
|
-
* 5. Stores generated code back to cache on success
|
|
65
|
-
*/
|
|
62
|
+
constructor(options?: QueryOptions);
|
|
66
63
|
query(prompt: string): AsyncGenerator<unknown>;
|
|
67
|
-
/** Get the list of pre-fetched code files */
|
|
68
|
-
get files(): CodeFile[];
|
|
69
|
-
/** Get the sandbox directory path */
|
|
70
|
-
get sandbox(): string;
|
|
71
|
-
/** Manually clean up the sandbox directory */
|
|
72
|
-
cleanup(): Promise<void>;
|
|
73
|
-
private prefetchCodeFiles;
|
|
74
|
-
private downloadFilesToSandbox;
|
|
75
|
-
private buildSystemPrompt;
|
|
76
|
-
private formatCodeSnippets;
|
|
77
|
-
private storeGeneratedCode;
|
|
78
|
-
private cleanupSandbox;
|
|
79
64
|
}
|
|
80
|
-
export
|
|
65
|
+
export { ClaudeSDKClient as RaysurferClient };
|
|
66
|
+
export type { QueryOptions as RaysurferAgentOptions };
|
|
67
|
+
export default query;
|
|
81
68
|
//# sourceMappingURL=sdk-client.d.ts.map
|
package/dist/sdk-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../src/sdk-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../src/sdk-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,SAAS,CAAC;AAInE,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,GAAG,aAAa,GAAG,MAAM,GAAG,mBAAmB,CAAC;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,8EAA8E;IAC9E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAuB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CA6FzE;AAED;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAe;gBAElB,OAAO,GAAE,YAAiB;IAI/B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;CAGtD;AAGD,OAAO,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC;AAC9C,YAAY,EAAE,YAAY,IAAI,qBAAqB,EAAE,CAAC;AAgCtD,eAAe,KAAK,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export declare enum AgentVerdict {
|
|
|
14
14
|
THUMBS_DOWN = "thumbs_down",
|
|
15
15
|
PENDING = "pending"
|
|
16
16
|
}
|
|
17
|
+
/** Scope of private snippets for retrieval */
|
|
18
|
+
export type SnipsDesired = "company" | "client";
|
|
17
19
|
/** A stored code block with metadata for semantic retrieval */
|
|
18
20
|
export interface CodeBlock {
|
|
19
21
|
id: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,+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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,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,iDAAiD;AACjD,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,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,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raysurfer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.1",
|
|
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",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -45,14 +45,9 @@
|
|
|
45
45
|
"bugs": {
|
|
46
46
|
"url": "https://github.com/raymondxu/raysurfer-ts/issues"
|
|
47
47
|
},
|
|
48
|
-
"
|
|
48
|
+
"dependencies": {
|
|
49
49
|
"@anthropic-ai/claude-agent-sdk": ">=0.1.0"
|
|
50
50
|
},
|
|
51
|
-
"peerDependenciesMeta": {
|
|
52
|
-
"@anthropic-ai/claude-agent-sdk": {
|
|
53
|
-
"optional": true
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
51
|
"devDependencies": {
|
|
57
52
|
"@types/bun": "^1.3.6",
|
|
58
53
|
"@types/node": "^22.0.0",
|