@levelcode/sdk 0.0.3 → 0.0.5
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 +37 -11
- package/dist/index.cjs.map +10 -10
- package/dist/index.d.ts +3443 -0
- package/dist/index.mjs +37 -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/dist/index.mjs
CHANGED
|
@@ -13094,7 +13094,7 @@ import path17 from "path";
|
|
|
13094
13094
|
import z from "zod/v4";
|
|
13095
13095
|
var clientEnvSchema = z.object({
|
|
13096
13096
|
NEXT_PUBLIC_CB_ENVIRONMENT: z.enum(["dev", "test", "prod"]).default("prod"),
|
|
13097
|
-
NEXT_PUBLIC_LEVELCODE_APP_URL: z.string().default(""),
|
|
13097
|
+
NEXT_PUBLIC_LEVELCODE_APP_URL: z.string().default("https://levelcode.vercel.app"),
|
|
13098
13098
|
NEXT_PUBLIC_SUPPORT_EMAIL: z.string().default("support@levelcode.ai"),
|
|
13099
13099
|
NEXT_PUBLIC_POSTHOG_API_KEY: z.string().default(""),
|
|
13100
13100
|
NEXT_PUBLIC_POSTHOG_HOST_URL: z.string().default("https://app.posthog.com"),
|
|
@@ -13120,7 +13120,7 @@ var clientProcessEnv = {
|
|
|
13120
13120
|
var parsedEnv = clientEnvSchema.safeParse(clientProcessEnv);
|
|
13121
13121
|
var fallbackEnv = {
|
|
13122
13122
|
NEXT_PUBLIC_CB_ENVIRONMENT: "prod",
|
|
13123
|
-
NEXT_PUBLIC_LEVELCODE_APP_URL: "",
|
|
13123
|
+
NEXT_PUBLIC_LEVELCODE_APP_URL: "https://levelcode.vercel.app",
|
|
13124
13124
|
NEXT_PUBLIC_SUPPORT_EMAIL: "support@levelcode.ai",
|
|
13125
13125
|
NEXT_PUBLIC_POSTHOG_API_KEY: "",
|
|
13126
13126
|
NEXT_PUBLIC_POSTHOG_HOST_URL: "https://app.posthog.com",
|
|
@@ -19619,7 +19619,7 @@ When the user requests a new git commit, please follow these steps closely:
|
|
|
19619
19619
|
4. **Create the commit, ending with this specific footer:**
|
|
19620
19620
|
\`\`\`
|
|
19621
19621
|
Generated with LevelCode \uD83E\uDD16
|
|
19622
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19622
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>
|
|
19623
19623
|
\`\`\`
|
|
19624
19624
|
To maintain proper formatting, use cross-platform compatible commit messages:
|
|
19625
19625
|
|
|
@@ -19629,7 +19629,7 @@ When the user requests a new git commit, please follow these steps closely:
|
|
|
19629
19629
|
Your commit message here.
|
|
19630
19630
|
|
|
19631
19631
|
\uD83E\uDD16 Generated with LevelCode
|
|
19632
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19632
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>
|
|
19633
19633
|
EOF
|
|
19634
19634
|
)"
|
|
19635
19635
|
\`\`\`
|
|
@@ -19639,7 +19639,7 @@ When the user requests a new git commit, please follow these steps closely:
|
|
|
19639
19639
|
git commit -m "Your commit message here.
|
|
19640
19640
|
|
|
19641
19641
|
\uD83E\uDD16 Generated with LevelCode
|
|
19642
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19642
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>"
|
|
19643
19643
|
\`\`\`
|
|
19644
19644
|
|
|
19645
19645
|
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.
|
|
@@ -19706,7 +19706,7 @@ ${$getNativeToolCallExampleString({
|
|
|
19706
19706
|
command: `git commit -m "Your commit message here.
|
|
19707
19707
|
|
|
19708
19708
|
\uD83E\uDD16 Generated with LevelCode
|
|
19709
|
-
Co-Authored-By: LevelCode <noreply@levelcode.
|
|
19709
|
+
Co-Authored-By: LevelCode <noreply@levelcode.vercel.app>"`
|
|
19710
19710
|
},
|
|
19711
19711
|
endsAgentStep: endsAgentStep18
|
|
19712
19712
|
})}
|
|
@@ -35298,9 +35298,15 @@ var getClaudeOAuthTokenFromEnv = () => {
|
|
|
35298
35298
|
var getOpenRouterApiKeyFromEnv = () => {
|
|
35299
35299
|
return process.env.OPENROUTER_API_KEY;
|
|
35300
35300
|
};
|
|
35301
|
+
var getOpenRouterBaseUrlFromEnv = () => {
|
|
35302
|
+
return process.env.OPENROUTER_BASE_URL;
|
|
35303
|
+
};
|
|
35301
35304
|
var getAnthropicApiKeyFromEnv = () => {
|
|
35302
35305
|
return process.env.ANTHROPIC_API_KEY;
|
|
35303
35306
|
};
|
|
35307
|
+
var getAnthropicBaseUrlFromEnv = () => {
|
|
35308
|
+
return process.env.ANTHROPIC_BASE_URL;
|
|
35309
|
+
};
|
|
35304
35310
|
var isStandaloneMode = () => {
|
|
35305
35311
|
const appUrl = process.env.NEXT_PUBLIC_LEVELCODE_APP_URL;
|
|
35306
35312
|
if (!appUrl)
|
|
@@ -38589,11 +38595,29 @@ var userFromJson = (json) => {
|
|
|
38589
38595
|
return null;
|
|
38590
38596
|
}
|
|
38591
38597
|
};
|
|
38592
|
-
var
|
|
38598
|
+
var getLegacyConfigDir = (clientEnv = env) => {
|
|
38593
38599
|
const envSuffix = clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT && clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT !== "prod" ? `-${clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT}` : "";
|
|
38594
38600
|
return path4.join(os2.homedir(), ".config", `manicode${envSuffix}`);
|
|
38595
38601
|
};
|
|
38602
|
+
var getConfigDir = (clientEnv = env) => {
|
|
38603
|
+
const envSuffix = clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT && clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT !== "prod" ? `-${clientEnv.NEXT_PUBLIC_CB_ENVIRONMENT}` : "";
|
|
38604
|
+
return path4.join(os2.homedir(), ".config", `levelcode${envSuffix}`);
|
|
38605
|
+
};
|
|
38606
|
+
var migrateFromLegacyConfigDir = (clientEnv = env) => {
|
|
38607
|
+
const newDir = getConfigDir(clientEnv);
|
|
38608
|
+
const newCredsPath = path4.join(newDir, "credentials.json");
|
|
38609
|
+
if (fs.existsSync(newCredsPath))
|
|
38610
|
+
return;
|
|
38611
|
+
const legacyCredsPath = path4.join(getLegacyConfigDir(clientEnv), "credentials.json");
|
|
38612
|
+
if (!fs.existsSync(legacyCredsPath))
|
|
38613
|
+
return;
|
|
38614
|
+
try {
|
|
38615
|
+
ensureDirectoryExistsSync(newDir);
|
|
38616
|
+
fs.copyFileSync(legacyCredsPath, newCredsPath);
|
|
38617
|
+
} catch {}
|
|
38618
|
+
};
|
|
38596
38619
|
var getCredentialsPath = (clientEnv = env) => {
|
|
38620
|
+
migrateFromLegacyConfigDir(clientEnv);
|
|
38597
38621
|
return path4.join(getConfigDir(clientEnv), "credentials.json");
|
|
38598
38622
|
};
|
|
38599
38623
|
var getUserCredentials = (clientEnv = env) => {
|
|
@@ -38781,12 +38805,14 @@ async function fetchClaudeOAuthResetTime(accessToken) {
|
|
|
38781
38805
|
}
|
|
38782
38806
|
}
|
|
38783
38807
|
function createDirectOpenRouterModel(openRouterApiKey, model) {
|
|
38784
|
-
const
|
|
38808
|
+
const baseURL = getOpenRouterBaseUrlFromEnv();
|
|
38809
|
+
const provider = createOpenRouter({ apiKey: openRouterApiKey, compatibility: "strict", ...baseURL && { baseURL } });
|
|
38785
38810
|
return provider.chat(model);
|
|
38786
38811
|
}
|
|
38787
38812
|
function createDirectAnthropicModel(anthropicApiKey, model) {
|
|
38788
38813
|
const anthropicModelId = toAnthropicModelId(model);
|
|
38789
|
-
const
|
|
38814
|
+
const baseURL = getAnthropicBaseUrlFromEnv();
|
|
38815
|
+
const anthropic = createAnthropic({ apiKey: anthropicApiKey, ...baseURL && { baseURL } });
|
|
38790
38816
|
return anthropic(anthropicModelId);
|
|
38791
38817
|
}
|
|
38792
38818
|
async function getModelForRequest(params2) {
|
|
@@ -42147,7 +42173,7 @@ async function handlePromptResponse({
|
|
|
42147
42173
|
const message = [
|
|
42148
42174
|
"Received invalid prompt response from server:",
|
|
42149
42175
|
JSON.stringify(parsedOutput.error.issues),
|
|
42150
|
-
"If this issues persists, please contact support@levelcode.
|
|
42176
|
+
"If this issues persists, please contact support@levelcode.vercel.app"
|
|
42151
42177
|
].join(`
|
|
42152
42178
|
`);
|
|
42153
42179
|
onError({ message });
|
|
@@ -42477,5 +42503,5 @@ export {
|
|
|
42477
42503
|
IS_DEV
|
|
42478
42504
|
};
|
|
42479
42505
|
|
|
42480
|
-
//# debugId=
|
|
42506
|
+
//# debugId=5C5879A67BF6BD0F64756E2164756E21
|
|
42481
42507
|
//# sourceMappingURL=index.mjs.map
|