@docyrus/docyrus 0.0.69 → 0.0.70
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 +2 -8
- package/agent-loader.js.map +2 -2
- package/main.js +105 -32
- package/main.js.map +3 -3
- package/package.json +3 -3
- package/server-loader.js +122 -54
- package/server-loader.js.map +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docyrus/docyrus",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.70",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docyrus API CLI",
|
|
6
6
|
"main": "./main.js",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"@clack/prompts": "^0.11.0",
|
|
15
15
|
"@ff-labs/fff-node": "0.6.4",
|
|
16
16
|
"@hono/node-server": "^1.19.13",
|
|
17
|
-
"@mariozechner/pi-ai": "0.
|
|
18
|
-
"@mariozechner/pi-coding-agent": "0.
|
|
17
|
+
"@mariozechner/pi-ai": "0.71.0",
|
|
18
|
+
"@mariozechner/pi-coding-agent": "0.71.0",
|
|
19
19
|
"@modelcontextprotocol/ext-apps": "^1.2.2",
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
21
21
|
"@mozilla/readability": "^0.6.0",
|
package/server-loader.js
CHANGED
|
@@ -18788,6 +18788,11 @@ var DEFAULT_LOGIN_SCOPES = [
|
|
|
18788
18788
|
var DOCYRUS_SETTINGS_DIR_NAME = ".docyrus";
|
|
18789
18789
|
var DOCYRUS_PI_DIR_NAME = "pi";
|
|
18790
18790
|
var DOCYRUS_PI_AGENT_DIR_NAME = "agent";
|
|
18791
|
+
var DOCYRUS_TRACKED_DIR_NAME = "docyrus";
|
|
18792
|
+
var DOCYRUS_TRACKED_AGENT_DIR_NAME = "agent";
|
|
18793
|
+
var DOCYRUS_TRACKED_KNOWLEDGE_INDEX_DIR_NAME = "knowledge-index";
|
|
18794
|
+
var DOCYRUS_TRACKED_SESSION_CONFIG_DIR_NAME = "session-config";
|
|
18795
|
+
var DOCYRUS_TRACKED_SKILLS_DIR_NAME = "skills";
|
|
18791
18796
|
var AUTH_DIR_PATH = (0, import_node_path3.join)((0, import_node_os.homedir)(), DOCYRUS_SETTINGS_DIR_NAME);
|
|
18792
18797
|
var AUTH_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "auth.json");
|
|
18793
18798
|
var CONFIG_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "config.json");
|
|
@@ -18823,6 +18828,21 @@ var DEFAULT_ENVIRONMENTS = [
|
|
|
18823
18828
|
apiBaseUrl: "https://localhost:3366"
|
|
18824
18829
|
}
|
|
18825
18830
|
];
|
|
18831
|
+
function getLocalDocyrusTrackedRootPath(cwd = process.cwd()) {
|
|
18832
|
+
return (0, import_node_path3.join)(cwd, DOCYRUS_TRACKED_DIR_NAME);
|
|
18833
|
+
}
|
|
18834
|
+
function resolveDocyrusTrackedAgentRootPath(cwd = process.cwd()) {
|
|
18835
|
+
return (0, import_node_path3.join)(getLocalDocyrusTrackedRootPath(cwd), DOCYRUS_TRACKED_AGENT_DIR_NAME);
|
|
18836
|
+
}
|
|
18837
|
+
function resolveDocyrusTrackedSessionConfigRootPath(cwd = process.cwd()) {
|
|
18838
|
+
return (0, import_node_path3.join)(resolveDocyrusTrackedAgentRootPath(cwd), DOCYRUS_TRACKED_SESSION_CONFIG_DIR_NAME);
|
|
18839
|
+
}
|
|
18840
|
+
function resolveDocyrusTrackedSkillsRootPath(cwd = process.cwd()) {
|
|
18841
|
+
return (0, import_node_path3.join)(resolveDocyrusTrackedAgentRootPath(cwd), DOCYRUS_TRACKED_SKILLS_DIR_NAME);
|
|
18842
|
+
}
|
|
18843
|
+
function resolveDocyrusKnowledgeIndexRootPath(cwd = process.cwd()) {
|
|
18844
|
+
return (0, import_node_path3.join)(getLocalDocyrusTrackedRootPath(cwd), DOCYRUS_TRACKED_KNOWLEDGE_INDEX_DIR_NAME);
|
|
18845
|
+
}
|
|
18826
18846
|
function normalizeApiBaseUrl(apiBaseUrl) {
|
|
18827
18847
|
const trimmed = apiBaseUrl.trim();
|
|
18828
18848
|
if (!trimmed) {
|
|
@@ -35602,6 +35622,25 @@ function parseAskUserResponseFromToolOutput(output) {
|
|
|
35602
35622
|
}
|
|
35603
35623
|
|
|
35604
35624
|
// src/server/eventBridge.ts
|
|
35625
|
+
function extractAssistantEventErrorMessage(error48) {
|
|
35626
|
+
if (error48 instanceof Error) {
|
|
35627
|
+
return error48.message;
|
|
35628
|
+
}
|
|
35629
|
+
if (typeof error48 === "string") {
|
|
35630
|
+
return error48;
|
|
35631
|
+
}
|
|
35632
|
+
if (error48 && typeof error48 === "object") {
|
|
35633
|
+
const candidate = error48.errorMessage;
|
|
35634
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
35635
|
+
return candidate;
|
|
35636
|
+
}
|
|
35637
|
+
const reason = error48.stopReason;
|
|
35638
|
+
if (typeof reason === "string" && reason.trim().length > 0) {
|
|
35639
|
+
return `Agent stopped: ${reason}`;
|
|
35640
|
+
}
|
|
35641
|
+
}
|
|
35642
|
+
return "Unknown agent error";
|
|
35643
|
+
}
|
|
35605
35644
|
function createEventBridge(params) {
|
|
35606
35645
|
const { messageId, onChunk, onDone, onError, onAskUser } = params;
|
|
35607
35646
|
const activeToolCalls = /* @__PURE__ */ new Map();
|
|
@@ -35759,8 +35798,7 @@ function createEventBridge(params) {
|
|
|
35759
35798
|
break;
|
|
35760
35799
|
}
|
|
35761
35800
|
case "error": {
|
|
35762
|
-
|
|
35763
|
-
onError(errorMessage);
|
|
35801
|
+
onError(extractAssistantEventErrorMessage(assistantEvent.error));
|
|
35764
35802
|
break;
|
|
35765
35803
|
}
|
|
35766
35804
|
}
|
|
@@ -41120,14 +41158,11 @@ function readJsonFile(filePath) {
|
|
|
41120
41158
|
return null;
|
|
41121
41159
|
}
|
|
41122
41160
|
}
|
|
41123
|
-
function
|
|
41124
|
-
return (
|
|
41125
|
-
}
|
|
41126
|
-
function resolveKnowledgeCacheRoot(settingsRootPath, projectRoot) {
|
|
41127
|
-
return (0, import_node_path12.join)(settingsRootPath, "knowledge", hashWorkspace(projectRoot));
|
|
41161
|
+
function resolveKnowledgeCacheRoot(projectRoot) {
|
|
41162
|
+
return resolveDocyrusKnowledgeIndexRootPath(projectRoot);
|
|
41128
41163
|
}
|
|
41129
|
-
function resolveKnowledgeVectorsDbPath(
|
|
41130
|
-
return (0, import_node_path12.join)(resolveKnowledgeCacheRoot(
|
|
41164
|
+
function resolveKnowledgeVectorsDbPath(projectRoot) {
|
|
41165
|
+
return (0, import_node_path12.join)(resolveKnowledgeCacheRoot(projectRoot), "vectors.db");
|
|
41131
41166
|
}
|
|
41132
41167
|
function normalizeApiBase(apiBase) {
|
|
41133
41168
|
const trimmed = apiBase.trim().replace(/\/+$/u, "");
|
|
@@ -41304,12 +41339,12 @@ function createKnowledgeDb(db) {
|
|
|
41304
41339
|
}
|
|
41305
41340
|
};
|
|
41306
41341
|
}
|
|
41307
|
-
function openKnowledgeDb(
|
|
41308
|
-
const cacheRoot = resolveKnowledgeCacheRoot(
|
|
41342
|
+
function openKnowledgeDb(projectRoot) {
|
|
41343
|
+
const cacheRoot = resolveKnowledgeCacheRoot(projectRoot);
|
|
41309
41344
|
if (!(0, import_node_fs4.existsSync)(cacheRoot)) {
|
|
41310
41345
|
(0, import_node_fs4.mkdirSync)(cacheRoot, { recursive: true });
|
|
41311
41346
|
}
|
|
41312
|
-
return createKnowledgeDb(new import_promise.default(resolveKnowledgeVectorsDbPath(
|
|
41347
|
+
return createKnowledgeDb(new import_promise.default(resolveKnowledgeVectorsDbPath(projectRoot), {}));
|
|
41313
41348
|
}
|
|
41314
41349
|
async function ensureKnowledgeSchema(db, dimensions) {
|
|
41315
41350
|
await db.execute(
|
|
@@ -41364,7 +41399,7 @@ function hashContent(text3) {
|
|
|
41364
41399
|
return (0, import_node_crypto.createHash)("sha256").update(text3).digest("hex");
|
|
41365
41400
|
}
|
|
41366
41401
|
async function indexKnowledgeSections(params) {
|
|
41367
|
-
const db = openKnowledgeDb(params.
|
|
41402
|
+
const db = openKnowledgeDb(params.projectRoot);
|
|
41368
41403
|
try {
|
|
41369
41404
|
await ensureKnowledgeSchema(db, params.provider.dimensions);
|
|
41370
41405
|
const sections = flattenSections(await loadAllSections(params.knowledgeDir));
|
|
@@ -41434,7 +41469,7 @@ async function indexKnowledgeSections(params) {
|
|
|
41434
41469
|
}
|
|
41435
41470
|
}
|
|
41436
41471
|
async function searchKnowledgeSections(params) {
|
|
41437
|
-
const db = openKnowledgeDb(params.
|
|
41472
|
+
const db = openKnowledgeDb(params.projectRoot);
|
|
41438
41473
|
try {
|
|
41439
41474
|
await ensureKnowledgeSchema(db, params.provider.dimensions);
|
|
41440
41475
|
const [queryVector] = await embedTexts([params.query], params.provider);
|
|
@@ -42890,9 +42925,7 @@ async function clearProviderConfig(params) {
|
|
|
42890
42925
|
// src/agent/providerCatalog.ts
|
|
42891
42926
|
var OAUTH_ONLY_PROVIDER_IDS = /* @__PURE__ */ new Set([
|
|
42892
42927
|
"github-copilot",
|
|
42893
|
-
"openai-codex"
|
|
42894
|
-
"google-gemini-cli",
|
|
42895
|
-
"google-antigravity"
|
|
42928
|
+
"openai-codex"
|
|
42896
42929
|
]);
|
|
42897
42930
|
var PROVIDER_LABELS = {
|
|
42898
42931
|
anthropic: "Anthropic (Claude)",
|
|
@@ -42916,8 +42949,6 @@ var PROVIDER_LABELS = {
|
|
|
42916
42949
|
"opencode-go": "OpenCode Go",
|
|
42917
42950
|
"kimi-coding": "Kimi Coding",
|
|
42918
42951
|
"custom-openai": "Custom OpenAI-Compatible",
|
|
42919
|
-
"google-gemini-cli": "Google Gemini CLI",
|
|
42920
|
-
"google-antigravity": "Google Antigravity",
|
|
42921
42952
|
"openai-codex": "OpenAI Codex",
|
|
42922
42953
|
"github-copilot": "GitHub Copilot"
|
|
42923
42954
|
};
|
|
@@ -42928,9 +42959,7 @@ var PROVIDER_HINTS = {
|
|
|
42928
42959
|
"azure-openai-responses": "API key + base URL/resource + deployment",
|
|
42929
42960
|
"amazon-bedrock": "AWS profile or access key pair",
|
|
42930
42961
|
"openai-codex": "browser auth",
|
|
42931
|
-
"github-copilot": "browser auth"
|
|
42932
|
-
"google-gemini-cli": "browser auth",
|
|
42933
|
-
"google-antigravity": "browser auth"
|
|
42962
|
+
"github-copilot": "browser auth"
|
|
42934
42963
|
};
|
|
42935
42964
|
function humanizeProviderId(providerId) {
|
|
42936
42965
|
return providerId.split("-").map((part) => {
|
|
@@ -44394,34 +44423,48 @@ async function installSkill(params) {
|
|
|
44394
44423
|
);
|
|
44395
44424
|
}
|
|
44396
44425
|
}
|
|
44397
|
-
const
|
|
44398
|
-
const
|
|
44399
|
-
const
|
|
44426
|
+
const tracked = params.request.track !== false;
|
|
44427
|
+
const runtimeSkillsDir = getSkillsDir(params.agentDir);
|
|
44428
|
+
const runtimeDestination = (0, import_node_path21.join)(runtimeSkillsDir, skillName);
|
|
44429
|
+
const trackedDestination = tracked ? (0, import_node_path21.join)(params.trackedSkillsRoot, skillName) : "";
|
|
44430
|
+
const runtimeExisted = await dirExists(runtimeDestination);
|
|
44431
|
+
const trackedExisted = tracked ? await dirExists(trackedDestination) : false;
|
|
44432
|
+
const existed = runtimeExisted || trackedExisted;
|
|
44400
44433
|
if (existed && !params.request.overwrite) {
|
|
44401
44434
|
throw new SkillError(
|
|
44402
44435
|
"ALREADY_EXISTS",
|
|
44403
44436
|
`Skill "${skillName}" already exists. Set overwrite=true to replace it.`
|
|
44404
44437
|
);
|
|
44405
44438
|
}
|
|
44406
|
-
|
|
44439
|
+
if (tracked) {
|
|
44440
|
+
await (0, import_promises17.mkdir)(params.trackedSkillsRoot, { recursive: true });
|
|
44441
|
+
}
|
|
44442
|
+
await (0, import_promises17.mkdir)(runtimeSkillsDir, { recursive: true });
|
|
44407
44443
|
switch (params.request.sourceType) {
|
|
44408
|
-
case "local":
|
|
44444
|
+
case "local": {
|
|
44445
|
+
const primaryDestination = tracked ? trackedDestination : runtimeDestination;
|
|
44409
44446
|
await copyLocalSkill({
|
|
44410
44447
|
source: params.request.source,
|
|
44411
44448
|
cwd: params.cwd,
|
|
44412
|
-
destination
|
|
44449
|
+
destination: primaryDestination
|
|
44413
44450
|
});
|
|
44451
|
+
if (tracked) {
|
|
44452
|
+
await (0, import_promises17.rm)(runtimeDestination, { recursive: true, force: true });
|
|
44453
|
+
await (0, import_promises17.cp)(trackedDestination, runtimeDestination, { recursive: true });
|
|
44454
|
+
}
|
|
44414
44455
|
break;
|
|
44456
|
+
}
|
|
44415
44457
|
}
|
|
44416
|
-
const fmName = await readSkillFrontmatterName(
|
|
44417
|
-
const computedHash = await computeSkillHash(
|
|
44458
|
+
const fmName = await readSkillFrontmatterName(runtimeDestination);
|
|
44459
|
+
const computedHash = await computeSkillHash(runtimeDestination);
|
|
44418
44460
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
44419
44461
|
const lock = await readSkillsLockFile(params.agentDir);
|
|
44420
44462
|
lock.skills[skillName] = {
|
|
44421
44463
|
source: params.request.source,
|
|
44422
44464
|
sourceType: params.request.sourceType,
|
|
44423
44465
|
computedHash,
|
|
44424
|
-
installedAt
|
|
44466
|
+
installedAt,
|
|
44467
|
+
tracked
|
|
44425
44468
|
};
|
|
44426
44469
|
await writeSkillsLockFile(params.agentDir, lock);
|
|
44427
44470
|
return {
|
|
@@ -44431,7 +44474,8 @@ async function installSkill(params) {
|
|
|
44431
44474
|
sourceType: params.request.sourceType,
|
|
44432
44475
|
computedHash,
|
|
44433
44476
|
installedAt,
|
|
44434
|
-
overwritten: existed
|
|
44477
|
+
overwritten: existed,
|
|
44478
|
+
tracked
|
|
44435
44479
|
};
|
|
44436
44480
|
}
|
|
44437
44481
|
async function uninstallSkill(params) {
|
|
@@ -44450,9 +44494,11 @@ async function uninstallSkill(params) {
|
|
|
44450
44494
|
targetDir = detail.skill.directory;
|
|
44451
44495
|
}
|
|
44452
44496
|
const destination = (0, import_node_path21.join)(skillsDir, targetDir);
|
|
44497
|
+
const trackedDestination = (0, import_node_path21.join)(params.trackedSkillsRoot, targetDir);
|
|
44453
44498
|
const lock = await readSkillsLockFile(params.agentDir);
|
|
44454
44499
|
const lockKey = lock.skills[targetDir] ? targetDir : lock.skills[params.name] ? params.name : null;
|
|
44455
44500
|
await (0, import_promises17.rm)(destination, { recursive: true, force: true });
|
|
44501
|
+
await (0, import_promises17.rm)(trackedDestination, { recursive: true, force: true });
|
|
44456
44502
|
if (lockKey) {
|
|
44457
44503
|
delete lock.skills[lockKey];
|
|
44458
44504
|
await writeSkillsLockFile(params.agentDir, lock);
|
|
@@ -44732,23 +44778,22 @@ var BROWSER_TOOL_SCHEMAS = [
|
|
|
44732
44778
|
var import_node_fs13 = require("node:fs");
|
|
44733
44779
|
var path5 = __toESM(require("node:path"));
|
|
44734
44780
|
var DEFAULT_CONFIG = { autoCommit: false };
|
|
44735
|
-
function configPath(
|
|
44736
|
-
return path5.join(
|
|
44781
|
+
function configPath(sessionConfigDir, sessionId) {
|
|
44782
|
+
return path5.join(sessionConfigDir, `${sessionId}.json`);
|
|
44737
44783
|
}
|
|
44738
|
-
async function readSessionConfig(
|
|
44784
|
+
async function readSessionConfig(sessionConfigDir, sessionId) {
|
|
44739
44785
|
try {
|
|
44740
|
-
const raw2 = await import_node_fs13.promises.readFile(configPath(
|
|
44786
|
+
const raw2 = await import_node_fs13.promises.readFile(configPath(sessionConfigDir, sessionId), "utf-8");
|
|
44741
44787
|
return { ...DEFAULT_CONFIG, ...JSON.parse(raw2) };
|
|
44742
44788
|
} catch {
|
|
44743
44789
|
return { ...DEFAULT_CONFIG };
|
|
44744
44790
|
}
|
|
44745
44791
|
}
|
|
44746
|
-
async function writeSessionConfig(
|
|
44747
|
-
|
|
44748
|
-
await
|
|
44749
|
-
const current = await readSessionConfig(agentDir, sessionId);
|
|
44792
|
+
async function writeSessionConfig(sessionConfigDir, sessionId, patch) {
|
|
44793
|
+
await import_node_fs13.promises.mkdir(sessionConfigDir, { recursive: true });
|
|
44794
|
+
const current = await readSessionConfig(sessionConfigDir, sessionId);
|
|
44750
44795
|
const next = { ...current, ...patch };
|
|
44751
|
-
await import_node_fs13.promises.writeFile(configPath(
|
|
44796
|
+
await import_node_fs13.promises.writeFile(configPath(sessionConfigDir, sessionId), JSON.stringify(next, null, 2), "utf-8");
|
|
44752
44797
|
return next;
|
|
44753
44798
|
}
|
|
44754
44799
|
|
|
@@ -44954,9 +44999,7 @@ async function searchKnowledgeForServer(params) {
|
|
|
44954
44999
|
if (!knowledgeDir) {
|
|
44955
45000
|
return { knowledgeDir: null, provider: null, matches: [] };
|
|
44956
45001
|
}
|
|
44957
|
-
const provider = await getKnowledgeSearchProviderInfo({
|
|
44958
|
-
settingsRootPath: params.settingsRootPath
|
|
44959
|
-
});
|
|
45002
|
+
const provider = await getKnowledgeSearchProviderInfo({});
|
|
44960
45003
|
if (!provider.provider || !provider.info) {
|
|
44961
45004
|
return {
|
|
44962
45005
|
knowledgeDir,
|
|
@@ -44969,14 +45012,12 @@ async function searchKnowledgeForServer(params) {
|
|
|
44969
45012
|
await indexKnowledgeSections({
|
|
44970
45013
|
knowledgeDir,
|
|
44971
45014
|
projectRoot: context.projectRoot,
|
|
44972
|
-
settingsRootPath: params.settingsRootPath,
|
|
44973
45015
|
provider: provider.provider
|
|
44974
45016
|
});
|
|
44975
45017
|
const matches = await searchKnowledgeSections({
|
|
44976
45018
|
query: params.query,
|
|
44977
45019
|
knowledgeDir,
|
|
44978
45020
|
projectRoot: context.projectRoot,
|
|
44979
|
-
settingsRootPath: params.settingsRootPath,
|
|
44980
45021
|
limit: Math.max(1, Math.min(params.limit ?? 5, 50)),
|
|
44981
45022
|
provider: provider.provider
|
|
44982
45023
|
});
|
|
@@ -45420,13 +45461,27 @@ async function createAgentServer(params) {
|
|
|
45420
45461
|
let extensionUICleanup;
|
|
45421
45462
|
if (extensionUIBridge) {
|
|
45422
45463
|
extensionUIBridge.setRequestHandler((request) => {
|
|
45423
|
-
|
|
45464
|
+
const { type: _omit, id, ...rest } = request;
|
|
45465
|
+
writeChunk({
|
|
45466
|
+
type: "data-extension-ui-request",
|
|
45467
|
+
id,
|
|
45468
|
+
data: { type: _omit, id, ...rest },
|
|
45469
|
+
transient: true
|
|
45470
|
+
});
|
|
45424
45471
|
});
|
|
45425
45472
|
extensionUICleanup = () => {
|
|
45426
45473
|
extensionUIBridge.setRequestHandler(() => {
|
|
45427
45474
|
});
|
|
45428
45475
|
};
|
|
45429
45476
|
}
|
|
45477
|
+
let errorChunkEmitted = false;
|
|
45478
|
+
function writeErrorChunk(errorText) {
|
|
45479
|
+
if (errorChunkEmitted) {
|
|
45480
|
+
return;
|
|
45481
|
+
}
|
|
45482
|
+
errorChunkEmitted = true;
|
|
45483
|
+
writeChunk({ type: "error", errorText });
|
|
45484
|
+
}
|
|
45430
45485
|
const bridge = createEventBridge({
|
|
45431
45486
|
messageId,
|
|
45432
45487
|
onChunk: writeChunk,
|
|
@@ -45435,13 +45490,17 @@ async function createAgentServer(params) {
|
|
|
45435
45490
|
},
|
|
45436
45491
|
onDone: () => {
|
|
45437
45492
|
extensionUICleanup?.();
|
|
45493
|
+
const sessionError = activeSession.errorMessage;
|
|
45494
|
+
if (sessionError && sessionError.trim().length > 0) {
|
|
45495
|
+
writeErrorChunk(sessionError);
|
|
45496
|
+
}
|
|
45438
45497
|
writeChunk({ type: "finish-step" });
|
|
45439
45498
|
writeChunk({ type: "finish" });
|
|
45440
45499
|
closeController();
|
|
45441
45500
|
},
|
|
45442
45501
|
onError: (errorText) => {
|
|
45443
45502
|
extensionUICleanup?.();
|
|
45444
|
-
|
|
45503
|
+
writeErrorChunk(errorText);
|
|
45445
45504
|
writeChunk({ type: "finish-step" });
|
|
45446
45505
|
writeChunk({ type: "finish" });
|
|
45447
45506
|
closeController();
|
|
@@ -45457,6 +45516,10 @@ async function createAgentServer(params) {
|
|
|
45457
45516
|
if (!activeSession.isStreaming) {
|
|
45458
45517
|
unsubscribe();
|
|
45459
45518
|
extensionUICleanup?.();
|
|
45519
|
+
const sessionError = activeSession.errorMessage;
|
|
45520
|
+
if (sessionError && sessionError.trim().length > 0) {
|
|
45521
|
+
writeErrorChunk(sessionError);
|
|
45522
|
+
}
|
|
45460
45523
|
writeChunk({ type: "finish-step" });
|
|
45461
45524
|
writeChunk({ type: "finish" });
|
|
45462
45525
|
closeController();
|
|
@@ -45464,7 +45527,7 @@ async function createAgentServer(params) {
|
|
|
45464
45527
|
}).catch((error48) => {
|
|
45465
45528
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
45466
45529
|
extensionUICleanup?.();
|
|
45467
|
-
|
|
45530
|
+
writeErrorChunk(errorMessage);
|
|
45468
45531
|
writeChunk({ type: "finish-step" });
|
|
45469
45532
|
writeChunk({ type: "finish" });
|
|
45470
45533
|
unsubscribe();
|
|
@@ -45543,7 +45606,7 @@ async function createAgentServer(params) {
|
|
|
45543
45606
|
return c.json({ error: "Created session is missing an id" }, 500);
|
|
45544
45607
|
}
|
|
45545
45608
|
if (body2.autoCommit !== void 0) {
|
|
45546
|
-
await writeSessionConfig(context.
|
|
45609
|
+
await writeSessionConfig(resolveDocyrusTrackedSessionConfigRootPath(context.cwd), sessionId, { autoCommit: body2.autoCommit });
|
|
45547
45610
|
}
|
|
45548
45611
|
const sessions = await sessionManager.list();
|
|
45549
45612
|
const match2 = sessions.find((session) => session.id === sessionId);
|
|
@@ -45563,7 +45626,7 @@ async function createAgentServer(params) {
|
|
|
45563
45626
|
app.get("/api/sessions/:sessionId/config", async (c) => {
|
|
45564
45627
|
const sessionId = c.req.param("sessionId");
|
|
45565
45628
|
try {
|
|
45566
|
-
const config2 = await readSessionConfig(context.
|
|
45629
|
+
const config2 = await readSessionConfig(resolveDocyrusTrackedSessionConfigRootPath(context.cwd), sessionId);
|
|
45567
45630
|
return c.json({ sessionId, ...config2 });
|
|
45568
45631
|
} catch (error48) {
|
|
45569
45632
|
const message = error48 instanceof Error ? error48.message : String(error48);
|
|
@@ -45574,7 +45637,7 @@ async function createAgentServer(params) {
|
|
|
45574
45637
|
const sessionId = c.req.param("sessionId");
|
|
45575
45638
|
try {
|
|
45576
45639
|
const body2 = await c.req.json();
|
|
45577
|
-
const config2 = await writeSessionConfig(context.
|
|
45640
|
+
const config2 = await writeSessionConfig(resolveDocyrusTrackedSessionConfigRootPath(context.cwd), sessionId, body2);
|
|
45578
45641
|
return c.json({ ok: true, sessionId, ...config2 });
|
|
45579
45642
|
} catch (error48) {
|
|
45580
45643
|
const message = error48 instanceof Error ? error48.message : String(error48);
|
|
@@ -45780,7 +45843,6 @@ async function createAgentServer(params) {
|
|
|
45780
45843
|
const limit = Number(c.req.query("limit") ?? 5);
|
|
45781
45844
|
const result = await searchKnowledgeForServer({
|
|
45782
45845
|
cwd: context.cwd,
|
|
45783
|
-
settingsRootPath,
|
|
45784
45846
|
query,
|
|
45785
45847
|
limit: Number.isFinite(limit) ? limit : 5
|
|
45786
45848
|
});
|
|
@@ -47132,10 +47194,12 @@ async function createAgentServer(params) {
|
|
|
47132
47194
|
source: body2.source,
|
|
47133
47195
|
sourceType: body2.sourceType,
|
|
47134
47196
|
name: body2.name,
|
|
47135
|
-
overwrite: body2.overwrite === true
|
|
47197
|
+
overwrite: body2.overwrite === true,
|
|
47198
|
+
track: body2.track !== false
|
|
47136
47199
|
};
|
|
47137
47200
|
const result = await installSkill({
|
|
47138
47201
|
agentDir: context.agentDir,
|
|
47202
|
+
trackedSkillsRoot: resolveDocyrusTrackedSkillsRootPath(context.cwd),
|
|
47139
47203
|
cwd: context.cwd,
|
|
47140
47204
|
request
|
|
47141
47205
|
});
|
|
@@ -47149,6 +47213,7 @@ async function createAgentServer(params) {
|
|
|
47149
47213
|
try {
|
|
47150
47214
|
const result = await uninstallSkill({
|
|
47151
47215
|
agentDir: context.agentDir,
|
|
47216
|
+
trackedSkillsRoot: resolveDocyrusTrackedSkillsRootPath(context.cwd),
|
|
47152
47217
|
name: skillName
|
|
47153
47218
|
});
|
|
47154
47219
|
return c.json({ ok: true, ...result });
|
|
@@ -47585,6 +47650,9 @@ function createServerSessionAdapter(params) {
|
|
|
47585
47650
|
get isStreaming() {
|
|
47586
47651
|
return params.session.isStreaming;
|
|
47587
47652
|
},
|
|
47653
|
+
get errorMessage() {
|
|
47654
|
+
return params.session.errorMessage;
|
|
47655
|
+
},
|
|
47588
47656
|
get model() {
|
|
47589
47657
|
return params.session.model;
|
|
47590
47658
|
},
|