@ycodium-ai/agent-dsh 0.2.2938 → 0.2.2942
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/index.js +252 -261
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31646,6 +31646,230 @@ var UnboundedEventStream = class {
|
|
|
31646
31646
|
}
|
|
31647
31647
|
};
|
|
31648
31648
|
|
|
31649
|
+
// ../../packages/ycodium-acp-executor/src/util.ts
|
|
31650
|
+
function isRecord3(value) {
|
|
31651
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31652
|
+
}
|
|
31653
|
+
function asTrimmedString(value) {
|
|
31654
|
+
if (typeof value !== "string") {
|
|
31655
|
+
return void 0;
|
|
31656
|
+
}
|
|
31657
|
+
const trimmed = value.trim();
|
|
31658
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
31659
|
+
}
|
|
31660
|
+
|
|
31661
|
+
// ../../packages/ycodium-acp-executor/src/tool-presentation.ts
|
|
31662
|
+
function normalizeCommandValue(value) {
|
|
31663
|
+
const direct = asTrimmedString(value);
|
|
31664
|
+
if (direct) {
|
|
31665
|
+
return direct;
|
|
31666
|
+
}
|
|
31667
|
+
if (!Array.isArray(value)) {
|
|
31668
|
+
return void 0;
|
|
31669
|
+
}
|
|
31670
|
+
const parts = [];
|
|
31671
|
+
for (const entry of value) {
|
|
31672
|
+
const part = asTrimmedString(entry);
|
|
31673
|
+
if (part !== void 0) {
|
|
31674
|
+
parts.push(part);
|
|
31675
|
+
}
|
|
31676
|
+
}
|
|
31677
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
31678
|
+
}
|
|
31679
|
+
function stripTrailingExitCode(value) {
|
|
31680
|
+
const trimmed = value?.trim();
|
|
31681
|
+
if (!trimmed) {
|
|
31682
|
+
return void 0;
|
|
31683
|
+
}
|
|
31684
|
+
const match = /^(?<output>[\s\S]*?)(?:\s*<exited with exit code \d+>)\s*$/iu.exec(trimmed);
|
|
31685
|
+
const output2 = match?.groups?.output?.trim() ?? trimmed;
|
|
31686
|
+
return output2.length > 0 ? output2 : void 0;
|
|
31687
|
+
}
|
|
31688
|
+
function extractCommandFromTitle(title) {
|
|
31689
|
+
if (!title) {
|
|
31690
|
+
return void 0;
|
|
31691
|
+
}
|
|
31692
|
+
const backtickMatch = /`([^`]+)`/u.exec(title);
|
|
31693
|
+
return backtickMatch?.[1]?.trim() || void 0;
|
|
31694
|
+
}
|
|
31695
|
+
function extractToolCommand(data, title) {
|
|
31696
|
+
const item = isRecord3(data?.["item"]) ? data["item"] : void 0;
|
|
31697
|
+
const itemInput = item && isRecord3(item["input"]) ? item["input"] : void 0;
|
|
31698
|
+
const itemResult = item && isRecord3(item["result"]) ? item["result"] : void 0;
|
|
31699
|
+
const rawInput = isRecord3(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
31700
|
+
const dataInput = isRecord3(data?.["input"]) ? data["input"] : void 0;
|
|
31701
|
+
const candidates = [
|
|
31702
|
+
normalizeCommandValue(item?.["command"]),
|
|
31703
|
+
normalizeCommandValue(itemInput?.["command"]),
|
|
31704
|
+
normalizeCommandValue(itemResult?.["command"]),
|
|
31705
|
+
normalizeCommandValue(data?.["command"]),
|
|
31706
|
+
normalizeCommandValue(dataInput?.["command"]),
|
|
31707
|
+
normalizeCommandValue(rawInput?.["command"])
|
|
31708
|
+
];
|
|
31709
|
+
const direct = candidates.find((candidate) => candidate !== void 0);
|
|
31710
|
+
if (direct) {
|
|
31711
|
+
return direct;
|
|
31712
|
+
}
|
|
31713
|
+
const executable = asTrimmedString(rawInput?.["executable"]);
|
|
31714
|
+
const args = normalizeCommandValue(rawInput?.["args"]);
|
|
31715
|
+
if (executable && args) {
|
|
31716
|
+
return `${executable} ${args}`;
|
|
31717
|
+
}
|
|
31718
|
+
if (executable) {
|
|
31719
|
+
return executable;
|
|
31720
|
+
}
|
|
31721
|
+
return extractCommandFromTitle(title);
|
|
31722
|
+
}
|
|
31723
|
+
function maybePathLike(value) {
|
|
31724
|
+
if (!value) {
|
|
31725
|
+
return void 0;
|
|
31726
|
+
}
|
|
31727
|
+
if (value.includes("/") || value.includes("\\") || value.startsWith(".") || /\.(?:[a-z0-9]{1,12})$/iu.test(value)) {
|
|
31728
|
+
return value;
|
|
31729
|
+
}
|
|
31730
|
+
return void 0;
|
|
31731
|
+
}
|
|
31732
|
+
function collectPaths(value, paths, seen, depth) {
|
|
31733
|
+
if (depth > 4 || paths.length >= 8) {
|
|
31734
|
+
return;
|
|
31735
|
+
}
|
|
31736
|
+
if (Array.isArray(value)) {
|
|
31737
|
+
for (const entry of value) {
|
|
31738
|
+
collectPaths(entry, paths, seen, depth + 1);
|
|
31739
|
+
if (paths.length >= 8) {
|
|
31740
|
+
return;
|
|
31741
|
+
}
|
|
31742
|
+
}
|
|
31743
|
+
return;
|
|
31744
|
+
}
|
|
31745
|
+
if (!isRecord3(value)) {
|
|
31746
|
+
return;
|
|
31747
|
+
}
|
|
31748
|
+
for (const key of ["path", "filePath", "relativePath", "filename", "newPath", "oldPath"]) {
|
|
31749
|
+
const candidate = maybePathLike(asTrimmedString(value[key]));
|
|
31750
|
+
if (!candidate || seen.has(candidate)) {
|
|
31751
|
+
continue;
|
|
31752
|
+
}
|
|
31753
|
+
seen.add(candidate);
|
|
31754
|
+
paths.push(candidate);
|
|
31755
|
+
if (paths.length >= 8) {
|
|
31756
|
+
return;
|
|
31757
|
+
}
|
|
31758
|
+
}
|
|
31759
|
+
for (const nestedKey of ["locations", "item", "input", "result", "rawInput", "data", "changes"]) {
|
|
31760
|
+
if (!(nestedKey in value)) {
|
|
31761
|
+
continue;
|
|
31762
|
+
}
|
|
31763
|
+
collectPaths(value[nestedKey], paths, seen, depth + 1);
|
|
31764
|
+
if (paths.length >= 8) {
|
|
31765
|
+
return;
|
|
31766
|
+
}
|
|
31767
|
+
}
|
|
31768
|
+
}
|
|
31769
|
+
function extractPrimaryPath(data) {
|
|
31770
|
+
const paths = [];
|
|
31771
|
+
collectPaths(data, paths, /* @__PURE__ */ new Set(), 0);
|
|
31772
|
+
return paths[0];
|
|
31773
|
+
}
|
|
31774
|
+
function normalizeEquivalentValue(value) {
|
|
31775
|
+
const trimmed = asTrimmedString(value);
|
|
31776
|
+
if (!trimmed) {
|
|
31777
|
+
return void 0;
|
|
31778
|
+
}
|
|
31779
|
+
return trimmed.replace(/\s+/gu, " ").replace(/\s+(?:complete|completed|started)\s*$/iu, "").trim();
|
|
31780
|
+
}
|
|
31781
|
+
function isEquivalent(left, right) {
|
|
31782
|
+
const normalizedLeft = normalizeEquivalentValue(left)?.toLowerCase();
|
|
31783
|
+
const normalizedRight = normalizeEquivalentValue(right)?.toLowerCase();
|
|
31784
|
+
return normalizedLeft !== void 0 && normalizedLeft === normalizedRight;
|
|
31785
|
+
}
|
|
31786
|
+
function classifyToolAction(input2) {
|
|
31787
|
+
const itemType = input2.itemType ?? void 0;
|
|
31788
|
+
const kind = asTrimmedString(input2.data?.["kind"])?.toLowerCase();
|
|
31789
|
+
const title = asTrimmedString(input2.title)?.toLowerCase();
|
|
31790
|
+
if (itemType === "command_execution" || kind === "execute" || title === "terminal") {
|
|
31791
|
+
return "command";
|
|
31792
|
+
}
|
|
31793
|
+
if (kind === "read" || title === "read file") {
|
|
31794
|
+
return "read";
|
|
31795
|
+
}
|
|
31796
|
+
if (itemType === "file_change" || kind === "edit" || kind === "move" || kind === "delete" || kind === "write") {
|
|
31797
|
+
return "file_change";
|
|
31798
|
+
}
|
|
31799
|
+
if (itemType === "web_search" || kind === "search" || title === "find" || title === "grep") {
|
|
31800
|
+
return "search";
|
|
31801
|
+
}
|
|
31802
|
+
return "other";
|
|
31803
|
+
}
|
|
31804
|
+
function canonicalItemTypeFromAcpToolKind(kind) {
|
|
31805
|
+
switch (kind) {
|
|
31806
|
+
case "execute":
|
|
31807
|
+
return "command_execution";
|
|
31808
|
+
case "edit":
|
|
31809
|
+
case "delete":
|
|
31810
|
+
case "move":
|
|
31811
|
+
return "file_change";
|
|
31812
|
+
case "search":
|
|
31813
|
+
case "fetch":
|
|
31814
|
+
return "web_search";
|
|
31815
|
+
default:
|
|
31816
|
+
return "dynamic_tool_call";
|
|
31817
|
+
}
|
|
31818
|
+
}
|
|
31819
|
+
function deriveToolActivityPresentation(input2) {
|
|
31820
|
+
const title = asTrimmedString(input2.title);
|
|
31821
|
+
const detail = stripTrailingExitCode(asTrimmedString(input2.detail));
|
|
31822
|
+
const fallbackSummary = asTrimmedString(input2.fallbackSummary) ?? "Tool";
|
|
31823
|
+
const data = isRecord3(input2.data) ? input2.data : void 0;
|
|
31824
|
+
const command = extractToolCommand(data, title);
|
|
31825
|
+
const primaryPath = extractPrimaryPath(data);
|
|
31826
|
+
const action = classifyToolAction({
|
|
31827
|
+
itemType: input2.itemType,
|
|
31828
|
+
title,
|
|
31829
|
+
data
|
|
31830
|
+
});
|
|
31831
|
+
if (action === "command") {
|
|
31832
|
+
return {
|
|
31833
|
+
summary: "Ran command",
|
|
31834
|
+
...command ? { detail: command } : {}
|
|
31835
|
+
};
|
|
31836
|
+
}
|
|
31837
|
+
if (action === "read") {
|
|
31838
|
+
if (primaryPath) {
|
|
31839
|
+
return {
|
|
31840
|
+
summary: "Read file",
|
|
31841
|
+
detail: primaryPath
|
|
31842
|
+
};
|
|
31843
|
+
}
|
|
31844
|
+
return {
|
|
31845
|
+
summary: "Read file"
|
|
31846
|
+
};
|
|
31847
|
+
}
|
|
31848
|
+
if (action === "file_change") {
|
|
31849
|
+
return {
|
|
31850
|
+
summary: "Changed files",
|
|
31851
|
+
...primaryPath ? { detail: primaryPath } : {}
|
|
31852
|
+
};
|
|
31853
|
+
}
|
|
31854
|
+
if (action === "search") {
|
|
31855
|
+
const rawInput = isRecord3(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
31856
|
+
const query = asTrimmedString(rawInput?.["query"]) ?? asTrimmedString(rawInput?.["pattern"]) ?? asTrimmedString(rawInput?.["searchTerm"]);
|
|
31857
|
+
return {
|
|
31858
|
+
summary: "Searched files",
|
|
31859
|
+
...query ? { detail: query } : {}
|
|
31860
|
+
};
|
|
31861
|
+
}
|
|
31862
|
+
if (detail && !isEquivalent(detail, title) && !isEquivalent(detail, fallbackSummary)) {
|
|
31863
|
+
return {
|
|
31864
|
+
summary: title ?? fallbackSummary,
|
|
31865
|
+
detail
|
|
31866
|
+
};
|
|
31867
|
+
}
|
|
31868
|
+
return {
|
|
31869
|
+
summary: title ?? fallbackSummary
|
|
31870
|
+
};
|
|
31871
|
+
}
|
|
31872
|
+
|
|
31649
31873
|
// ../../packages/ycodium-acp-executor/src/events.ts
|
|
31650
31874
|
function canonicalRequestTypeFromAcpKind(kind) {
|
|
31651
31875
|
switch (kind) {
|
|
@@ -31701,21 +31925,6 @@ function fileChangesFromAcpPermission(permissionRequest) {
|
|
|
31701
31925
|
}) : [];
|
|
31702
31926
|
return paths.length > 0 ? paths.map((path) => ({ path, omitted: "unavailable" })) : void 0;
|
|
31703
31927
|
}
|
|
31704
|
-
function canonicalItemTypeFromAcpToolKind(kind) {
|
|
31705
|
-
switch (kind) {
|
|
31706
|
-
case "execute":
|
|
31707
|
-
return "command_execution";
|
|
31708
|
-
case "edit":
|
|
31709
|
-
case "delete":
|
|
31710
|
-
case "move":
|
|
31711
|
-
return "file_change";
|
|
31712
|
-
case "search":
|
|
31713
|
-
case "fetch":
|
|
31714
|
-
return "web_search";
|
|
31715
|
-
default:
|
|
31716
|
-
return "dynamic_tool_call";
|
|
31717
|
-
}
|
|
31718
|
-
}
|
|
31719
31928
|
function runtimeItemStatusFromAcpToolStatus(status) {
|
|
31720
31929
|
switch (status) {
|
|
31721
31930
|
case "pending":
|
|
@@ -31787,6 +31996,7 @@ function makeAcpPlanUpdatedEvent(input2) {
|
|
|
31787
31996
|
}
|
|
31788
31997
|
function makeAcpToolCallEvent(input2) {
|
|
31789
31998
|
const runtimeStatus = runtimeItemStatusFromAcpToolStatus(input2.toolCall.status);
|
|
31999
|
+
const { data } = input2.toolCall;
|
|
31790
32000
|
return {
|
|
31791
32001
|
type: input2.toolCall.status === "completed" || input2.toolCall.status === "failed" ? "item.completed" : "item.updated",
|
|
31792
32002
|
...input2.stamp,
|
|
@@ -31799,7 +32009,7 @@ function makeAcpToolCallEvent(input2) {
|
|
|
31799
32009
|
...runtimeStatus ? { status: runtimeStatus } : {},
|
|
31800
32010
|
...input2.toolCall.title ? { title: input2.toolCall.title } : {},
|
|
31801
32011
|
...input2.toolCall.detail ? { detail: input2.toolCall.detail } : {},
|
|
31802
|
-
...Object.keys(
|
|
32012
|
+
...Object.keys(data).length > 0 ? { data } : {}
|
|
31803
32013
|
},
|
|
31804
32014
|
raw: {
|
|
31805
32015
|
source: "acp.jsonrpc",
|
|
@@ -31843,7 +32053,7 @@ function makeAcpContentDeltaEvent(input2) {
|
|
|
31843
32053
|
}
|
|
31844
32054
|
|
|
31845
32055
|
// ../../packages/ycodium-acp-executor/src/config-options.ts
|
|
31846
|
-
function
|
|
32056
|
+
function isRecord4(value) {
|
|
31847
32057
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31848
32058
|
}
|
|
31849
32059
|
function asString(value) {
|
|
@@ -31862,7 +32072,7 @@ function flattenChoices(rawOptions, currentValue) {
|
|
|
31862
32072
|
const out = [];
|
|
31863
32073
|
const seen = /* @__PURE__ */ new Set();
|
|
31864
32074
|
const push = (entry) => {
|
|
31865
|
-
if (!
|
|
32075
|
+
if (!isRecord4(entry)) return;
|
|
31866
32076
|
const value = asString(entry["value"]);
|
|
31867
32077
|
if (value === void 0 || seen.has(value)) return;
|
|
31868
32078
|
seen.add(value);
|
|
@@ -31877,7 +32087,7 @@ function flattenChoices(rawOptions, currentValue) {
|
|
|
31877
32087
|
});
|
|
31878
32088
|
};
|
|
31879
32089
|
for (const entry of rawOptions) {
|
|
31880
|
-
if (
|
|
32090
|
+
if (isRecord4(entry) && Array.isArray(entry["options"])) {
|
|
31881
32091
|
for (const nested of entry["options"]) push(nested);
|
|
31882
32092
|
continue;
|
|
31883
32093
|
}
|
|
@@ -31887,7 +32097,7 @@ function flattenChoices(rawOptions, currentValue) {
|
|
|
31887
32097
|
}
|
|
31888
32098
|
function findAcpEffortConfig(configOptions) {
|
|
31889
32099
|
if (!Array.isArray(configOptions)) return void 0;
|
|
31890
|
-
const candidates = configOptions.filter(
|
|
32100
|
+
const candidates = configOptions.filter(isRecord4).filter((option) => normalizedField(option, "type") === "select").filter(looksLikeEffortOption);
|
|
31891
32101
|
if (candidates.length === 0) return void 0;
|
|
31892
32102
|
const picked = candidates.find((option) => normalizedField(option, "category") === "model_option") ?? candidates.find((option) => normalizedField(option, "id") === "effort") ?? candidates.find((option) => normalizedField(option, "category") === "thought_level") ?? candidates[0];
|
|
31893
32103
|
if (picked === void 0) return void 0;
|
|
@@ -31903,7 +32113,7 @@ function findAcpEffortConfig(configOptions) {
|
|
|
31903
32113
|
}
|
|
31904
32114
|
function acpModelChoicesFromConfigOptions(configOptions) {
|
|
31905
32115
|
if (!Array.isArray(configOptions)) return void 0;
|
|
31906
|
-
const records = configOptions.filter(
|
|
32116
|
+
const records = configOptions.filter(isRecord4);
|
|
31907
32117
|
const modelOption = records.find((option) => normalizedField(option, "category") === "model") ?? records.find(
|
|
31908
32118
|
(option) => normalizedField(option, "id") === "model" && normalizedField(option, "type") === "select"
|
|
31909
32119
|
);
|
|
@@ -31913,18 +32123,18 @@ function acpModelChoicesFromConfigOptions(configOptions) {
|
|
|
31913
32123
|
}
|
|
31914
32124
|
|
|
31915
32125
|
// ../../packages/ycodium-acp-executor/src/runtime-mode.ts
|
|
31916
|
-
function
|
|
32126
|
+
function isRecord5(value) {
|
|
31917
32127
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31918
32128
|
}
|
|
31919
32129
|
function asString2(value) {
|
|
31920
32130
|
return typeof value === "string" ? value : void 0;
|
|
31921
32131
|
}
|
|
31922
32132
|
function acpModeConfigId(setup) {
|
|
31923
|
-
if (!
|
|
32133
|
+
if (!isRecord5(setup)) return void 0;
|
|
31924
32134
|
const configOptions = setup["configOptions"];
|
|
31925
32135
|
if (!Array.isArray(configOptions)) return void 0;
|
|
31926
32136
|
for (const option of configOptions) {
|
|
31927
|
-
if (!
|
|
32137
|
+
if (!isRecord5(option)) continue;
|
|
31928
32138
|
if (asString2(option["category"])?.trim().toLowerCase() !== "mode") continue;
|
|
31929
32139
|
const id = asString2(option["id"])?.trim();
|
|
31930
32140
|
if (id) return id;
|
|
@@ -32037,215 +32247,6 @@ var Mutex = class {
|
|
|
32037
32247
|
}
|
|
32038
32248
|
};
|
|
32039
32249
|
|
|
32040
|
-
// ../../packages/ycodium-acp-executor/src/util.ts
|
|
32041
|
-
function isRecord5(value) {
|
|
32042
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32043
|
-
}
|
|
32044
|
-
function asTrimmedString(value) {
|
|
32045
|
-
if (typeof value !== "string") {
|
|
32046
|
-
return void 0;
|
|
32047
|
-
}
|
|
32048
|
-
const trimmed = value.trim();
|
|
32049
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
32050
|
-
}
|
|
32051
|
-
|
|
32052
|
-
// ../../packages/ycodium-acp-executor/src/tool-presentation.ts
|
|
32053
|
-
function normalizeCommandValue(value) {
|
|
32054
|
-
const direct = asTrimmedString(value);
|
|
32055
|
-
if (direct) {
|
|
32056
|
-
return direct;
|
|
32057
|
-
}
|
|
32058
|
-
if (!Array.isArray(value)) {
|
|
32059
|
-
return void 0;
|
|
32060
|
-
}
|
|
32061
|
-
const parts = [];
|
|
32062
|
-
for (const entry of value) {
|
|
32063
|
-
const part = asTrimmedString(entry);
|
|
32064
|
-
if (part !== void 0) {
|
|
32065
|
-
parts.push(part);
|
|
32066
|
-
}
|
|
32067
|
-
}
|
|
32068
|
-
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
32069
|
-
}
|
|
32070
|
-
function stripTrailingExitCode(value) {
|
|
32071
|
-
const trimmed = value?.trim();
|
|
32072
|
-
if (!trimmed) {
|
|
32073
|
-
return void 0;
|
|
32074
|
-
}
|
|
32075
|
-
const match = /^(?<output>[\s\S]*?)(?:\s*<exited with exit code \d+>)\s*$/iu.exec(trimmed);
|
|
32076
|
-
const output2 = match?.groups?.output?.trim() ?? trimmed;
|
|
32077
|
-
return output2.length > 0 ? output2 : void 0;
|
|
32078
|
-
}
|
|
32079
|
-
function extractCommandFromTitle(title) {
|
|
32080
|
-
if (!title) {
|
|
32081
|
-
return void 0;
|
|
32082
|
-
}
|
|
32083
|
-
const backtickMatch = /`([^`]+)`/u.exec(title);
|
|
32084
|
-
return backtickMatch?.[1]?.trim() || void 0;
|
|
32085
|
-
}
|
|
32086
|
-
function extractToolCommand(data, title) {
|
|
32087
|
-
const item = isRecord5(data?.["item"]) ? data["item"] : void 0;
|
|
32088
|
-
const itemInput = item && isRecord5(item["input"]) ? item["input"] : void 0;
|
|
32089
|
-
const itemResult = item && isRecord5(item["result"]) ? item["result"] : void 0;
|
|
32090
|
-
const rawInput = isRecord5(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
32091
|
-
const dataInput = isRecord5(data?.["input"]) ? data["input"] : void 0;
|
|
32092
|
-
const candidates = [
|
|
32093
|
-
normalizeCommandValue(item?.["command"]),
|
|
32094
|
-
normalizeCommandValue(itemInput?.["command"]),
|
|
32095
|
-
normalizeCommandValue(itemResult?.["command"]),
|
|
32096
|
-
normalizeCommandValue(data?.["command"]),
|
|
32097
|
-
normalizeCommandValue(dataInput?.["command"]),
|
|
32098
|
-
normalizeCommandValue(rawInput?.["command"])
|
|
32099
|
-
];
|
|
32100
|
-
const direct = candidates.find((candidate) => candidate !== void 0);
|
|
32101
|
-
if (direct) {
|
|
32102
|
-
return direct;
|
|
32103
|
-
}
|
|
32104
|
-
const executable = asTrimmedString(rawInput?.["executable"]);
|
|
32105
|
-
const args = normalizeCommandValue(rawInput?.["args"]);
|
|
32106
|
-
if (executable && args) {
|
|
32107
|
-
return `${executable} ${args}`;
|
|
32108
|
-
}
|
|
32109
|
-
if (executable) {
|
|
32110
|
-
return executable;
|
|
32111
|
-
}
|
|
32112
|
-
return extractCommandFromTitle(title);
|
|
32113
|
-
}
|
|
32114
|
-
function maybePathLike(value) {
|
|
32115
|
-
if (!value) {
|
|
32116
|
-
return void 0;
|
|
32117
|
-
}
|
|
32118
|
-
if (value.includes("/") || value.includes("\\") || value.startsWith(".") || /\.(?:[a-z0-9]{1,12})$/iu.test(value)) {
|
|
32119
|
-
return value;
|
|
32120
|
-
}
|
|
32121
|
-
return void 0;
|
|
32122
|
-
}
|
|
32123
|
-
function collectPaths(value, paths, seen, depth) {
|
|
32124
|
-
if (depth > 4 || paths.length >= 8) {
|
|
32125
|
-
return;
|
|
32126
|
-
}
|
|
32127
|
-
if (Array.isArray(value)) {
|
|
32128
|
-
for (const entry of value) {
|
|
32129
|
-
collectPaths(entry, paths, seen, depth + 1);
|
|
32130
|
-
if (paths.length >= 8) {
|
|
32131
|
-
return;
|
|
32132
|
-
}
|
|
32133
|
-
}
|
|
32134
|
-
return;
|
|
32135
|
-
}
|
|
32136
|
-
if (!isRecord5(value)) {
|
|
32137
|
-
return;
|
|
32138
|
-
}
|
|
32139
|
-
for (const key of ["path", "filePath", "relativePath", "filename", "newPath", "oldPath"]) {
|
|
32140
|
-
const candidate = maybePathLike(asTrimmedString(value[key]));
|
|
32141
|
-
if (!candidate || seen.has(candidate)) {
|
|
32142
|
-
continue;
|
|
32143
|
-
}
|
|
32144
|
-
seen.add(candidate);
|
|
32145
|
-
paths.push(candidate);
|
|
32146
|
-
if (paths.length >= 8) {
|
|
32147
|
-
return;
|
|
32148
|
-
}
|
|
32149
|
-
}
|
|
32150
|
-
for (const nestedKey of ["locations", "item", "input", "result", "rawInput", "data", "changes"]) {
|
|
32151
|
-
if (!(nestedKey in value)) {
|
|
32152
|
-
continue;
|
|
32153
|
-
}
|
|
32154
|
-
collectPaths(value[nestedKey], paths, seen, depth + 1);
|
|
32155
|
-
if (paths.length >= 8) {
|
|
32156
|
-
return;
|
|
32157
|
-
}
|
|
32158
|
-
}
|
|
32159
|
-
}
|
|
32160
|
-
function extractPrimaryPath(data) {
|
|
32161
|
-
const paths = [];
|
|
32162
|
-
collectPaths(data, paths, /* @__PURE__ */ new Set(), 0);
|
|
32163
|
-
return paths[0];
|
|
32164
|
-
}
|
|
32165
|
-
function normalizeEquivalentValue(value) {
|
|
32166
|
-
const trimmed = asTrimmedString(value);
|
|
32167
|
-
if (!trimmed) {
|
|
32168
|
-
return void 0;
|
|
32169
|
-
}
|
|
32170
|
-
return trimmed.replace(/\s+/gu, " ").replace(/\s+(?:complete|completed|started)\s*$/iu, "").trim();
|
|
32171
|
-
}
|
|
32172
|
-
function isEquivalent(left, right) {
|
|
32173
|
-
const normalizedLeft = normalizeEquivalentValue(left)?.toLowerCase();
|
|
32174
|
-
const normalizedRight = normalizeEquivalentValue(right)?.toLowerCase();
|
|
32175
|
-
return normalizedLeft !== void 0 && normalizedLeft === normalizedRight;
|
|
32176
|
-
}
|
|
32177
|
-
function classifyToolAction(input2) {
|
|
32178
|
-
const itemType = input2.itemType ?? void 0;
|
|
32179
|
-
const kind = asTrimmedString(input2.data?.["kind"])?.toLowerCase();
|
|
32180
|
-
const title = asTrimmedString(input2.title)?.toLowerCase();
|
|
32181
|
-
if (itemType === "command_execution" || kind === "execute" || title === "terminal") {
|
|
32182
|
-
return "command";
|
|
32183
|
-
}
|
|
32184
|
-
if (kind === "read" || title === "read file") {
|
|
32185
|
-
return "read";
|
|
32186
|
-
}
|
|
32187
|
-
if (itemType === "file_change" || kind === "edit" || kind === "move" || kind === "delete" || kind === "write") {
|
|
32188
|
-
return "file_change";
|
|
32189
|
-
}
|
|
32190
|
-
if (itemType === "web_search" || kind === "search" || title === "find" || title === "grep") {
|
|
32191
|
-
return "search";
|
|
32192
|
-
}
|
|
32193
|
-
return "other";
|
|
32194
|
-
}
|
|
32195
|
-
function deriveToolActivityPresentation(input2) {
|
|
32196
|
-
const title = asTrimmedString(input2.title);
|
|
32197
|
-
const detail = stripTrailingExitCode(asTrimmedString(input2.detail));
|
|
32198
|
-
const fallbackSummary = asTrimmedString(input2.fallbackSummary) ?? "Tool";
|
|
32199
|
-
const data = isRecord5(input2.data) ? input2.data : void 0;
|
|
32200
|
-
const command = extractToolCommand(data, title);
|
|
32201
|
-
const primaryPath = extractPrimaryPath(data);
|
|
32202
|
-
const action = classifyToolAction({
|
|
32203
|
-
itemType: input2.itemType,
|
|
32204
|
-
title,
|
|
32205
|
-
data
|
|
32206
|
-
});
|
|
32207
|
-
if (action === "command") {
|
|
32208
|
-
return {
|
|
32209
|
-
summary: "Ran command",
|
|
32210
|
-
...command ? { detail: command } : {}
|
|
32211
|
-
};
|
|
32212
|
-
}
|
|
32213
|
-
if (action === "read") {
|
|
32214
|
-
if (primaryPath) {
|
|
32215
|
-
return {
|
|
32216
|
-
summary: "Read file",
|
|
32217
|
-
detail: primaryPath
|
|
32218
|
-
};
|
|
32219
|
-
}
|
|
32220
|
-
return {
|
|
32221
|
-
summary: "Read file"
|
|
32222
|
-
};
|
|
32223
|
-
}
|
|
32224
|
-
if (action === "file_change") {
|
|
32225
|
-
return {
|
|
32226
|
-
summary: "Changed files",
|
|
32227
|
-
...primaryPath ? { detail: primaryPath } : {}
|
|
32228
|
-
};
|
|
32229
|
-
}
|
|
32230
|
-
if (action === "search") {
|
|
32231
|
-
const rawInput = isRecord5(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
32232
|
-
const query = asTrimmedString(rawInput?.["query"]) ?? asTrimmedString(rawInput?.["pattern"]) ?? asTrimmedString(rawInput?.["searchTerm"]);
|
|
32233
|
-
return {
|
|
32234
|
-
summary: "Searched files",
|
|
32235
|
-
...query ? { detail: query } : {}
|
|
32236
|
-
};
|
|
32237
|
-
}
|
|
32238
|
-
if (detail && !isEquivalent(detail, title) && !isEquivalent(detail, fallbackSummary)) {
|
|
32239
|
-
return {
|
|
32240
|
-
summary: title ?? fallbackSummary,
|
|
32241
|
-
detail
|
|
32242
|
-
};
|
|
32243
|
-
}
|
|
32244
|
-
return {
|
|
32245
|
-
summary: title ?? fallbackSummary
|
|
32246
|
-
};
|
|
32247
|
-
}
|
|
32248
|
-
|
|
32249
32250
|
// ../../packages/ycodium-acp-executor/src/runtime-model.ts
|
|
32250
32251
|
function extractModelConfigId(sessionResponse) {
|
|
32251
32252
|
const configOptions = sessionResponse.configOptions;
|
|
@@ -32276,11 +32277,11 @@ function collectSessionConfigOptionValues(configOption) {
|
|
|
32276
32277
|
);
|
|
32277
32278
|
}
|
|
32278
32279
|
function collectSessionModelIds(models) {
|
|
32279
|
-
if (!
|
|
32280
|
+
if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
|
|
32280
32281
|
return [];
|
|
32281
32282
|
}
|
|
32282
32283
|
return models["availableModels"].flatMap(
|
|
32283
|
-
(model) =>
|
|
32284
|
+
(model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
|
|
32284
32285
|
);
|
|
32285
32286
|
}
|
|
32286
32287
|
function catalogModelLastSegment(value) {
|
|
@@ -32352,7 +32353,7 @@ function parseAvailableCommandsUpdate(params) {
|
|
|
32352
32353
|
}
|
|
32353
32354
|
const commands = [];
|
|
32354
32355
|
for (const command of availableCommands) {
|
|
32355
|
-
if (!
|
|
32356
|
+
if (!isRecord3(command)) {
|
|
32356
32357
|
continue;
|
|
32357
32358
|
}
|
|
32358
32359
|
const name = typeof command["name"] === "string" ? command["name"].trim() : "";
|
|
@@ -32360,7 +32361,7 @@ function parseAvailableCommandsUpdate(params) {
|
|
|
32360
32361
|
continue;
|
|
32361
32362
|
}
|
|
32362
32363
|
const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
|
|
32363
|
-
const input2 =
|
|
32364
|
+
const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
|
|
32364
32365
|
const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
|
|
32365
32366
|
commands.push({
|
|
32366
32367
|
name,
|
|
@@ -32422,7 +32423,7 @@ function extractCommandFromTitle2(title) {
|
|
|
32422
32423
|
return match?.[1]?.trim() || void 0;
|
|
32423
32424
|
}
|
|
32424
32425
|
function extractToolCallCommand(rawInput, title) {
|
|
32425
|
-
if (
|
|
32426
|
+
if (isRecord3(rawInput)) {
|
|
32426
32427
|
const directCommand = normalizeCommandValue2(rawInput["command"]);
|
|
32427
32428
|
if (directCommand) {
|
|
32428
32429
|
return directCommand;
|
|
@@ -32449,7 +32450,7 @@ function boundToolCallOutputText(text) {
|
|
|
32449
32450
|
}
|
|
32450
32451
|
var RAW_OUTPUT_TEXT_FIELDS = ["content", "stdout", "stderr", "output"];
|
|
32451
32452
|
function boundToolCallRawOutput(rawOutput) {
|
|
32452
|
-
if (!
|
|
32453
|
+
if (!isRecord3(rawOutput)) {
|
|
32453
32454
|
return rawOutput;
|
|
32454
32455
|
}
|
|
32455
32456
|
let changed = false;
|
|
@@ -32507,21 +32508,6 @@ function extractTextContentFromToolCallContent(content) {
|
|
|
32507
32508
|
function normalizeToolKind(kind) {
|
|
32508
32509
|
return typeof kind === "string" && kind.trim().length > 0 ? kind.trim() : void 0;
|
|
32509
32510
|
}
|
|
32510
|
-
function canonicalItemTypeFromAcpToolKind2(kind) {
|
|
32511
|
-
switch (kind) {
|
|
32512
|
-
case "execute":
|
|
32513
|
-
return "command_execution";
|
|
32514
|
-
case "edit":
|
|
32515
|
-
case "delete":
|
|
32516
|
-
case "move":
|
|
32517
|
-
return "file_change";
|
|
32518
|
-
case "search":
|
|
32519
|
-
case "fetch":
|
|
32520
|
-
return "web_search";
|
|
32521
|
-
default:
|
|
32522
|
-
return "dynamic_tool_call";
|
|
32523
|
-
}
|
|
32524
|
-
}
|
|
32525
32511
|
function makeToolCallState(input2, options) {
|
|
32526
32512
|
const toolCallId = typeof input2.toolCallId === "string" ? input2.toolCallId.trim() : "";
|
|
32527
32513
|
if (!toolCallId) {
|
|
@@ -32537,6 +32523,10 @@ function makeToolCallState(input2, options) {
|
|
|
32537
32523
|
if (kind) {
|
|
32538
32524
|
data["kind"] = kind;
|
|
32539
32525
|
}
|
|
32526
|
+
const name = readAcpText(input2, "name");
|
|
32527
|
+
if (name) {
|
|
32528
|
+
data["name"] = name;
|
|
32529
|
+
}
|
|
32540
32530
|
if (command) {
|
|
32541
32531
|
data["command"] = command;
|
|
32542
32532
|
}
|
|
@@ -32555,7 +32545,7 @@ function makeToolCallState(input2, options) {
|
|
|
32555
32545
|
const fallbackDetail = command ?? normalizedTitle ?? textContent;
|
|
32556
32546
|
const hasPresentationSeed = title !== void 0 || kind !== void 0 || command !== void 0 || normalizedTitle !== void 0 || textContent !== void 0;
|
|
32557
32547
|
const presentation = hasPresentationSeed ? deriveToolActivityPresentation({
|
|
32558
|
-
itemType:
|
|
32548
|
+
itemType: canonicalItemTypeFromAcpToolKind(kind),
|
|
32559
32549
|
title,
|
|
32560
32550
|
detail: fallbackDetail,
|
|
32561
32551
|
data,
|
|
@@ -32661,7 +32651,7 @@ function readAcpText(source, key) {
|
|
|
32661
32651
|
}
|
|
32662
32652
|
function textFromContentBlocks(blocks) {
|
|
32663
32653
|
const parts = blocks.flatMap(
|
|
32664
|
-
(block) =>
|
|
32654
|
+
(block) => isRecord3(block) && block["type"] === "text" && typeof block["text"] === "string" ? [block["text"]] : []
|
|
32665
32655
|
);
|
|
32666
32656
|
const joined = parts.join("");
|
|
32667
32657
|
return joined.trim().length > 0 ? joined : void 0;
|
|
@@ -32686,7 +32676,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
32686
32676
|
const entries = Array.isArray(upd["entries"]) ? upd["entries"] : [];
|
|
32687
32677
|
const plan = entries.map((entry, index) => ({
|
|
32688
32678
|
step: readAcpText(entry, "content") ?? `Step ${index + 1}`,
|
|
32689
|
-
status: normalizePlanStepStatus(
|
|
32679
|
+
status: normalizePlanStepStatus(isRecord3(entry) ? entry["status"] : void 0)
|
|
32690
32680
|
}));
|
|
32691
32681
|
if (plan.length > 0) {
|
|
32692
32682
|
events.push({
|
|
@@ -32704,6 +32694,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
32704
32694
|
const toolCall = makeToolCallState(
|
|
32705
32695
|
{
|
|
32706
32696
|
toolCallId: upd["toolCallId"],
|
|
32697
|
+
name: upd["name"],
|
|
32707
32698
|
title: typeof upd["title"] === "string" ? upd["title"] : void 0,
|
|
32708
32699
|
kind: upd["kind"],
|
|
32709
32700
|
status: upd["status"],
|
|
@@ -32725,7 +32716,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
32725
32716
|
}
|
|
32726
32717
|
case "agent_message_chunk":
|
|
32727
32718
|
case "agent_thought_chunk": {
|
|
32728
|
-
const content =
|
|
32719
|
+
const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
|
|
32729
32720
|
const contentType = content?.["type"];
|
|
32730
32721
|
const streamKind = kind === "agent_thought_chunk" ? "reasoning_text" : "assistant_text";
|
|
32731
32722
|
if (contentType === "text") {
|
|
@@ -32765,7 +32756,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
32765
32756
|
}
|
|
32766
32757
|
case "compaction_summary_chunk": {
|
|
32767
32758
|
const compactionId = readAcpText(upd, "compactionId");
|
|
32768
|
-
const content =
|
|
32759
|
+
const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
|
|
32769
32760
|
const text = content?.["type"] === "text" ? content["text"] : void 0;
|
|
32770
32761
|
if (compactionId === void 0 || typeof text !== "string" || text.length === 0) break;
|
|
32771
32762
|
events.push({ _tag: "CompactionSummaryChunk", compactionId, text });
|
|
@@ -32797,7 +32788,7 @@ function normalizeModelId(value) {
|
|
|
32797
32788
|
return value?.trim() || void 0;
|
|
32798
32789
|
}
|
|
32799
32790
|
function modelSelectionStateFromSetup(setup) {
|
|
32800
|
-
const sessionModels =
|
|
32791
|
+
const sessionModels = isRecord3(setup.models) ? setup.models : void 0;
|
|
32801
32792
|
const modelConfigId = extractModelConfigId(setup);
|
|
32802
32793
|
const strategy = sessionModels === void 0 && modelConfigId !== void 0 ? "config-option" : "session/set_model";
|
|
32803
32794
|
const modelConfigOption = modelConfigId === void 0 ? void 0 : findSessionConfigOption(setup.configOptions, modelConfigId);
|
|
@@ -34042,7 +34033,7 @@ function createAcpExecutor(options) {
|
|
|
34042
34033
|
pendingUserInputs.delete(requestId);
|
|
34043
34034
|
pending.resolve({
|
|
34044
34035
|
kind: "answered",
|
|
34045
|
-
answers:
|
|
34036
|
+
answers: isRecord3(answers) ? answers : {}
|
|
34046
34037
|
});
|
|
34047
34038
|
};
|
|
34048
34039
|
const dispose = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-dsh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2942",
|
|
4
4
|
"description": "DeepSeek Harness executor: dsh CLI over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
24
|
"yaml": "^2.9.0",
|
|
25
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
26
|
-
"ycodium-executor
|
|
27
|
-
"ycodium-
|
|
25
|
+
"@ycodium-ai/plugin-api": "0.2.2942",
|
|
26
|
+
"ycodium-acp-executor": "0.2.2942",
|
|
27
|
+
"ycodium-executor-testing": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|
|
30
30
|
"plugin": "./dist/index.js",
|