@levelcode/sdk 0.0.3 → 0.0.4
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/CHANGELOG.md +1 -1
- package/README.md +4 -4
- package/dist/index.cjs +19 -11
- package/dist/index.cjs.map +10 -10
- package/dist/index.d.ts +3443 -0
- package/dist/index.mjs +19 -11
- package/dist/index.mjs.map +10 -10
- package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/x64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/dist/wasm/tree-sitter-c-sharp.wasm +0 -0
- package/dist/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/dist/wasm/tree-sitter-java.wasm +0 -0
- package/dist/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/wasm/tree-sitter-python.wasm +0 -0
- package/dist/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/wasm/tree-sitter.wasm +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -49,7 +49,7 @@ Types updates.
|
|
|
49
49
|
|
|
50
50
|
### Added
|
|
51
51
|
|
|
52
|
-
- You can now get an API key from the [LevelCode website](https://www.levelcode.
|
|
52
|
+
- You can now get an API key from the [LevelCode website](https://www.levelcode.vercel.app/profile?tab=api-keys)!
|
|
53
53
|
- You can provide your own custom tools!
|
|
54
54
|
|
|
55
55
|
### Updated
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install @levelcode/sdk
|
|
|
10
10
|
|
|
11
11
|
## Prerequisites
|
|
12
12
|
|
|
13
|
-
- Create a LevelCode account and get your [LevelCode API key here](https://www.levelcode.
|
|
13
|
+
- Create a LevelCode account and get your [LevelCode API key here](https://www.levelcode.vercel.app/api-keys).
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
@@ -22,14 +22,14 @@ import { LevelCodeClient } from '@levelcode/sdk'
|
|
|
22
22
|
async function main() {
|
|
23
23
|
const client = new LevelCodeClient({
|
|
24
24
|
// You need to pass in your own API key here.
|
|
25
|
-
// Get one here: https://www.levelcode.
|
|
25
|
+
// Get one here: https://www.levelcode.vercel.app/api-keys
|
|
26
26
|
apiKey: process.env.LEVELCODE_API_KEY,
|
|
27
27
|
cwd: process.cwd(),
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
// First run
|
|
31
31
|
const runState1 = await client.run({
|
|
32
|
-
// The agent id. Any agent on the store (https://levelcode.
|
|
32
|
+
// The agent id. Any agent on the store (https://levelcode.vercel.app/store)
|
|
33
33
|
agent: 'levelcode/base@0.0.16',
|
|
34
34
|
prompt: 'Create a simple calculator class',
|
|
35
35
|
handleEvent: (event) => {
|
|
@@ -66,7 +66,7 @@ import type { AgentDefinition } from '@levelcode/sdk'
|
|
|
66
66
|
async function main() {
|
|
67
67
|
const client = new LevelCodeClient({
|
|
68
68
|
// Note: You need to pass in your own API key.
|
|
69
|
-
// Get it here: https://www.levelcode.
|
|
69
|
+
// Get it here: https://www.levelcode.vercel.app/profile?tab=api-keys
|
|
70
70
|
apiKey: process.env.LEVELCODE_API_KEY,
|
|
71
71
|
// Optional directory agent runs from (if applicable).
|
|
72
72
|
cwd: process.cwd(),
|
package/dist/index.cjs
CHANGED
|
@@ -13162,7 +13162,7 @@ var import_path12 = __toESM(require("path"));
|
|
|
13162
13162
|
var import_v4 = __toESM(require("zod/v4"));
|
|
13163
13163
|
var clientEnvSchema = import_v4.default.object({
|
|
13164
13164
|
NEXT_PUBLIC_CB_ENVIRONMENT: import_v4.default.enum(["dev", "test", "prod"]).default("prod"),
|
|
13165
|
-
NEXT_PUBLIC_LEVELCODE_APP_URL: import_v4.default.string().default(""),
|
|
13165
|
+
NEXT_PUBLIC_LEVELCODE_APP_URL: import_v4.default.string().default("https://levelcode.vercel.app"),
|
|
13166
13166
|
NEXT_PUBLIC_SUPPORT_EMAIL: import_v4.default.string().default("support@levelcode.ai"),
|
|
13167
13167
|
NEXT_PUBLIC_POSTHOG_API_KEY: import_v4.default.string().default(""),
|
|
13168
13168
|
NEXT_PUBLIC_POSTHOG_HOST_URL: import_v4.default.string().default("https://app.posthog.com"),
|
|
@@ -13188,7 +13188,7 @@ var clientProcessEnv = {
|
|
|
13188
13188
|
var parsedEnv = clientEnvSchema.safeParse(clientProcessEnv);
|
|
13189
13189
|
var fallbackEnv = {
|
|
13190
13190
|
NEXT_PUBLIC_CB_ENVIRONMENT: "prod",
|
|
13191
|
-
NEXT_PUBLIC_LEVELCODE_APP_URL: "",
|
|
13191
|
+
NEXT_PUBLIC_LEVELCODE_APP_URL: "https://levelcode.vercel.app",
|
|
13192
13192
|
NEXT_PUBLIC_SUPPORT_EMAIL: "support@levelcode.ai",
|
|
13193
13193
|
NEXT_PUBLIC_POSTHOG_API_KEY: "",
|
|
13194
13194
|
NEXT_PUBLIC_POSTHOG_HOST_URL: "https://app.posthog.com",
|
|
@@ -19687,7 +19687,7 @@ When the user requests a new git commit, please follow these steps closely:
|
|
|
19687
19687
|
4. **Create the commit, ending with this specific footer:**
|
|
19688
19688
|
\`\`\`
|
|
19689
19689
|
Generated with LevelCode \uD83E\uDD16
|
|
19690
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19690
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>
|
|
19691
19691
|
\`\`\`
|
|
19692
19692
|
To maintain proper formatting, use cross-platform compatible commit messages:
|
|
19693
19693
|
|
|
@@ -19697,7 +19697,7 @@ When the user requests a new git commit, please follow these steps closely:
|
|
|
19697
19697
|
Your commit message here.
|
|
19698
19698
|
|
|
19699
19699
|
\uD83E\uDD16 Generated with LevelCode
|
|
19700
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19700
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>
|
|
19701
19701
|
EOF
|
|
19702
19702
|
)"
|
|
19703
19703
|
\`\`\`
|
|
@@ -19707,7 +19707,7 @@ When the user requests a new git commit, please follow these steps closely:
|
|
|
19707
19707
|
git commit -m "Your commit message here.
|
|
19708
19708
|
|
|
19709
19709
|
\uD83E\uDD16 Generated with LevelCode
|
|
19710
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19710
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>"
|
|
19711
19711
|
\`\`\`
|
|
19712
19712
|
|
|
19713
19713
|
Always detect the platform and use the appropriate syntax. HEREDOC syntax (\`<<'EOF'\`) only works in bash/Unix shells and will fail on Windows Command Prompt.
|
|
@@ -19774,7 +19774,7 @@ ${$getNativeToolCallExampleString({
|
|
|
19774
19774
|
command: `git commit -m "Your commit message here.
|
|
19775
19775
|
|
|
19776
19776
|
\uD83E\uDD16 Generated with LevelCode
|
|
19777
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19777
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>"`
|
|
19778
19778
|
},
|
|
19779
19779
|
endsAgentStep: endsAgentStep18
|
|
19780
19780
|
})}
|
|
@@ -35366,9 +35366,15 @@ var getClaudeOAuthTokenFromEnv = () => {
|
|
|
35366
35366
|
var getOpenRouterApiKeyFromEnv = () => {
|
|
35367
35367
|
return process.env.OPENROUTER_API_KEY;
|
|
35368
35368
|
};
|
|
35369
|
+
var getOpenRouterBaseUrlFromEnv = () => {
|
|
35370
|
+
return process.env.OPENROUTER_BASE_URL;
|
|
35371
|
+
};
|
|
35369
35372
|
var getAnthropicApiKeyFromEnv = () => {
|
|
35370
35373
|
return process.env.ANTHROPIC_API_KEY;
|
|
35371
35374
|
};
|
|
35375
|
+
var getAnthropicBaseUrlFromEnv = () => {
|
|
35376
|
+
return process.env.ANTHROPIC_BASE_URL;
|
|
35377
|
+
};
|
|
35372
35378
|
var isStandaloneMode = () => {
|
|
35373
35379
|
const appUrl = process.env.NEXT_PUBLIC_LEVELCODE_APP_URL;
|
|
35374
35380
|
if (!appUrl)
|
|
@@ -38648,7 +38654,7 @@ var userFromJson = (json) => {
|
|
|
38648
38654
|
};
|
|
38649
38655
|
var getConfigDir = (clientEnv = env) => {
|
|
38650
38656
|
const envSuffix = clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT && clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT !== "prod" ? `-${clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT}` : "";
|
|
38651
|
-
return import_node_path.default.join(import_os.default.homedir(), ".config", `
|
|
38657
|
+
return import_node_path.default.join(import_os.default.homedir(), ".config", `levelcode${envSuffix}`);
|
|
38652
38658
|
};
|
|
38653
38659
|
var getCredentialsPath = (clientEnv = env) => {
|
|
38654
38660
|
return import_node_path.default.join(getConfigDir(clientEnv), "credentials.json");
|
|
@@ -38838,12 +38844,14 @@ async function fetchClaudeOAuthResetTime(accessToken) {
|
|
|
38838
38844
|
}
|
|
38839
38845
|
}
|
|
38840
38846
|
function createDirectOpenRouterModel(openRouterApiKey, model) {
|
|
38841
|
-
const
|
|
38847
|
+
const baseURL = getOpenRouterBaseUrlFromEnv();
|
|
38848
|
+
const provider = createOpenRouter({ apiKey: openRouterApiKey, compatibility: "strict", ...baseURL && { baseURL } });
|
|
38842
38849
|
return provider.chat(model);
|
|
38843
38850
|
}
|
|
38844
38851
|
function createDirectAnthropicModel(anthropicApiKey, model) {
|
|
38845
38852
|
const anthropicModelId = toAnthropicModelId(model);
|
|
38846
|
-
const
|
|
38853
|
+
const baseURL = getAnthropicBaseUrlFromEnv();
|
|
38854
|
+
const anthropic = import_anthropic.createAnthropic({ apiKey: anthropicApiKey, ...baseURL && { baseURL } });
|
|
38847
38855
|
return anthropic(anthropicModelId);
|
|
38848
38856
|
}
|
|
38849
38857
|
async function getModelForRequest(params2) {
|
|
@@ -42204,7 +42212,7 @@ async function handlePromptResponse({
|
|
|
42204
42212
|
const message = [
|
|
42205
42213
|
"Received invalid prompt response from server:",
|
|
42206
42214
|
JSON.stringify(parsedOutput.error.issues),
|
|
42207
|
-
"If this issues persists, please contact support@levelcode.
|
|
42215
|
+
"If this issues persists, please contact support@levelcode.vercel.app"
|
|
42208
42216
|
].join(`
|
|
42209
42217
|
`);
|
|
42210
42218
|
onError({ message });
|
|
@@ -42468,5 +42476,5 @@ function loadMCPConfigSync(options) {
|
|
|
42468
42476
|
return mergedConfig;
|
|
42469
42477
|
}
|
|
42470
42478
|
|
|
42471
|
-
//# debugId=
|
|
42479
|
+
//# debugId=099CD01FFE2E727364756E2164756E21
|
|
42472
42480
|
//# sourceMappingURL=index.cjs.map
|