@morphllm/morphsdk 0.2.42 → 0.2.44
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/dist/{chunk-3NTGAUTJ.js → chunk-CP4NZGRY.js} +8 -3
- package/dist/{chunk-3NTGAUTJ.js.map → chunk-CP4NZGRY.js.map} +1 -1
- package/dist/{chunk-GGBB2HDM.js → chunk-IQHKEIQX.js} +5 -4
- package/dist/{chunk-GGBB2HDM.js.map → chunk-IQHKEIQX.js.map} +1 -1
- package/dist/{chunk-FP7INILQ.js → chunk-JKFVDM62.js} +5 -4
- package/dist/{chunk-FP7INILQ.js.map → chunk-JKFVDM62.js.map} +1 -1
- package/dist/{chunk-GU3SULV5.js → chunk-KL4YVZRF.js} +5 -4
- package/dist/{chunk-GU3SULV5.js.map → chunk-KL4YVZRF.js.map} +1 -1
- package/dist/{chunk-O45X46VL.js → chunk-SMR2T5BT.js} +10 -3
- package/dist/chunk-SMR2T5BT.js.map +1 -0
- package/dist/client.cjs +81 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -2
- package/dist/index.cjs +85 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -4
- package/dist/modelrouter/core.cjs +7 -2
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.d.ts +1 -1
- package/dist/modelrouter/core.js +1 -1
- package/dist/modelrouter/index.cjs +7 -2
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +1 -1
- package/dist/modelrouter/types.cjs.map +1 -1
- package/dist/modelrouter/types.d.ts +1 -1
- package/dist/tools/codebase_search/index.js +3 -3
- package/dist/tools/fastapply/index.js +3 -3
- package/dist/tools/index.js +3 -3
- package/dist/tools/warp_grep/agent/types.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/types.d.ts +6 -1
- package/dist/tools/warp_grep/anthropic.cjs +4 -3
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +1 -1
- package/dist/tools/warp_grep/index.cjs +12 -9
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +1 -1
- package/dist/tools/warp_grep/index.js +3 -3
- package/dist/tools/warp_grep/openai.cjs +4 -3
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +2 -2
- package/dist/tools/warp_grep/openai.js +1 -1
- package/dist/tools/warp_grep/vercel.cjs +4 -3
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +2 -2
- package/dist/tools/warp_grep/vercel.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-O45X46VL.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,8 @@ __export(index_exports, {
|
|
|
37
37
|
GeminiRouter: () => GeminiRouter,
|
|
38
38
|
MorphClient: () => MorphClient,
|
|
39
39
|
MorphGit: () => MorphGit,
|
|
40
|
-
OpenAIRouter: () => OpenAIRouter
|
|
40
|
+
OpenAIRouter: () => OpenAIRouter,
|
|
41
|
+
RawRouter: () => RawRouter
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(index_exports);
|
|
43
44
|
|
|
@@ -1478,6 +1479,81 @@ var GeminiRouter = class extends BaseRouter {
|
|
|
1478
1479
|
return super.selectModel(input);
|
|
1479
1480
|
}
|
|
1480
1481
|
};
|
|
1482
|
+
var RawRouter = class extends BaseRouter {
|
|
1483
|
+
constructor(config = {}) {
|
|
1484
|
+
super("raw", config);
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Get raw difficulty classification
|
|
1488
|
+
*
|
|
1489
|
+
* @param input - User input and mode
|
|
1490
|
+
* @returns Raw difficulty (easy | medium | hard | needs_info)
|
|
1491
|
+
*/
|
|
1492
|
+
async classify(input) {
|
|
1493
|
+
const mode = input.mode || "balanced";
|
|
1494
|
+
const apiKey = this.config.apiKey || process.env.MORPH_API_KEY;
|
|
1495
|
+
if (!apiKey) {
|
|
1496
|
+
throw new Error(
|
|
1497
|
+
"Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config."
|
|
1498
|
+
);
|
|
1499
|
+
}
|
|
1500
|
+
const url = `${this.config.apiUrl}/v1/router/raw`;
|
|
1501
|
+
const payload = {
|
|
1502
|
+
input: input.input,
|
|
1503
|
+
mode
|
|
1504
|
+
};
|
|
1505
|
+
if (this.config.debug) {
|
|
1506
|
+
console.log(`[RawRouter] Requesting raw difficulty classification:`, {
|
|
1507
|
+
mode,
|
|
1508
|
+
inputLength: input.input.length
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
try {
|
|
1512
|
+
const fetchPromise = fetchWithRetry(
|
|
1513
|
+
url,
|
|
1514
|
+
{
|
|
1515
|
+
method: "POST",
|
|
1516
|
+
headers: {
|
|
1517
|
+
"Content-Type": "application/json",
|
|
1518
|
+
Authorization: `Bearer ${apiKey}`
|
|
1519
|
+
},
|
|
1520
|
+
body: JSON.stringify(payload)
|
|
1521
|
+
},
|
|
1522
|
+
this.config.retryConfig
|
|
1523
|
+
);
|
|
1524
|
+
const response = await withTimeout(
|
|
1525
|
+
fetchPromise,
|
|
1526
|
+
this.config.timeout,
|
|
1527
|
+
`Router API request timed out after ${this.config.timeout}ms`
|
|
1528
|
+
);
|
|
1529
|
+
if (!response.ok) {
|
|
1530
|
+
const errorText = await response.text();
|
|
1531
|
+
throw new Error(
|
|
1532
|
+
`Router API error (${response.status}): ${errorText || response.statusText}`
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
const apiResult = await response.json();
|
|
1536
|
+
let difficulty;
|
|
1537
|
+
if (apiResult.difficulty === "") {
|
|
1538
|
+
difficulty = "medium";
|
|
1539
|
+
} else {
|
|
1540
|
+
difficulty = apiResult.difficulty || apiResult.model;
|
|
1541
|
+
}
|
|
1542
|
+
const result = {
|
|
1543
|
+
difficulty
|
|
1544
|
+
};
|
|
1545
|
+
if (this.config.debug) {
|
|
1546
|
+
console.log(`[RawRouter] Classified as: ${difficulty}`);
|
|
1547
|
+
}
|
|
1548
|
+
return result;
|
|
1549
|
+
} catch (error) {
|
|
1550
|
+
if (this.config.debug) {
|
|
1551
|
+
console.error(`[RawRouter] Error classifying:`, error);
|
|
1552
|
+
}
|
|
1553
|
+
throw error;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1481
1557
|
|
|
1482
1558
|
// client.ts
|
|
1483
1559
|
var MorphClient = class {
|
|
@@ -1549,6 +1625,12 @@ var MorphClient = class {
|
|
|
1549
1625
|
debug: config.debug,
|
|
1550
1626
|
timeout: config.timeout,
|
|
1551
1627
|
retryConfig: config.retryConfig
|
|
1628
|
+
}),
|
|
1629
|
+
raw: new RawRouter({
|
|
1630
|
+
apiKey: config.apiKey,
|
|
1631
|
+
debug: config.debug,
|
|
1632
|
+
timeout: config.timeout,
|
|
1633
|
+
retryConfig: config.retryConfig
|
|
1552
1634
|
})
|
|
1553
1635
|
};
|
|
1554
1636
|
}
|
|
@@ -1562,6 +1644,7 @@ var MorphClient = class {
|
|
|
1562
1644
|
GeminiRouter,
|
|
1563
1645
|
MorphClient,
|
|
1564
1646
|
MorphGit,
|
|
1565
|
-
OpenAIRouter
|
|
1647
|
+
OpenAIRouter,
|
|
1648
|
+
RawRouter
|
|
1566
1649
|
});
|
|
1567
1650
|
//# sourceMappingURL=index.cjs.map
|