@docyrus/docyrus 0.0.64 → 0.0.66
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/agent-loader.js +165 -20
- package/agent-loader.js.map +2 -2
- package/main.js +188 -101
- package/main.js.map +4 -4
- package/package.json +5 -4
- package/resources/pi-agent/extensions/browser-tools.ts +1 -1
- package/resources/pi-agent/extensions/context.ts +12 -73
- package/resources/pi-agent/extensions/control.ts +1 -1
- package/resources/pi-agent/extensions/loop.ts +4 -1
- package/resources/pi-agent/extensions/pi-bash-live-view/index.ts +1 -1
- package/resources/pi-agent/extensions/pi-bash-live-view/package.json +3 -3
- package/resources/pi-agent/extensions/pi-fff/README.md +152 -0
- package/resources/pi-agent/extensions/pi-fff/VENDORED_FROM.md +7 -0
- package/resources/pi-agent/extensions/pi-fff/package.json +53 -0
- package/resources/pi-agent/extensions/pi-fff/src/index.ts +820 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/index.ts +1 -1
- package/resources/pi-agent/extensions/pi-mcp-adapter/package.json +1 -1
- package/resources/pi-agent/extensions/prompt-editor.ts +26 -7
- package/resources/pi-agent/extensions/todos.ts +1 -1
- package/server-loader.js +126 -24
- package/server-loader.js.map +2 -2
package/agent-loader.js
CHANGED
|
@@ -1334,6 +1334,61 @@ function createCustomOpenAiProviderConfig(params) {
|
|
|
1334
1334
|
]
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
+
var DEEPSEEK_BASE_URL = "https://api.deepseek.com";
|
|
1338
|
+
var DEEPSEEK_MODELS = [
|
|
1339
|
+
{
|
|
1340
|
+
id: "deepseek-v4-flash",
|
|
1341
|
+
name: "DeepSeek V4 Flash",
|
|
1342
|
+
cost: {
|
|
1343
|
+
input: 0.14,
|
|
1344
|
+
output: 0.28,
|
|
1345
|
+
cacheRead: 0.028,
|
|
1346
|
+
cacheWrite: 0
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
id: "deepseek-v4-pro",
|
|
1351
|
+
name: "DeepSeek V4 Pro",
|
|
1352
|
+
cost: {
|
|
1353
|
+
input: 1.74,
|
|
1354
|
+
output: 3.48,
|
|
1355
|
+
cacheRead: 0.145,
|
|
1356
|
+
cacheWrite: 0
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
];
|
|
1360
|
+
function createDeepseekProviderConfig() {
|
|
1361
|
+
return {
|
|
1362
|
+
baseUrl: DEEPSEEK_BASE_URL,
|
|
1363
|
+
apiKey: "env:DEEPSEEK_API_KEY",
|
|
1364
|
+
api: "openai-completions",
|
|
1365
|
+
models: DEEPSEEK_MODELS.map((model) => ({
|
|
1366
|
+
id: model.id,
|
|
1367
|
+
name: model.name,
|
|
1368
|
+
reasoning: true,
|
|
1369
|
+
input: ["text"],
|
|
1370
|
+
contextWindow: 1e6,
|
|
1371
|
+
maxTokens: 384e3,
|
|
1372
|
+
cost: {
|
|
1373
|
+
input: model.cost.input,
|
|
1374
|
+
output: model.cost.output,
|
|
1375
|
+
cacheRead: model.cost.cacheRead,
|
|
1376
|
+
cacheWrite: model.cost.cacheWrite
|
|
1377
|
+
},
|
|
1378
|
+
compat: {
|
|
1379
|
+
thinkingFormat: "deepseek",
|
|
1380
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
1381
|
+
reasoningEffortMap: {
|
|
1382
|
+
minimal: "high",
|
|
1383
|
+
low: "high",
|
|
1384
|
+
medium: "high",
|
|
1385
|
+
high: "high",
|
|
1386
|
+
xhigh: "max"
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}))
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1337
1392
|
function createAzureProviderConfig(params) {
|
|
1338
1393
|
const providerConfig = {
|
|
1339
1394
|
baseUrl: params.baseUrl,
|
|
@@ -1405,6 +1460,20 @@ async function saveCustomOpenAiConfig(params) {
|
|
|
1405
1460
|
}));
|
|
1406
1461
|
params.settingsManager.setDefaultModelAndProvider("custom-openai", params.modelId.trim());
|
|
1407
1462
|
}
|
|
1463
|
+
async function saveDeepseekConfig(params) {
|
|
1464
|
+
const apiKey = params.apiKey.trim();
|
|
1465
|
+
const modelId = params.modelId?.trim() || DEEPSEEK_MODELS[0].id;
|
|
1466
|
+
params.authStorage.set("deepseek", {
|
|
1467
|
+
type: "api_key",
|
|
1468
|
+
key: apiKey
|
|
1469
|
+
});
|
|
1470
|
+
await params.envStore.removeMany(["DEEPSEEK_API_KEY"]);
|
|
1471
|
+
await params.envStore.setMany({
|
|
1472
|
+
DEEPSEEK_API_KEY: apiKey
|
|
1473
|
+
});
|
|
1474
|
+
await upsertModelsProvider(params.modelsJsonPath, "deepseek", createDeepseekProviderConfig());
|
|
1475
|
+
params.settingsManager.setDefaultModelAndProvider("deepseek", modelId);
|
|
1476
|
+
}
|
|
1408
1477
|
async function saveAzureConfig(params) {
|
|
1409
1478
|
const modelId = params.modelId.trim();
|
|
1410
1479
|
const useCustomModel = params.useCustomModel ?? false;
|
|
@@ -1482,6 +1551,12 @@ async function clearProviderConfig(params) {
|
|
|
1482
1551
|
]);
|
|
1483
1552
|
await removeModelsProvider(params.modelsJsonPath, "custom-openai");
|
|
1484
1553
|
}
|
|
1554
|
+
if (params.providerId === "deepseek") {
|
|
1555
|
+
await params.envStore.removeMany([
|
|
1556
|
+
"DEEPSEEK_API_KEY"
|
|
1557
|
+
]);
|
|
1558
|
+
await removeModelsProvider(params.modelsJsonPath, "deepseek");
|
|
1559
|
+
}
|
|
1485
1560
|
if (params.providerId === "azure-openai-responses") {
|
|
1486
1561
|
await params.envStore.removeMany([
|
|
1487
1562
|
"AZURE_OPENAI_API_KEY",
|
|
@@ -1552,6 +1627,7 @@ var PROVIDER_LABELS = {
|
|
|
1552
1627
|
mistral: "Mistral",
|
|
1553
1628
|
minimax: "MiniMax",
|
|
1554
1629
|
"minimax-cn": "MiniMax CN",
|
|
1630
|
+
deepseek: "DeepSeek",
|
|
1555
1631
|
huggingface: "Hugging Face",
|
|
1556
1632
|
opencode: "OpenCode",
|
|
1557
1633
|
"opencode-go": "OpenCode Go",
|
|
@@ -1565,6 +1641,7 @@ var PROVIDER_LABELS = {
|
|
|
1565
1641
|
var PROVIDER_HINTS = {
|
|
1566
1642
|
anthropic: "recommended",
|
|
1567
1643
|
"custom-openai": "custom base URL + API key",
|
|
1644
|
+
deepseek: "API key (OpenAI-compatible preset)",
|
|
1568
1645
|
"azure-openai-responses": "API key + base URL/resource + deployment",
|
|
1569
1646
|
"amazon-bedrock": "AWS profile or access key pair",
|
|
1570
1647
|
"openai-codex": "browser auth",
|
|
@@ -1607,6 +1684,8 @@ function getApiKeyProviderOptions(providerIds) {
|
|
|
1607
1684
|
flow = "azure-openai-responses";
|
|
1608
1685
|
} else if (providerId === "amazon-bedrock") {
|
|
1609
1686
|
flow = "amazon-bedrock";
|
|
1687
|
+
} else if (providerId === "deepseek") {
|
|
1688
|
+
flow = "deepseek";
|
|
1610
1689
|
}
|
|
1611
1690
|
return {
|
|
1612
1691
|
id: providerId,
|
|
@@ -1621,6 +1700,12 @@ function getApiKeyProviderOptions(providerIds) {
|
|
|
1621
1700
|
hint: toHint("custom-openai"),
|
|
1622
1701
|
flow: "custom-openai"
|
|
1623
1702
|
});
|
|
1703
|
+
baseProviders.push({
|
|
1704
|
+
id: "deepseek",
|
|
1705
|
+
label: toLabel("deepseek"),
|
|
1706
|
+
hint: toHint("deepseek"),
|
|
1707
|
+
flow: "deepseek"
|
|
1708
|
+
});
|
|
1624
1709
|
const deduped = /* @__PURE__ */ new Map();
|
|
1625
1710
|
for (const provider of baseProviders) {
|
|
1626
1711
|
deduped.set(provider.id, provider);
|
|
@@ -1673,6 +1758,23 @@ function getProviderFormFields(params) {
|
|
|
1673
1758
|
placeholder: "gpt-4o"
|
|
1674
1759
|
}
|
|
1675
1760
|
];
|
|
1761
|
+
case "deepseek":
|
|
1762
|
+
return [
|
|
1763
|
+
{
|
|
1764
|
+
name: "apiKey",
|
|
1765
|
+
title: `${provider.label} API key`,
|
|
1766
|
+
required: true,
|
|
1767
|
+
component: "password"
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
name: "modelId",
|
|
1771
|
+
title: "Model",
|
|
1772
|
+
required: true,
|
|
1773
|
+
component: "select",
|
|
1774
|
+
options: DEEPSEEK_MODELS.map((model) => ({ label: model.name, value: model.id })),
|
|
1775
|
+
defaultValue: DEEPSEEK_MODELS[0].id
|
|
1776
|
+
}
|
|
1777
|
+
];
|
|
1676
1778
|
case "azure-openai-responses":
|
|
1677
1779
|
return [
|
|
1678
1780
|
{
|
|
@@ -1944,6 +2046,33 @@ async function runApiKeyProviderFlow(mode, dependencies, provider) {
|
|
|
1944
2046
|
modeAny.showStatus(`Configured ${provider.label}`);
|
|
1945
2047
|
return;
|
|
1946
2048
|
}
|
|
2049
|
+
case "deepseek": {
|
|
2050
|
+
const apiKeyField = field("apiKey");
|
|
2051
|
+
const modelIdField = field("modelId");
|
|
2052
|
+
const apiKey = await showInput(mode, apiKeyField?.title || "DeepSeek API key");
|
|
2053
|
+
if (!apiKey) {
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
const modelId = await showSelection(
|
|
2057
|
+
mode,
|
|
2058
|
+
modelIdField?.title || "Choose DeepSeek model",
|
|
2059
|
+
(modelIdField?.options ?? DEEPSEEK_MODELS.map((model) => ({ label: model.name, value: model.id }))).map((option) => ({
|
|
2060
|
+
value: option.value,
|
|
2061
|
+
label: option.label
|
|
2062
|
+
}))
|
|
2063
|
+
);
|
|
2064
|
+
if (!modelId) {
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
await saveDeepseekConfig({
|
|
2068
|
+
...dependencies,
|
|
2069
|
+
apiKey,
|
|
2070
|
+
modelId
|
|
2071
|
+
});
|
|
2072
|
+
await refreshAfterCredentialChange(mode, dependencies.envStore, "deepseek", modelId);
|
|
2073
|
+
modeAny.showStatus(`Configured ${provider.label}`);
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
1947
2076
|
case "azure-openai-responses": {
|
|
1948
2077
|
const apiKeyField = field("apiKey");
|
|
1949
2078
|
const configModeField = field("configMode");
|
|
@@ -2201,7 +2330,8 @@ async function shouldRunOnboarding(params) {
|
|
|
2201
2330
|
knownProviderIds: [
|
|
2202
2331
|
...params.browserProviders.map((provider) => provider.id),
|
|
2203
2332
|
...params.apiKeyProviderIds,
|
|
2204
|
-
"custom-openai"
|
|
2333
|
+
"custom-openai",
|
|
2334
|
+
"deepseek"
|
|
2205
2335
|
]
|
|
2206
2336
|
});
|
|
2207
2337
|
return !existingProvider;
|
|
@@ -2404,6 +2534,32 @@ async function runAzureFlow(clack, pico, dependencies) {
|
|
|
2404
2534
|
clack.log.success(`Azure OpenAI configured for ${pico.green(String(modelId).trim())}`);
|
|
2405
2535
|
return true;
|
|
2406
2536
|
}
|
|
2537
|
+
async function runDeepseekFlow(clack, pico, dependencies) {
|
|
2538
|
+
const apiKey = await clack.password({
|
|
2539
|
+
message: "Paste your DeepSeek API key:",
|
|
2540
|
+
mask: "\u25CF"
|
|
2541
|
+
});
|
|
2542
|
+
if (clack.isCancel(apiKey) || !apiKey) {
|
|
2543
|
+
return false;
|
|
2544
|
+
}
|
|
2545
|
+
const modelId = await clack.select({
|
|
2546
|
+
message: "Choose a DeepSeek model:",
|
|
2547
|
+
options: DEEPSEEK_MODELS.map((model) => ({
|
|
2548
|
+
value: model.id,
|
|
2549
|
+
label: model.name
|
|
2550
|
+
}))
|
|
2551
|
+
});
|
|
2552
|
+
if (clack.isCancel(modelId) || !modelId) {
|
|
2553
|
+
return false;
|
|
2554
|
+
}
|
|
2555
|
+
await saveDeepseekConfig({
|
|
2556
|
+
...dependencies,
|
|
2557
|
+
apiKey: String(apiKey).trim(),
|
|
2558
|
+
modelId: String(modelId).trim()
|
|
2559
|
+
});
|
|
2560
|
+
clack.log.success(`DeepSeek configured for ${pico.green(String(modelId).trim())}`);
|
|
2561
|
+
return true;
|
|
2562
|
+
}
|
|
2407
2563
|
async function runBedrockFlow(clack, pico, dependencies) {
|
|
2408
2564
|
const authMode = await clack.select({
|
|
2409
2565
|
message: "How do you want to authenticate with Amazon Bedrock?",
|
|
@@ -2489,6 +2645,8 @@ async function runProviderFlow(clack, pico, dependencies, provider) {
|
|
|
2489
2645
|
return await runOAuthFlow(clack, pico, dependencies, provider.id);
|
|
2490
2646
|
case "custom-openai":
|
|
2491
2647
|
return await runCustomOpenAiFlow(clack, pico, dependencies);
|
|
2648
|
+
case "deepseek":
|
|
2649
|
+
return await runDeepseekFlow(clack, pico, dependencies);
|
|
2492
2650
|
case "azure-openai-responses":
|
|
2493
2651
|
return await runAzureFlow(clack, pico, dependencies);
|
|
2494
2652
|
case "amazon-bedrock":
|
|
@@ -2515,7 +2673,8 @@ async function runOnboarding(dependencies) {
|
|
|
2515
2673
|
knownProviderIds: [
|
|
2516
2674
|
...dependencies.browserProviders.map((provider) => provider.id),
|
|
2517
2675
|
...dependencies.apiKeyProviderIds,
|
|
2518
|
-
"custom-openai"
|
|
2676
|
+
"custom-openai",
|
|
2677
|
+
"deepseek"
|
|
2519
2678
|
]
|
|
2520
2679
|
});
|
|
2521
2680
|
const authOptions = [];
|
|
@@ -2679,25 +2838,11 @@ async function readPipedStdin() {
|
|
|
2679
2838
|
process.stdin.resume();
|
|
2680
2839
|
});
|
|
2681
2840
|
}
|
|
2682
|
-
function buildTools(profile
|
|
2841
|
+
function buildTools(profile) {
|
|
2683
2842
|
if (profile === "agent") {
|
|
2684
|
-
return [
|
|
2685
|
-
pi.createReadTool(cwd),
|
|
2686
|
-
pi.createBashTool(cwd),
|
|
2687
|
-
pi.createGrepTool(cwd),
|
|
2688
|
-
pi.createFindTool(cwd),
|
|
2689
|
-
pi.createLsTool(cwd)
|
|
2690
|
-
];
|
|
2843
|
+
return ["read", "bash", "grep", "find", "ls"];
|
|
2691
2844
|
}
|
|
2692
|
-
return [
|
|
2693
|
-
pi.createReadTool(cwd),
|
|
2694
|
-
pi.createBashTool(cwd),
|
|
2695
|
-
pi.createEditTool(cwd),
|
|
2696
|
-
pi.createWriteTool(cwd),
|
|
2697
|
-
pi.createGrepTool(cwd),
|
|
2698
|
-
pi.createFindTool(cwd),
|
|
2699
|
-
pi.createLsTool(cwd)
|
|
2700
|
-
];
|
|
2845
|
+
return ["read", "bash", "edit", "write", "grep", "find", "ls"];
|
|
2701
2846
|
}
|
|
2702
2847
|
function resolveRequestedModel(params) {
|
|
2703
2848
|
const { request, modelRegistry } = params;
|
|
@@ -2869,7 +3014,7 @@ async function main() {
|
|
|
2869
3014
|
});
|
|
2870
3015
|
await resourceLoader.reload();
|
|
2871
3016
|
spinner.update("Creating session...");
|
|
2872
|
-
const tools = buildTools(request.profile
|
|
3017
|
+
const tools = buildTools(request.profile);
|
|
2873
3018
|
const createRuntime = async (options) => {
|
|
2874
3019
|
const created = await pi.createAgentSession({
|
|
2875
3020
|
cwd: options.cwd,
|