@ycodium-ai/agent-antigravity 0.2.2938 → 0.2.2944
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 +264 -273
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -25787,6 +25787,230 @@ var UnboundedEventStream = class {
|
|
|
25787
25787
|
}
|
|
25788
25788
|
};
|
|
25789
25789
|
|
|
25790
|
+
// ../../packages/ycodium-acp-executor/src/util.ts
|
|
25791
|
+
function isRecord3(value) {
|
|
25792
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25793
|
+
}
|
|
25794
|
+
function asTrimmedString(value) {
|
|
25795
|
+
if (typeof value !== "string") {
|
|
25796
|
+
return void 0;
|
|
25797
|
+
}
|
|
25798
|
+
const trimmed = value.trim();
|
|
25799
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
25800
|
+
}
|
|
25801
|
+
|
|
25802
|
+
// ../../packages/ycodium-acp-executor/src/tool-presentation.ts
|
|
25803
|
+
function normalizeCommandValue(value) {
|
|
25804
|
+
const direct = asTrimmedString(value);
|
|
25805
|
+
if (direct) {
|
|
25806
|
+
return direct;
|
|
25807
|
+
}
|
|
25808
|
+
if (!Array.isArray(value)) {
|
|
25809
|
+
return void 0;
|
|
25810
|
+
}
|
|
25811
|
+
const parts = [];
|
|
25812
|
+
for (const entry of value) {
|
|
25813
|
+
const part = asTrimmedString(entry);
|
|
25814
|
+
if (part !== void 0) {
|
|
25815
|
+
parts.push(part);
|
|
25816
|
+
}
|
|
25817
|
+
}
|
|
25818
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
25819
|
+
}
|
|
25820
|
+
function stripTrailingExitCode(value) {
|
|
25821
|
+
const trimmed = value?.trim();
|
|
25822
|
+
if (!trimmed) {
|
|
25823
|
+
return void 0;
|
|
25824
|
+
}
|
|
25825
|
+
const match = /^(?<output>[\s\S]*?)(?:\s*<exited with exit code \d+>)\s*$/iu.exec(trimmed);
|
|
25826
|
+
const output2 = match?.groups?.output?.trim() ?? trimmed;
|
|
25827
|
+
return output2.length > 0 ? output2 : void 0;
|
|
25828
|
+
}
|
|
25829
|
+
function extractCommandFromTitle(title) {
|
|
25830
|
+
if (!title) {
|
|
25831
|
+
return void 0;
|
|
25832
|
+
}
|
|
25833
|
+
const backtickMatch = /`([^`]+)`/u.exec(title);
|
|
25834
|
+
return backtickMatch?.[1]?.trim() || void 0;
|
|
25835
|
+
}
|
|
25836
|
+
function extractToolCommand(data, title) {
|
|
25837
|
+
const item = isRecord3(data?.["item"]) ? data["item"] : void 0;
|
|
25838
|
+
const itemInput = item && isRecord3(item["input"]) ? item["input"] : void 0;
|
|
25839
|
+
const itemResult = item && isRecord3(item["result"]) ? item["result"] : void 0;
|
|
25840
|
+
const rawInput = isRecord3(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
25841
|
+
const dataInput = isRecord3(data?.["input"]) ? data["input"] : void 0;
|
|
25842
|
+
const candidates = [
|
|
25843
|
+
normalizeCommandValue(item?.["command"]),
|
|
25844
|
+
normalizeCommandValue(itemInput?.["command"]),
|
|
25845
|
+
normalizeCommandValue(itemResult?.["command"]),
|
|
25846
|
+
normalizeCommandValue(data?.["command"]),
|
|
25847
|
+
normalizeCommandValue(dataInput?.["command"]),
|
|
25848
|
+
normalizeCommandValue(rawInput?.["command"])
|
|
25849
|
+
];
|
|
25850
|
+
const direct = candidates.find((candidate) => candidate !== void 0);
|
|
25851
|
+
if (direct) {
|
|
25852
|
+
return direct;
|
|
25853
|
+
}
|
|
25854
|
+
const executable = asTrimmedString(rawInput?.["executable"]);
|
|
25855
|
+
const args = normalizeCommandValue(rawInput?.["args"]);
|
|
25856
|
+
if (executable && args) {
|
|
25857
|
+
return `${executable} ${args}`;
|
|
25858
|
+
}
|
|
25859
|
+
if (executable) {
|
|
25860
|
+
return executable;
|
|
25861
|
+
}
|
|
25862
|
+
return extractCommandFromTitle(title);
|
|
25863
|
+
}
|
|
25864
|
+
function maybePathLike(value) {
|
|
25865
|
+
if (!value) {
|
|
25866
|
+
return void 0;
|
|
25867
|
+
}
|
|
25868
|
+
if (value.includes("/") || value.includes("\\") || value.startsWith(".") || /\.(?:[a-z0-9]{1,12})$/iu.test(value)) {
|
|
25869
|
+
return value;
|
|
25870
|
+
}
|
|
25871
|
+
return void 0;
|
|
25872
|
+
}
|
|
25873
|
+
function collectPaths(value, paths, seen, depth) {
|
|
25874
|
+
if (depth > 4 || paths.length >= 8) {
|
|
25875
|
+
return;
|
|
25876
|
+
}
|
|
25877
|
+
if (Array.isArray(value)) {
|
|
25878
|
+
for (const entry of value) {
|
|
25879
|
+
collectPaths(entry, paths, seen, depth + 1);
|
|
25880
|
+
if (paths.length >= 8) {
|
|
25881
|
+
return;
|
|
25882
|
+
}
|
|
25883
|
+
}
|
|
25884
|
+
return;
|
|
25885
|
+
}
|
|
25886
|
+
if (!isRecord3(value)) {
|
|
25887
|
+
return;
|
|
25888
|
+
}
|
|
25889
|
+
for (const key of ["path", "filePath", "relativePath", "filename", "newPath", "oldPath"]) {
|
|
25890
|
+
const candidate = maybePathLike(asTrimmedString(value[key]));
|
|
25891
|
+
if (!candidate || seen.has(candidate)) {
|
|
25892
|
+
continue;
|
|
25893
|
+
}
|
|
25894
|
+
seen.add(candidate);
|
|
25895
|
+
paths.push(candidate);
|
|
25896
|
+
if (paths.length >= 8) {
|
|
25897
|
+
return;
|
|
25898
|
+
}
|
|
25899
|
+
}
|
|
25900
|
+
for (const nestedKey of ["locations", "item", "input", "result", "rawInput", "data", "changes"]) {
|
|
25901
|
+
if (!(nestedKey in value)) {
|
|
25902
|
+
continue;
|
|
25903
|
+
}
|
|
25904
|
+
collectPaths(value[nestedKey], paths, seen, depth + 1);
|
|
25905
|
+
if (paths.length >= 8) {
|
|
25906
|
+
return;
|
|
25907
|
+
}
|
|
25908
|
+
}
|
|
25909
|
+
}
|
|
25910
|
+
function extractPrimaryPath(data) {
|
|
25911
|
+
const paths = [];
|
|
25912
|
+
collectPaths(data, paths, /* @__PURE__ */ new Set(), 0);
|
|
25913
|
+
return paths[0];
|
|
25914
|
+
}
|
|
25915
|
+
function normalizeEquivalentValue(value) {
|
|
25916
|
+
const trimmed = asTrimmedString(value);
|
|
25917
|
+
if (!trimmed) {
|
|
25918
|
+
return void 0;
|
|
25919
|
+
}
|
|
25920
|
+
return trimmed.replace(/\s+/gu, " ").replace(/\s+(?:complete|completed|started)\s*$/iu, "").trim();
|
|
25921
|
+
}
|
|
25922
|
+
function isEquivalent(left, right) {
|
|
25923
|
+
const normalizedLeft = normalizeEquivalentValue(left)?.toLowerCase();
|
|
25924
|
+
const normalizedRight = normalizeEquivalentValue(right)?.toLowerCase();
|
|
25925
|
+
return normalizedLeft !== void 0 && normalizedLeft === normalizedRight;
|
|
25926
|
+
}
|
|
25927
|
+
function classifyToolAction(input2) {
|
|
25928
|
+
const itemType = input2.itemType ?? void 0;
|
|
25929
|
+
const kind = asTrimmedString(input2.data?.["kind"])?.toLowerCase();
|
|
25930
|
+
const title = asTrimmedString(input2.title)?.toLowerCase();
|
|
25931
|
+
if (itemType === "command_execution" || kind === "execute" || title === "terminal") {
|
|
25932
|
+
return "command";
|
|
25933
|
+
}
|
|
25934
|
+
if (kind === "read" || title === "read file") {
|
|
25935
|
+
return "read";
|
|
25936
|
+
}
|
|
25937
|
+
if (itemType === "file_change" || kind === "edit" || kind === "move" || kind === "delete" || kind === "write") {
|
|
25938
|
+
return "file_change";
|
|
25939
|
+
}
|
|
25940
|
+
if (itemType === "web_search" || kind === "search" || title === "find" || title === "grep") {
|
|
25941
|
+
return "search";
|
|
25942
|
+
}
|
|
25943
|
+
return "other";
|
|
25944
|
+
}
|
|
25945
|
+
function canonicalItemTypeFromAcpToolKind(kind) {
|
|
25946
|
+
switch (kind) {
|
|
25947
|
+
case "execute":
|
|
25948
|
+
return "command_execution";
|
|
25949
|
+
case "edit":
|
|
25950
|
+
case "delete":
|
|
25951
|
+
case "move":
|
|
25952
|
+
return "file_change";
|
|
25953
|
+
case "search":
|
|
25954
|
+
case "fetch":
|
|
25955
|
+
return "web_search";
|
|
25956
|
+
default:
|
|
25957
|
+
return "dynamic_tool_call";
|
|
25958
|
+
}
|
|
25959
|
+
}
|
|
25960
|
+
function deriveToolActivityPresentation(input2) {
|
|
25961
|
+
const title = asTrimmedString(input2.title);
|
|
25962
|
+
const detail = stripTrailingExitCode(asTrimmedString(input2.detail));
|
|
25963
|
+
const fallbackSummary = asTrimmedString(input2.fallbackSummary) ?? "Tool";
|
|
25964
|
+
const data = isRecord3(input2.data) ? input2.data : void 0;
|
|
25965
|
+
const command = extractToolCommand(data, title);
|
|
25966
|
+
const primaryPath = extractPrimaryPath(data);
|
|
25967
|
+
const action = classifyToolAction({
|
|
25968
|
+
itemType: input2.itemType,
|
|
25969
|
+
title,
|
|
25970
|
+
data
|
|
25971
|
+
});
|
|
25972
|
+
if (action === "command") {
|
|
25973
|
+
return {
|
|
25974
|
+
summary: "Ran command",
|
|
25975
|
+
...command ? { detail: command } : {}
|
|
25976
|
+
};
|
|
25977
|
+
}
|
|
25978
|
+
if (action === "read") {
|
|
25979
|
+
if (primaryPath) {
|
|
25980
|
+
return {
|
|
25981
|
+
summary: "Read file",
|
|
25982
|
+
detail: primaryPath
|
|
25983
|
+
};
|
|
25984
|
+
}
|
|
25985
|
+
return {
|
|
25986
|
+
summary: "Read file"
|
|
25987
|
+
};
|
|
25988
|
+
}
|
|
25989
|
+
if (action === "file_change") {
|
|
25990
|
+
return {
|
|
25991
|
+
summary: "Changed files",
|
|
25992
|
+
...primaryPath ? { detail: primaryPath } : {}
|
|
25993
|
+
};
|
|
25994
|
+
}
|
|
25995
|
+
if (action === "search") {
|
|
25996
|
+
const rawInput = isRecord3(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
25997
|
+
const query = asTrimmedString(rawInput?.["query"]) ?? asTrimmedString(rawInput?.["pattern"]) ?? asTrimmedString(rawInput?.["searchTerm"]);
|
|
25998
|
+
return {
|
|
25999
|
+
summary: "Searched files",
|
|
26000
|
+
...query ? { detail: query } : {}
|
|
26001
|
+
};
|
|
26002
|
+
}
|
|
26003
|
+
if (detail && !isEquivalent(detail, title) && !isEquivalent(detail, fallbackSummary)) {
|
|
26004
|
+
return {
|
|
26005
|
+
summary: title ?? fallbackSummary,
|
|
26006
|
+
detail
|
|
26007
|
+
};
|
|
26008
|
+
}
|
|
26009
|
+
return {
|
|
26010
|
+
summary: title ?? fallbackSummary
|
|
26011
|
+
};
|
|
26012
|
+
}
|
|
26013
|
+
|
|
25790
26014
|
// ../../packages/ycodium-acp-executor/src/events.ts
|
|
25791
26015
|
function canonicalRequestTypeFromAcpKind(kind) {
|
|
25792
26016
|
switch (kind) {
|
|
@@ -25842,21 +26066,6 @@ function fileChangesFromAcpPermission(permissionRequest) {
|
|
|
25842
26066
|
}) : [];
|
|
25843
26067
|
return paths.length > 0 ? paths.map((path) => ({ path, omitted: "unavailable" })) : void 0;
|
|
25844
26068
|
}
|
|
25845
|
-
function canonicalItemTypeFromAcpToolKind(kind) {
|
|
25846
|
-
switch (kind) {
|
|
25847
|
-
case "execute":
|
|
25848
|
-
return "command_execution";
|
|
25849
|
-
case "edit":
|
|
25850
|
-
case "delete":
|
|
25851
|
-
case "move":
|
|
25852
|
-
return "file_change";
|
|
25853
|
-
case "search":
|
|
25854
|
-
case "fetch":
|
|
25855
|
-
return "web_search";
|
|
25856
|
-
default:
|
|
25857
|
-
return "dynamic_tool_call";
|
|
25858
|
-
}
|
|
25859
|
-
}
|
|
25860
26069
|
function runtimeItemStatusFromAcpToolStatus(status) {
|
|
25861
26070
|
switch (status) {
|
|
25862
26071
|
case "pending":
|
|
@@ -25928,6 +26137,7 @@ function makeAcpPlanUpdatedEvent(input2) {
|
|
|
25928
26137
|
}
|
|
25929
26138
|
function makeAcpToolCallEvent(input2) {
|
|
25930
26139
|
const runtimeStatus = runtimeItemStatusFromAcpToolStatus(input2.toolCall.status);
|
|
26140
|
+
const { data } = input2.toolCall;
|
|
25931
26141
|
return {
|
|
25932
26142
|
type: input2.toolCall.status === "completed" || input2.toolCall.status === "failed" ? "item.completed" : "item.updated",
|
|
25933
26143
|
...input2.stamp,
|
|
@@ -25940,7 +26150,7 @@ function makeAcpToolCallEvent(input2) {
|
|
|
25940
26150
|
...runtimeStatus ? { status: runtimeStatus } : {},
|
|
25941
26151
|
...input2.toolCall.title ? { title: input2.toolCall.title } : {},
|
|
25942
26152
|
...input2.toolCall.detail ? { detail: input2.toolCall.detail } : {},
|
|
25943
|
-
...Object.keys(
|
|
26153
|
+
...Object.keys(data).length > 0 ? { data } : {}
|
|
25944
26154
|
},
|
|
25945
26155
|
raw: {
|
|
25946
26156
|
source: "acp.jsonrpc",
|
|
@@ -25984,7 +26194,7 @@ function makeAcpContentDeltaEvent(input2) {
|
|
|
25984
26194
|
}
|
|
25985
26195
|
|
|
25986
26196
|
// ../../packages/ycodium-acp-executor/src/config-options.ts
|
|
25987
|
-
function
|
|
26197
|
+
function isRecord4(value) {
|
|
25988
26198
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25989
26199
|
}
|
|
25990
26200
|
function asString(value) {
|
|
@@ -26003,7 +26213,7 @@ function flattenChoices(rawOptions, currentValue) {
|
|
|
26003
26213
|
const out = [];
|
|
26004
26214
|
const seen = /* @__PURE__ */ new Set();
|
|
26005
26215
|
const push = (entry) => {
|
|
26006
|
-
if (!
|
|
26216
|
+
if (!isRecord4(entry)) return;
|
|
26007
26217
|
const value = asString(entry["value"]);
|
|
26008
26218
|
if (value === void 0 || seen.has(value)) return;
|
|
26009
26219
|
seen.add(value);
|
|
@@ -26018,7 +26228,7 @@ function flattenChoices(rawOptions, currentValue) {
|
|
|
26018
26228
|
});
|
|
26019
26229
|
};
|
|
26020
26230
|
for (const entry of rawOptions) {
|
|
26021
|
-
if (
|
|
26231
|
+
if (isRecord4(entry) && Array.isArray(entry["options"])) {
|
|
26022
26232
|
for (const nested of entry["options"]) push(nested);
|
|
26023
26233
|
continue;
|
|
26024
26234
|
}
|
|
@@ -26028,7 +26238,7 @@ function flattenChoices(rawOptions, currentValue) {
|
|
|
26028
26238
|
}
|
|
26029
26239
|
function findAcpEffortConfig(configOptions) {
|
|
26030
26240
|
if (!Array.isArray(configOptions)) return void 0;
|
|
26031
|
-
const candidates = configOptions.filter(
|
|
26241
|
+
const candidates = configOptions.filter(isRecord4).filter((option) => normalizedField(option, "type") === "select").filter(looksLikeEffortOption);
|
|
26032
26242
|
if (candidates.length === 0) return void 0;
|
|
26033
26243
|
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];
|
|
26034
26244
|
if (picked === void 0) return void 0;
|
|
@@ -26044,7 +26254,7 @@ function findAcpEffortConfig(configOptions) {
|
|
|
26044
26254
|
}
|
|
26045
26255
|
function acpModelChoicesFromConfigOptions(configOptions) {
|
|
26046
26256
|
if (!Array.isArray(configOptions)) return void 0;
|
|
26047
|
-
const records = configOptions.filter(
|
|
26257
|
+
const records = configOptions.filter(isRecord4);
|
|
26048
26258
|
const modelOption = records.find((option) => normalizedField(option, "category") === "model") ?? records.find(
|
|
26049
26259
|
(option) => normalizedField(option, "id") === "model" && normalizedField(option, "type") === "select"
|
|
26050
26260
|
);
|
|
@@ -26053,12 +26263,12 @@ function acpModelChoicesFromConfigOptions(configOptions) {
|
|
|
26053
26263
|
return flattenChoices(modelOption["options"], asString(modelOption["currentValue"])?.trim());
|
|
26054
26264
|
}
|
|
26055
26265
|
function acpModelChoicesFromSessionModels(models) {
|
|
26056
|
-
if (!
|
|
26266
|
+
if (!isRecord4(models) || !Array.isArray(models["availableModels"])) return void 0;
|
|
26057
26267
|
const currentModelId = asString(models["currentModelId"])?.trim();
|
|
26058
26268
|
const out = [];
|
|
26059
26269
|
const seen = /* @__PURE__ */ new Set();
|
|
26060
26270
|
for (const entry of models["availableModels"]) {
|
|
26061
|
-
if (!
|
|
26271
|
+
if (!isRecord4(entry)) continue;
|
|
26062
26272
|
const value = asString(entry["modelId"])?.trim();
|
|
26063
26273
|
if (!value || seen.has(value)) continue;
|
|
26064
26274
|
seen.add(value);
|
|
@@ -26076,23 +26286,23 @@ function acpModelChoicesFromSessionModels(models) {
|
|
|
26076
26286
|
}
|
|
26077
26287
|
|
|
26078
26288
|
// ../../packages/ycodium-acp-executor/src/runtime-mode.ts
|
|
26079
|
-
function
|
|
26289
|
+
function isRecord5(value) {
|
|
26080
26290
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26081
26291
|
}
|
|
26082
26292
|
function asString2(value) {
|
|
26083
26293
|
return typeof value === "string" ? value : void 0;
|
|
26084
26294
|
}
|
|
26085
26295
|
function acpAvailableModes(setup) {
|
|
26086
|
-
if (!
|
|
26296
|
+
if (!isRecord5(setup)) return [];
|
|
26087
26297
|
const out = [];
|
|
26088
26298
|
const seen = /* @__PURE__ */ new Set();
|
|
26089
26299
|
const push = (entry) => {
|
|
26090
|
-
if (!
|
|
26300
|
+
if (!isRecord5(entry)) return;
|
|
26091
26301
|
const id = (asString2(entry["id"]) ?? asString2(entry["value"]))?.trim();
|
|
26092
26302
|
if (!id || seen.has(id)) return;
|
|
26093
26303
|
seen.add(id);
|
|
26094
26304
|
const meta3 = entry["_meta"];
|
|
26095
|
-
const kind =
|
|
26305
|
+
const kind = isRecord5(meta3) ? asString2(meta3["kind"])?.trim().toLowerCase() : void 0;
|
|
26096
26306
|
const name = asString2(entry["name"])?.trim();
|
|
26097
26307
|
const description = asString2(entry["description"])?.trim();
|
|
26098
26308
|
out.push({
|
|
@@ -26103,13 +26313,13 @@ function acpAvailableModes(setup) {
|
|
|
26103
26313
|
});
|
|
26104
26314
|
};
|
|
26105
26315
|
const modes = setup["modes"];
|
|
26106
|
-
if (
|
|
26316
|
+
if (isRecord5(modes) && Array.isArray(modes["availableModes"])) {
|
|
26107
26317
|
for (const entry of modes["availableModes"]) push(entry);
|
|
26108
26318
|
}
|
|
26109
26319
|
const configOptions = setup["configOptions"];
|
|
26110
26320
|
if (Array.isArray(configOptions)) {
|
|
26111
26321
|
for (const option of configOptions) {
|
|
26112
|
-
if (!
|
|
26322
|
+
if (!isRecord5(option)) continue;
|
|
26113
26323
|
if (asString2(option["category"])?.trim().toLowerCase() !== "mode") continue;
|
|
26114
26324
|
if (!Array.isArray(option["options"])) continue;
|
|
26115
26325
|
for (const entry of option["options"]) push(entry);
|
|
@@ -26118,11 +26328,11 @@ function acpAvailableModes(setup) {
|
|
|
26118
26328
|
return out;
|
|
26119
26329
|
}
|
|
26120
26330
|
function acpModeConfigId(setup) {
|
|
26121
|
-
if (!
|
|
26331
|
+
if (!isRecord5(setup)) return void 0;
|
|
26122
26332
|
const configOptions = setup["configOptions"];
|
|
26123
26333
|
if (!Array.isArray(configOptions)) return void 0;
|
|
26124
26334
|
for (const option of configOptions) {
|
|
26125
|
-
if (!
|
|
26335
|
+
if (!isRecord5(option)) continue;
|
|
26126
26336
|
if (asString2(option["category"])?.trim().toLowerCase() !== "mode") continue;
|
|
26127
26337
|
const id = asString2(option["id"])?.trim();
|
|
26128
26338
|
if (id) return id;
|
|
@@ -26130,16 +26340,16 @@ function acpModeConfigId(setup) {
|
|
|
26130
26340
|
return void 0;
|
|
26131
26341
|
}
|
|
26132
26342
|
function acpCurrentModeId(setup) {
|
|
26133
|
-
if (!
|
|
26343
|
+
if (!isRecord5(setup)) return void 0;
|
|
26134
26344
|
const modes = setup["modes"];
|
|
26135
|
-
if (
|
|
26345
|
+
if (isRecord5(modes)) {
|
|
26136
26346
|
const current = asString2(modes["currentModeId"])?.trim();
|
|
26137
26347
|
if (current) return current;
|
|
26138
26348
|
}
|
|
26139
26349
|
const configOptions = setup["configOptions"];
|
|
26140
26350
|
if (Array.isArray(configOptions)) {
|
|
26141
26351
|
for (const option of configOptions) {
|
|
26142
|
-
if (!
|
|
26352
|
+
if (!isRecord5(option)) continue;
|
|
26143
26353
|
if (asString2(option["category"])?.trim().toLowerCase() !== "mode") continue;
|
|
26144
26354
|
const current = asString2(option["currentValue"])?.trim();
|
|
26145
26355
|
if (current) return current;
|
|
@@ -26253,215 +26463,6 @@ var Mutex = class {
|
|
|
26253
26463
|
}
|
|
26254
26464
|
};
|
|
26255
26465
|
|
|
26256
|
-
// ../../packages/ycodium-acp-executor/src/util.ts
|
|
26257
|
-
function isRecord5(value) {
|
|
26258
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26259
|
-
}
|
|
26260
|
-
function asTrimmedString(value) {
|
|
26261
|
-
if (typeof value !== "string") {
|
|
26262
|
-
return void 0;
|
|
26263
|
-
}
|
|
26264
|
-
const trimmed = value.trim();
|
|
26265
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
26266
|
-
}
|
|
26267
|
-
|
|
26268
|
-
// ../../packages/ycodium-acp-executor/src/tool-presentation.ts
|
|
26269
|
-
function normalizeCommandValue(value) {
|
|
26270
|
-
const direct = asTrimmedString(value);
|
|
26271
|
-
if (direct) {
|
|
26272
|
-
return direct;
|
|
26273
|
-
}
|
|
26274
|
-
if (!Array.isArray(value)) {
|
|
26275
|
-
return void 0;
|
|
26276
|
-
}
|
|
26277
|
-
const parts = [];
|
|
26278
|
-
for (const entry of value) {
|
|
26279
|
-
const part = asTrimmedString(entry);
|
|
26280
|
-
if (part !== void 0) {
|
|
26281
|
-
parts.push(part);
|
|
26282
|
-
}
|
|
26283
|
-
}
|
|
26284
|
-
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
26285
|
-
}
|
|
26286
|
-
function stripTrailingExitCode(value) {
|
|
26287
|
-
const trimmed = value?.trim();
|
|
26288
|
-
if (!trimmed) {
|
|
26289
|
-
return void 0;
|
|
26290
|
-
}
|
|
26291
|
-
const match = /^(?<output>[\s\S]*?)(?:\s*<exited with exit code \d+>)\s*$/iu.exec(trimmed);
|
|
26292
|
-
const output2 = match?.groups?.output?.trim() ?? trimmed;
|
|
26293
|
-
return output2.length > 0 ? output2 : void 0;
|
|
26294
|
-
}
|
|
26295
|
-
function extractCommandFromTitle(title) {
|
|
26296
|
-
if (!title) {
|
|
26297
|
-
return void 0;
|
|
26298
|
-
}
|
|
26299
|
-
const backtickMatch = /`([^`]+)`/u.exec(title);
|
|
26300
|
-
return backtickMatch?.[1]?.trim() || void 0;
|
|
26301
|
-
}
|
|
26302
|
-
function extractToolCommand(data, title) {
|
|
26303
|
-
const item = isRecord5(data?.["item"]) ? data["item"] : void 0;
|
|
26304
|
-
const itemInput = item && isRecord5(item["input"]) ? item["input"] : void 0;
|
|
26305
|
-
const itemResult = item && isRecord5(item["result"]) ? item["result"] : void 0;
|
|
26306
|
-
const rawInput = isRecord5(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
26307
|
-
const dataInput = isRecord5(data?.["input"]) ? data["input"] : void 0;
|
|
26308
|
-
const candidates = [
|
|
26309
|
-
normalizeCommandValue(item?.["command"]),
|
|
26310
|
-
normalizeCommandValue(itemInput?.["command"]),
|
|
26311
|
-
normalizeCommandValue(itemResult?.["command"]),
|
|
26312
|
-
normalizeCommandValue(data?.["command"]),
|
|
26313
|
-
normalizeCommandValue(dataInput?.["command"]),
|
|
26314
|
-
normalizeCommandValue(rawInput?.["command"])
|
|
26315
|
-
];
|
|
26316
|
-
const direct = candidates.find((candidate) => candidate !== void 0);
|
|
26317
|
-
if (direct) {
|
|
26318
|
-
return direct;
|
|
26319
|
-
}
|
|
26320
|
-
const executable = asTrimmedString(rawInput?.["executable"]);
|
|
26321
|
-
const args = normalizeCommandValue(rawInput?.["args"]);
|
|
26322
|
-
if (executable && args) {
|
|
26323
|
-
return `${executable} ${args}`;
|
|
26324
|
-
}
|
|
26325
|
-
if (executable) {
|
|
26326
|
-
return executable;
|
|
26327
|
-
}
|
|
26328
|
-
return extractCommandFromTitle(title);
|
|
26329
|
-
}
|
|
26330
|
-
function maybePathLike(value) {
|
|
26331
|
-
if (!value) {
|
|
26332
|
-
return void 0;
|
|
26333
|
-
}
|
|
26334
|
-
if (value.includes("/") || value.includes("\\") || value.startsWith(".") || /\.(?:[a-z0-9]{1,12})$/iu.test(value)) {
|
|
26335
|
-
return value;
|
|
26336
|
-
}
|
|
26337
|
-
return void 0;
|
|
26338
|
-
}
|
|
26339
|
-
function collectPaths(value, paths, seen, depth) {
|
|
26340
|
-
if (depth > 4 || paths.length >= 8) {
|
|
26341
|
-
return;
|
|
26342
|
-
}
|
|
26343
|
-
if (Array.isArray(value)) {
|
|
26344
|
-
for (const entry of value) {
|
|
26345
|
-
collectPaths(entry, paths, seen, depth + 1);
|
|
26346
|
-
if (paths.length >= 8) {
|
|
26347
|
-
return;
|
|
26348
|
-
}
|
|
26349
|
-
}
|
|
26350
|
-
return;
|
|
26351
|
-
}
|
|
26352
|
-
if (!isRecord5(value)) {
|
|
26353
|
-
return;
|
|
26354
|
-
}
|
|
26355
|
-
for (const key of ["path", "filePath", "relativePath", "filename", "newPath", "oldPath"]) {
|
|
26356
|
-
const candidate = maybePathLike(asTrimmedString(value[key]));
|
|
26357
|
-
if (!candidate || seen.has(candidate)) {
|
|
26358
|
-
continue;
|
|
26359
|
-
}
|
|
26360
|
-
seen.add(candidate);
|
|
26361
|
-
paths.push(candidate);
|
|
26362
|
-
if (paths.length >= 8) {
|
|
26363
|
-
return;
|
|
26364
|
-
}
|
|
26365
|
-
}
|
|
26366
|
-
for (const nestedKey of ["locations", "item", "input", "result", "rawInput", "data", "changes"]) {
|
|
26367
|
-
if (!(nestedKey in value)) {
|
|
26368
|
-
continue;
|
|
26369
|
-
}
|
|
26370
|
-
collectPaths(value[nestedKey], paths, seen, depth + 1);
|
|
26371
|
-
if (paths.length >= 8) {
|
|
26372
|
-
return;
|
|
26373
|
-
}
|
|
26374
|
-
}
|
|
26375
|
-
}
|
|
26376
|
-
function extractPrimaryPath(data) {
|
|
26377
|
-
const paths = [];
|
|
26378
|
-
collectPaths(data, paths, /* @__PURE__ */ new Set(), 0);
|
|
26379
|
-
return paths[0];
|
|
26380
|
-
}
|
|
26381
|
-
function normalizeEquivalentValue(value) {
|
|
26382
|
-
const trimmed = asTrimmedString(value);
|
|
26383
|
-
if (!trimmed) {
|
|
26384
|
-
return void 0;
|
|
26385
|
-
}
|
|
26386
|
-
return trimmed.replace(/\s+/gu, " ").replace(/\s+(?:complete|completed|started)\s*$/iu, "").trim();
|
|
26387
|
-
}
|
|
26388
|
-
function isEquivalent(left, right) {
|
|
26389
|
-
const normalizedLeft = normalizeEquivalentValue(left)?.toLowerCase();
|
|
26390
|
-
const normalizedRight = normalizeEquivalentValue(right)?.toLowerCase();
|
|
26391
|
-
return normalizedLeft !== void 0 && normalizedLeft === normalizedRight;
|
|
26392
|
-
}
|
|
26393
|
-
function classifyToolAction(input2) {
|
|
26394
|
-
const itemType = input2.itemType ?? void 0;
|
|
26395
|
-
const kind = asTrimmedString(input2.data?.["kind"])?.toLowerCase();
|
|
26396
|
-
const title = asTrimmedString(input2.title)?.toLowerCase();
|
|
26397
|
-
if (itemType === "command_execution" || kind === "execute" || title === "terminal") {
|
|
26398
|
-
return "command";
|
|
26399
|
-
}
|
|
26400
|
-
if (kind === "read" || title === "read file") {
|
|
26401
|
-
return "read";
|
|
26402
|
-
}
|
|
26403
|
-
if (itemType === "file_change" || kind === "edit" || kind === "move" || kind === "delete" || kind === "write") {
|
|
26404
|
-
return "file_change";
|
|
26405
|
-
}
|
|
26406
|
-
if (itemType === "web_search" || kind === "search" || title === "find" || title === "grep") {
|
|
26407
|
-
return "search";
|
|
26408
|
-
}
|
|
26409
|
-
return "other";
|
|
26410
|
-
}
|
|
26411
|
-
function deriveToolActivityPresentation(input2) {
|
|
26412
|
-
const title = asTrimmedString(input2.title);
|
|
26413
|
-
const detail = stripTrailingExitCode(asTrimmedString(input2.detail));
|
|
26414
|
-
const fallbackSummary = asTrimmedString(input2.fallbackSummary) ?? "Tool";
|
|
26415
|
-
const data = isRecord5(input2.data) ? input2.data : void 0;
|
|
26416
|
-
const command = extractToolCommand(data, title);
|
|
26417
|
-
const primaryPath = extractPrimaryPath(data);
|
|
26418
|
-
const action = classifyToolAction({
|
|
26419
|
-
itemType: input2.itemType,
|
|
26420
|
-
title,
|
|
26421
|
-
data
|
|
26422
|
-
});
|
|
26423
|
-
if (action === "command") {
|
|
26424
|
-
return {
|
|
26425
|
-
summary: "Ran command",
|
|
26426
|
-
...command ? { detail: command } : {}
|
|
26427
|
-
};
|
|
26428
|
-
}
|
|
26429
|
-
if (action === "read") {
|
|
26430
|
-
if (primaryPath) {
|
|
26431
|
-
return {
|
|
26432
|
-
summary: "Read file",
|
|
26433
|
-
detail: primaryPath
|
|
26434
|
-
};
|
|
26435
|
-
}
|
|
26436
|
-
return {
|
|
26437
|
-
summary: "Read file"
|
|
26438
|
-
};
|
|
26439
|
-
}
|
|
26440
|
-
if (action === "file_change") {
|
|
26441
|
-
return {
|
|
26442
|
-
summary: "Changed files",
|
|
26443
|
-
...primaryPath ? { detail: primaryPath } : {}
|
|
26444
|
-
};
|
|
26445
|
-
}
|
|
26446
|
-
if (action === "search") {
|
|
26447
|
-
const rawInput = isRecord5(data?.["rawInput"]) ? data["rawInput"] : void 0;
|
|
26448
|
-
const query = asTrimmedString(rawInput?.["query"]) ?? asTrimmedString(rawInput?.["pattern"]) ?? asTrimmedString(rawInput?.["searchTerm"]);
|
|
26449
|
-
return {
|
|
26450
|
-
summary: "Searched files",
|
|
26451
|
-
...query ? { detail: query } : {}
|
|
26452
|
-
};
|
|
26453
|
-
}
|
|
26454
|
-
if (detail && !isEquivalent(detail, title) && !isEquivalent(detail, fallbackSummary)) {
|
|
26455
|
-
return {
|
|
26456
|
-
summary: title ?? fallbackSummary,
|
|
26457
|
-
detail
|
|
26458
|
-
};
|
|
26459
|
-
}
|
|
26460
|
-
return {
|
|
26461
|
-
summary: title ?? fallbackSummary
|
|
26462
|
-
};
|
|
26463
|
-
}
|
|
26464
|
-
|
|
26465
26466
|
// ../../packages/ycodium-acp-executor/src/runtime-model.ts
|
|
26466
26467
|
function extractModelConfigId(sessionResponse) {
|
|
26467
26468
|
const configOptions = sessionResponse.configOptions;
|
|
@@ -26492,11 +26493,11 @@ function collectSessionConfigOptionValues(configOption) {
|
|
|
26492
26493
|
);
|
|
26493
26494
|
}
|
|
26494
26495
|
function collectSessionModelIds(models) {
|
|
26495
|
-
if (!
|
|
26496
|
+
if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
|
|
26496
26497
|
return [];
|
|
26497
26498
|
}
|
|
26498
26499
|
return models["availableModels"].flatMap(
|
|
26499
|
-
(model) =>
|
|
26500
|
+
(model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
|
|
26500
26501
|
);
|
|
26501
26502
|
}
|
|
26502
26503
|
function catalogModelLastSegment(value) {
|
|
@@ -26568,7 +26569,7 @@ function parseAvailableCommandsUpdate(params) {
|
|
|
26568
26569
|
}
|
|
26569
26570
|
const commands = [];
|
|
26570
26571
|
for (const command of availableCommands) {
|
|
26571
|
-
if (!
|
|
26572
|
+
if (!isRecord3(command)) {
|
|
26572
26573
|
continue;
|
|
26573
26574
|
}
|
|
26574
26575
|
const name = typeof command["name"] === "string" ? command["name"].trim() : "";
|
|
@@ -26576,7 +26577,7 @@ function parseAvailableCommandsUpdate(params) {
|
|
|
26576
26577
|
continue;
|
|
26577
26578
|
}
|
|
26578
26579
|
const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
|
|
26579
|
-
const input2 =
|
|
26580
|
+
const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
|
|
26580
26581
|
const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
|
|
26581
26582
|
commands.push({
|
|
26582
26583
|
name,
|
|
@@ -26638,7 +26639,7 @@ function extractCommandFromTitle2(title) {
|
|
|
26638
26639
|
return match?.[1]?.trim() || void 0;
|
|
26639
26640
|
}
|
|
26640
26641
|
function extractToolCallCommand(rawInput, title) {
|
|
26641
|
-
if (
|
|
26642
|
+
if (isRecord3(rawInput)) {
|
|
26642
26643
|
const directCommand = normalizeCommandValue2(rawInput["command"]);
|
|
26643
26644
|
if (directCommand) {
|
|
26644
26645
|
return directCommand;
|
|
@@ -26665,7 +26666,7 @@ function boundToolCallOutputText(text) {
|
|
|
26665
26666
|
}
|
|
26666
26667
|
var RAW_OUTPUT_TEXT_FIELDS = ["content", "stdout", "stderr", "output"];
|
|
26667
26668
|
function boundToolCallRawOutput(rawOutput) {
|
|
26668
|
-
if (!
|
|
26669
|
+
if (!isRecord3(rawOutput)) {
|
|
26669
26670
|
return rawOutput;
|
|
26670
26671
|
}
|
|
26671
26672
|
let changed = false;
|
|
@@ -26723,21 +26724,6 @@ function extractTextContentFromToolCallContent(content) {
|
|
|
26723
26724
|
function normalizeToolKind(kind) {
|
|
26724
26725
|
return typeof kind === "string" && kind.trim().length > 0 ? kind.trim() : void 0;
|
|
26725
26726
|
}
|
|
26726
|
-
function canonicalItemTypeFromAcpToolKind2(kind) {
|
|
26727
|
-
switch (kind) {
|
|
26728
|
-
case "execute":
|
|
26729
|
-
return "command_execution";
|
|
26730
|
-
case "edit":
|
|
26731
|
-
case "delete":
|
|
26732
|
-
case "move":
|
|
26733
|
-
return "file_change";
|
|
26734
|
-
case "search":
|
|
26735
|
-
case "fetch":
|
|
26736
|
-
return "web_search";
|
|
26737
|
-
default:
|
|
26738
|
-
return "dynamic_tool_call";
|
|
26739
|
-
}
|
|
26740
|
-
}
|
|
26741
26727
|
function makeToolCallState(input2, options2) {
|
|
26742
26728
|
const toolCallId = typeof input2.toolCallId === "string" ? input2.toolCallId.trim() : "";
|
|
26743
26729
|
if (!toolCallId) {
|
|
@@ -26753,6 +26739,10 @@ function makeToolCallState(input2, options2) {
|
|
|
26753
26739
|
if (kind) {
|
|
26754
26740
|
data["kind"] = kind;
|
|
26755
26741
|
}
|
|
26742
|
+
const name = readAcpText(input2, "name");
|
|
26743
|
+
if (name) {
|
|
26744
|
+
data["name"] = name;
|
|
26745
|
+
}
|
|
26756
26746
|
if (command) {
|
|
26757
26747
|
data["command"] = command;
|
|
26758
26748
|
}
|
|
@@ -26771,7 +26761,7 @@ function makeToolCallState(input2, options2) {
|
|
|
26771
26761
|
const fallbackDetail = command ?? normalizedTitle ?? textContent;
|
|
26772
26762
|
const hasPresentationSeed = title !== void 0 || kind !== void 0 || command !== void 0 || normalizedTitle !== void 0 || textContent !== void 0;
|
|
26773
26763
|
const presentation = hasPresentationSeed ? deriveToolActivityPresentation({
|
|
26774
|
-
itemType:
|
|
26764
|
+
itemType: canonicalItemTypeFromAcpToolKind(kind),
|
|
26775
26765
|
title,
|
|
26776
26766
|
detail: fallbackDetail,
|
|
26777
26767
|
data,
|
|
@@ -26877,7 +26867,7 @@ function readAcpText(source, key) {
|
|
|
26877
26867
|
}
|
|
26878
26868
|
function textFromContentBlocks(blocks) {
|
|
26879
26869
|
const parts = blocks.flatMap(
|
|
26880
|
-
(block) =>
|
|
26870
|
+
(block) => isRecord3(block) && block["type"] === "text" && typeof block["text"] === "string" ? [block["text"]] : []
|
|
26881
26871
|
);
|
|
26882
26872
|
const joined = parts.join("");
|
|
26883
26873
|
return joined.trim().length > 0 ? joined : void 0;
|
|
@@ -26902,7 +26892,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
26902
26892
|
const entries = Array.isArray(upd["entries"]) ? upd["entries"] : [];
|
|
26903
26893
|
const plan = entries.map((entry, index) => ({
|
|
26904
26894
|
step: readAcpText(entry, "content") ?? `Step ${index + 1}`,
|
|
26905
|
-
status: normalizePlanStepStatus(
|
|
26895
|
+
status: normalizePlanStepStatus(isRecord3(entry) ? entry["status"] : void 0)
|
|
26906
26896
|
}));
|
|
26907
26897
|
if (plan.length > 0) {
|
|
26908
26898
|
events.push({
|
|
@@ -26920,6 +26910,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
26920
26910
|
const toolCall = makeToolCallState(
|
|
26921
26911
|
{
|
|
26922
26912
|
toolCallId: upd["toolCallId"],
|
|
26913
|
+
name: upd["name"],
|
|
26923
26914
|
title: typeof upd["title"] === "string" ? upd["title"] : void 0,
|
|
26924
26915
|
kind: upd["kind"],
|
|
26925
26916
|
status: upd["status"],
|
|
@@ -26941,7 +26932,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
26941
26932
|
}
|
|
26942
26933
|
case "agent_message_chunk":
|
|
26943
26934
|
case "agent_thought_chunk": {
|
|
26944
|
-
const content =
|
|
26935
|
+
const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
|
|
26945
26936
|
const contentType = content?.["type"];
|
|
26946
26937
|
const streamKind = kind === "agent_thought_chunk" ? "reasoning_text" : "assistant_text";
|
|
26947
26938
|
if (contentType === "text") {
|
|
@@ -26981,7 +26972,7 @@ function parseSessionUpdateEvent(params) {
|
|
|
26981
26972
|
}
|
|
26982
26973
|
case "compaction_summary_chunk": {
|
|
26983
26974
|
const compactionId = readAcpText(upd, "compactionId");
|
|
26984
|
-
const content =
|
|
26975
|
+
const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
|
|
26985
26976
|
const text = content?.["type"] === "text" ? content["text"] : void 0;
|
|
26986
26977
|
if (compactionId === void 0 || typeof text !== "string" || text.length === 0) break;
|
|
26987
26978
|
events.push({ _tag: "CompactionSummaryChunk", compactionId, text });
|
|
@@ -27013,7 +27004,7 @@ function normalizeModelId(value) {
|
|
|
27013
27004
|
return value?.trim() || void 0;
|
|
27014
27005
|
}
|
|
27015
27006
|
function modelSelectionStateFromSetup(setup) {
|
|
27016
|
-
const sessionModels =
|
|
27007
|
+
const sessionModels = isRecord3(setup.models) ? setup.models : void 0;
|
|
27017
27008
|
const modelConfigId = extractModelConfigId(setup);
|
|
27018
27009
|
const strategy = sessionModels === void 0 && modelConfigId !== void 0 ? "config-option" : "session/set_model";
|
|
27019
27010
|
const modelConfigOption = modelConfigId === void 0 ? void 0 : findSessionConfigOption(setup.configOptions, modelConfigId);
|
|
@@ -28258,7 +28249,7 @@ function createAcpExecutor(options2) {
|
|
|
28258
28249
|
pendingUserInputs.delete(requestId);
|
|
28259
28250
|
pending.resolve({
|
|
28260
28251
|
kind: "answered",
|
|
28261
|
-
answers:
|
|
28252
|
+
answers: isRecord3(answers) ? answers : {}
|
|
28262
28253
|
});
|
|
28263
28254
|
};
|
|
28264
28255
|
const dispose = async () => {
|
|
@@ -28380,9 +28371,9 @@ async function openAcpProbeHandshake(input2) {
|
|
|
28380
28371
|
}
|
|
28381
28372
|
}
|
|
28382
28373
|
function acpAgentVersion(initializeResult) {
|
|
28383
|
-
if (!
|
|
28374
|
+
if (!isRecord3(initializeResult)) return null;
|
|
28384
28375
|
const agentInfo = initializeResult["agentInfo"];
|
|
28385
|
-
return
|
|
28376
|
+
return isRecord3(agentInfo) ? asTrimmedString(agentInfo["version"]) ?? null : null;
|
|
28386
28377
|
}
|
|
28387
28378
|
var MAX_VERSION_OUTPUT_BYTES = 64 * 1024;
|
|
28388
28379
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-antigravity",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2944",
|
|
4
4
|
"description": "Google Antigravity executor: runs the Antigravity agent over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
32
|
"vite-plus": "0.2.2",
|
|
33
33
|
"yauzl": "^3.4.0",
|
|
34
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
35
|
-
"ycodium-acp-executor": "0.2.
|
|
34
|
+
"@ycodium-ai/plugin-api": "0.2.2944",
|
|
35
|
+
"ycodium-acp-executor": "0.2.2944",
|
|
36
36
|
"ycodium-executor-testing": "0.0.0"
|
|
37
37
|
},
|
|
38
38
|
"ycodium": {
|