@ycodium-ai/agent-grok 0.2.2936 → 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.
Files changed (2) hide show
  1. package/dist/index.js +251 -260
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -24324,6 +24324,230 @@ var UnboundedEventStream = class {
24324
24324
  }
24325
24325
  };
24326
24326
 
24327
+ // ../../packages/ycodium-acp-executor/src/util.ts
24328
+ function isRecord3(value) {
24329
+ return typeof value === "object" && value !== null && !Array.isArray(value);
24330
+ }
24331
+ function asTrimmedString(value) {
24332
+ if (typeof value !== "string") {
24333
+ return void 0;
24334
+ }
24335
+ const trimmed3 = value.trim();
24336
+ return trimmed3.length > 0 ? trimmed3 : void 0;
24337
+ }
24338
+
24339
+ // ../../packages/ycodium-acp-executor/src/tool-presentation.ts
24340
+ function normalizeCommandValue(value) {
24341
+ const direct = asTrimmedString(value);
24342
+ if (direct) {
24343
+ return direct;
24344
+ }
24345
+ if (!Array.isArray(value)) {
24346
+ return void 0;
24347
+ }
24348
+ const parts = [];
24349
+ for (const entry of value) {
24350
+ const part = asTrimmedString(entry);
24351
+ if (part !== void 0) {
24352
+ parts.push(part);
24353
+ }
24354
+ }
24355
+ return parts.length > 0 ? parts.join(" ") : void 0;
24356
+ }
24357
+ function stripTrailingExitCode(value) {
24358
+ const trimmed3 = value?.trim();
24359
+ if (!trimmed3) {
24360
+ return void 0;
24361
+ }
24362
+ const match = /^(?<output>[\s\S]*?)(?:\s*<exited with exit code \d+>)\s*$/iu.exec(trimmed3);
24363
+ const output2 = match?.groups?.output?.trim() ?? trimmed3;
24364
+ return output2.length > 0 ? output2 : void 0;
24365
+ }
24366
+ function extractCommandFromTitle(title) {
24367
+ if (!title) {
24368
+ return void 0;
24369
+ }
24370
+ const backtickMatch = /`([^`]+)`/u.exec(title);
24371
+ return backtickMatch?.[1]?.trim() || void 0;
24372
+ }
24373
+ function extractToolCommand(data, title) {
24374
+ const item = isRecord3(data?.["item"]) ? data["item"] : void 0;
24375
+ const itemInput = item && isRecord3(item["input"]) ? item["input"] : void 0;
24376
+ const itemResult = item && isRecord3(item["result"]) ? item["result"] : void 0;
24377
+ const rawInput = isRecord3(data?.["rawInput"]) ? data["rawInput"] : void 0;
24378
+ const dataInput = isRecord3(data?.["input"]) ? data["input"] : void 0;
24379
+ const candidates = [
24380
+ normalizeCommandValue(item?.["command"]),
24381
+ normalizeCommandValue(itemInput?.["command"]),
24382
+ normalizeCommandValue(itemResult?.["command"]),
24383
+ normalizeCommandValue(data?.["command"]),
24384
+ normalizeCommandValue(dataInput?.["command"]),
24385
+ normalizeCommandValue(rawInput?.["command"])
24386
+ ];
24387
+ const direct = candidates.find((candidate) => candidate !== void 0);
24388
+ if (direct) {
24389
+ return direct;
24390
+ }
24391
+ const executable = asTrimmedString(rawInput?.["executable"]);
24392
+ const args = normalizeCommandValue(rawInput?.["args"]);
24393
+ if (executable && args) {
24394
+ return `${executable} ${args}`;
24395
+ }
24396
+ if (executable) {
24397
+ return executable;
24398
+ }
24399
+ return extractCommandFromTitle(title);
24400
+ }
24401
+ function maybePathLike(value) {
24402
+ if (!value) {
24403
+ return void 0;
24404
+ }
24405
+ if (value.includes("/") || value.includes("\\") || value.startsWith(".") || /\.(?:[a-z0-9]{1,12})$/iu.test(value)) {
24406
+ return value;
24407
+ }
24408
+ return void 0;
24409
+ }
24410
+ function collectPaths(value, paths, seen, depth) {
24411
+ if (depth > 4 || paths.length >= 8) {
24412
+ return;
24413
+ }
24414
+ if (Array.isArray(value)) {
24415
+ for (const entry of value) {
24416
+ collectPaths(entry, paths, seen, depth + 1);
24417
+ if (paths.length >= 8) {
24418
+ return;
24419
+ }
24420
+ }
24421
+ return;
24422
+ }
24423
+ if (!isRecord3(value)) {
24424
+ return;
24425
+ }
24426
+ for (const key of ["path", "filePath", "relativePath", "filename", "newPath", "oldPath"]) {
24427
+ const candidate = maybePathLike(asTrimmedString(value[key]));
24428
+ if (!candidate || seen.has(candidate)) {
24429
+ continue;
24430
+ }
24431
+ seen.add(candidate);
24432
+ paths.push(candidate);
24433
+ if (paths.length >= 8) {
24434
+ return;
24435
+ }
24436
+ }
24437
+ for (const nestedKey of ["locations", "item", "input", "result", "rawInput", "data", "changes"]) {
24438
+ if (!(nestedKey in value)) {
24439
+ continue;
24440
+ }
24441
+ collectPaths(value[nestedKey], paths, seen, depth + 1);
24442
+ if (paths.length >= 8) {
24443
+ return;
24444
+ }
24445
+ }
24446
+ }
24447
+ function extractPrimaryPath(data) {
24448
+ const paths = [];
24449
+ collectPaths(data, paths, /* @__PURE__ */ new Set(), 0);
24450
+ return paths[0];
24451
+ }
24452
+ function normalizeEquivalentValue(value) {
24453
+ const trimmed3 = asTrimmedString(value);
24454
+ if (!trimmed3) {
24455
+ return void 0;
24456
+ }
24457
+ return trimmed3.replace(/\s+/gu, " ").replace(/\s+(?:complete|completed|started)\s*$/iu, "").trim();
24458
+ }
24459
+ function isEquivalent(left, right) {
24460
+ const normalizedLeft = normalizeEquivalentValue(left)?.toLowerCase();
24461
+ const normalizedRight = normalizeEquivalentValue(right)?.toLowerCase();
24462
+ return normalizedLeft !== void 0 && normalizedLeft === normalizedRight;
24463
+ }
24464
+ function classifyToolAction(input2) {
24465
+ const itemType = input2.itemType ?? void 0;
24466
+ const kind = asTrimmedString(input2.data?.["kind"])?.toLowerCase();
24467
+ const title = asTrimmedString(input2.title)?.toLowerCase();
24468
+ if (itemType === "command_execution" || kind === "execute" || title === "terminal") {
24469
+ return "command";
24470
+ }
24471
+ if (kind === "read" || title === "read file") {
24472
+ return "read";
24473
+ }
24474
+ if (itemType === "file_change" || kind === "edit" || kind === "move" || kind === "delete" || kind === "write") {
24475
+ return "file_change";
24476
+ }
24477
+ if (itemType === "web_search" || kind === "search" || title === "find" || title === "grep") {
24478
+ return "search";
24479
+ }
24480
+ return "other";
24481
+ }
24482
+ function canonicalItemTypeFromAcpToolKind(kind) {
24483
+ switch (kind) {
24484
+ case "execute":
24485
+ return "command_execution";
24486
+ case "edit":
24487
+ case "delete":
24488
+ case "move":
24489
+ return "file_change";
24490
+ case "search":
24491
+ case "fetch":
24492
+ return "web_search";
24493
+ default:
24494
+ return "dynamic_tool_call";
24495
+ }
24496
+ }
24497
+ function deriveToolActivityPresentation(input2) {
24498
+ const title = asTrimmedString(input2.title);
24499
+ const detail = stripTrailingExitCode(asTrimmedString(input2.detail));
24500
+ const fallbackSummary = asTrimmedString(input2.fallbackSummary) ?? "Tool";
24501
+ const data = isRecord3(input2.data) ? input2.data : void 0;
24502
+ const command = extractToolCommand(data, title);
24503
+ const primaryPath = extractPrimaryPath(data);
24504
+ const action = classifyToolAction({
24505
+ itemType: input2.itemType,
24506
+ title,
24507
+ data
24508
+ });
24509
+ if (action === "command") {
24510
+ return {
24511
+ summary: "Ran command",
24512
+ ...command ? { detail: command } : {}
24513
+ };
24514
+ }
24515
+ if (action === "read") {
24516
+ if (primaryPath) {
24517
+ return {
24518
+ summary: "Read file",
24519
+ detail: primaryPath
24520
+ };
24521
+ }
24522
+ return {
24523
+ summary: "Read file"
24524
+ };
24525
+ }
24526
+ if (action === "file_change") {
24527
+ return {
24528
+ summary: "Changed files",
24529
+ ...primaryPath ? { detail: primaryPath } : {}
24530
+ };
24531
+ }
24532
+ if (action === "search") {
24533
+ const rawInput = isRecord3(data?.["rawInput"]) ? data["rawInput"] : void 0;
24534
+ const query = asTrimmedString(rawInput?.["query"]) ?? asTrimmedString(rawInput?.["pattern"]) ?? asTrimmedString(rawInput?.["searchTerm"]);
24535
+ return {
24536
+ summary: "Searched files",
24537
+ ...query ? { detail: query } : {}
24538
+ };
24539
+ }
24540
+ if (detail && !isEquivalent(detail, title) && !isEquivalent(detail, fallbackSummary)) {
24541
+ return {
24542
+ summary: title ?? fallbackSummary,
24543
+ detail
24544
+ };
24545
+ }
24546
+ return {
24547
+ summary: title ?? fallbackSummary
24548
+ };
24549
+ }
24550
+
24327
24551
  // ../../packages/ycodium-acp-executor/src/events.ts
24328
24552
  function canonicalRequestTypeFromAcpKind(kind) {
24329
24553
  switch (kind) {
@@ -24379,21 +24603,6 @@ function fileChangesFromAcpPermission(permissionRequest) {
24379
24603
  }) : [];
24380
24604
  return paths.length > 0 ? paths.map((path) => ({ path, omitted: "unavailable" })) : void 0;
24381
24605
  }
24382
- function canonicalItemTypeFromAcpToolKind(kind) {
24383
- switch (kind) {
24384
- case "execute":
24385
- return "command_execution";
24386
- case "edit":
24387
- case "delete":
24388
- case "move":
24389
- return "file_change";
24390
- case "search":
24391
- case "fetch":
24392
- return "web_search";
24393
- default:
24394
- return "dynamic_tool_call";
24395
- }
24396
- }
24397
24606
  function runtimeItemStatusFromAcpToolStatus(status) {
24398
24607
  switch (status) {
24399
24608
  case "pending":
@@ -24465,6 +24674,7 @@ function makeAcpPlanUpdatedEvent(input2) {
24465
24674
  }
24466
24675
  function makeAcpToolCallEvent(input2) {
24467
24676
  const runtimeStatus = runtimeItemStatusFromAcpToolStatus(input2.toolCall.status);
24677
+ const { data } = input2.toolCall;
24468
24678
  return {
24469
24679
  type: input2.toolCall.status === "completed" || input2.toolCall.status === "failed" ? "item.completed" : "item.updated",
24470
24680
  ...input2.stamp,
@@ -24477,7 +24687,7 @@ function makeAcpToolCallEvent(input2) {
24477
24687
  ...runtimeStatus ? { status: runtimeStatus } : {},
24478
24688
  ...input2.toolCall.title ? { title: input2.toolCall.title } : {},
24479
24689
  ...input2.toolCall.detail ? { detail: input2.toolCall.detail } : {},
24480
- ...Object.keys(input2.toolCall.data).length > 0 ? { data: input2.toolCall.data } : {}
24690
+ ...Object.keys(data).length > 0 ? { data } : {}
24481
24691
  },
24482
24692
  raw: {
24483
24693
  source: "acp.jsonrpc",
@@ -24521,7 +24731,7 @@ function makeAcpContentDeltaEvent(input2) {
24521
24731
  }
24522
24732
 
24523
24733
  // ../../packages/ycodium-acp-executor/src/config-options.ts
24524
- function isRecord3(value) {
24734
+ function isRecord4(value) {
24525
24735
  return typeof value === "object" && value !== null && !Array.isArray(value);
24526
24736
  }
24527
24737
  function asString(value) {
@@ -24540,7 +24750,7 @@ function flattenChoices(rawOptions, currentValue) {
24540
24750
  const out = [];
24541
24751
  const seen = /* @__PURE__ */ new Set();
24542
24752
  const push = (entry) => {
24543
- if (!isRecord3(entry)) return;
24753
+ if (!isRecord4(entry)) return;
24544
24754
  const value = asString(entry["value"]);
24545
24755
  if (value === void 0 || seen.has(value)) return;
24546
24756
  seen.add(value);
@@ -24555,7 +24765,7 @@ function flattenChoices(rawOptions, currentValue) {
24555
24765
  });
24556
24766
  };
24557
24767
  for (const entry of rawOptions) {
24558
- if (isRecord3(entry) && Array.isArray(entry["options"])) {
24768
+ if (isRecord4(entry) && Array.isArray(entry["options"])) {
24559
24769
  for (const nested of entry["options"]) push(nested);
24560
24770
  continue;
24561
24771
  }
@@ -24565,7 +24775,7 @@ function flattenChoices(rawOptions, currentValue) {
24565
24775
  }
24566
24776
  function findAcpEffortConfig(configOptions) {
24567
24777
  if (!Array.isArray(configOptions)) return void 0;
24568
- const candidates = configOptions.filter(isRecord3).filter((option) => normalizedField(option, "type") === "select").filter(looksLikeEffortOption);
24778
+ const candidates = configOptions.filter(isRecord4).filter((option) => normalizedField(option, "type") === "select").filter(looksLikeEffortOption);
24569
24779
  if (candidates.length === 0) return void 0;
24570
24780
  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];
24571
24781
  if (picked === void 0) return void 0;
@@ -24581,18 +24791,18 @@ function findAcpEffortConfig(configOptions) {
24581
24791
  }
24582
24792
 
24583
24793
  // ../../packages/ycodium-acp-executor/src/runtime-mode.ts
24584
- function isRecord4(value) {
24794
+ function isRecord5(value) {
24585
24795
  return typeof value === "object" && value !== null && !Array.isArray(value);
24586
24796
  }
24587
24797
  function asString2(value) {
24588
24798
  return typeof value === "string" ? value : void 0;
24589
24799
  }
24590
24800
  function acpModeConfigId(setup) {
24591
- if (!isRecord4(setup)) return void 0;
24801
+ if (!isRecord5(setup)) return void 0;
24592
24802
  const configOptions = setup["configOptions"];
24593
24803
  if (!Array.isArray(configOptions)) return void 0;
24594
24804
  for (const option of configOptions) {
24595
- if (!isRecord4(option)) continue;
24805
+ if (!isRecord5(option)) continue;
24596
24806
  if (asString2(option["category"])?.trim().toLowerCase() !== "mode") continue;
24597
24807
  const id = asString2(option["id"])?.trim();
24598
24808
  if (id) return id;
@@ -24705,215 +24915,6 @@ var Mutex = class {
24705
24915
  }
24706
24916
  };
24707
24917
 
24708
- // ../../packages/ycodium-acp-executor/src/util.ts
24709
- function isRecord5(value) {
24710
- return typeof value === "object" && value !== null && !Array.isArray(value);
24711
- }
24712
- function asTrimmedString(value) {
24713
- if (typeof value !== "string") {
24714
- return void 0;
24715
- }
24716
- const trimmed3 = value.trim();
24717
- return trimmed3.length > 0 ? trimmed3 : void 0;
24718
- }
24719
-
24720
- // ../../packages/ycodium-acp-executor/src/tool-presentation.ts
24721
- function normalizeCommandValue(value) {
24722
- const direct = asTrimmedString(value);
24723
- if (direct) {
24724
- return direct;
24725
- }
24726
- if (!Array.isArray(value)) {
24727
- return void 0;
24728
- }
24729
- const parts = [];
24730
- for (const entry of value) {
24731
- const part = asTrimmedString(entry);
24732
- if (part !== void 0) {
24733
- parts.push(part);
24734
- }
24735
- }
24736
- return parts.length > 0 ? parts.join(" ") : void 0;
24737
- }
24738
- function stripTrailingExitCode(value) {
24739
- const trimmed3 = value?.trim();
24740
- if (!trimmed3) {
24741
- return void 0;
24742
- }
24743
- const match = /^(?<output>[\s\S]*?)(?:\s*<exited with exit code \d+>)\s*$/iu.exec(trimmed3);
24744
- const output2 = match?.groups?.output?.trim() ?? trimmed3;
24745
- return output2.length > 0 ? output2 : void 0;
24746
- }
24747
- function extractCommandFromTitle(title) {
24748
- if (!title) {
24749
- return void 0;
24750
- }
24751
- const backtickMatch = /`([^`]+)`/u.exec(title);
24752
- return backtickMatch?.[1]?.trim() || void 0;
24753
- }
24754
- function extractToolCommand(data, title) {
24755
- const item = isRecord5(data?.["item"]) ? data["item"] : void 0;
24756
- const itemInput = item && isRecord5(item["input"]) ? item["input"] : void 0;
24757
- const itemResult = item && isRecord5(item["result"]) ? item["result"] : void 0;
24758
- const rawInput = isRecord5(data?.["rawInput"]) ? data["rawInput"] : void 0;
24759
- const dataInput = isRecord5(data?.["input"]) ? data["input"] : void 0;
24760
- const candidates = [
24761
- normalizeCommandValue(item?.["command"]),
24762
- normalizeCommandValue(itemInput?.["command"]),
24763
- normalizeCommandValue(itemResult?.["command"]),
24764
- normalizeCommandValue(data?.["command"]),
24765
- normalizeCommandValue(dataInput?.["command"]),
24766
- normalizeCommandValue(rawInput?.["command"])
24767
- ];
24768
- const direct = candidates.find((candidate) => candidate !== void 0);
24769
- if (direct) {
24770
- return direct;
24771
- }
24772
- const executable = asTrimmedString(rawInput?.["executable"]);
24773
- const args = normalizeCommandValue(rawInput?.["args"]);
24774
- if (executable && args) {
24775
- return `${executable} ${args}`;
24776
- }
24777
- if (executable) {
24778
- return executable;
24779
- }
24780
- return extractCommandFromTitle(title);
24781
- }
24782
- function maybePathLike(value) {
24783
- if (!value) {
24784
- return void 0;
24785
- }
24786
- if (value.includes("/") || value.includes("\\") || value.startsWith(".") || /\.(?:[a-z0-9]{1,12})$/iu.test(value)) {
24787
- return value;
24788
- }
24789
- return void 0;
24790
- }
24791
- function collectPaths(value, paths, seen, depth) {
24792
- if (depth > 4 || paths.length >= 8) {
24793
- return;
24794
- }
24795
- if (Array.isArray(value)) {
24796
- for (const entry of value) {
24797
- collectPaths(entry, paths, seen, depth + 1);
24798
- if (paths.length >= 8) {
24799
- return;
24800
- }
24801
- }
24802
- return;
24803
- }
24804
- if (!isRecord5(value)) {
24805
- return;
24806
- }
24807
- for (const key of ["path", "filePath", "relativePath", "filename", "newPath", "oldPath"]) {
24808
- const candidate = maybePathLike(asTrimmedString(value[key]));
24809
- if (!candidate || seen.has(candidate)) {
24810
- continue;
24811
- }
24812
- seen.add(candidate);
24813
- paths.push(candidate);
24814
- if (paths.length >= 8) {
24815
- return;
24816
- }
24817
- }
24818
- for (const nestedKey of ["locations", "item", "input", "result", "rawInput", "data", "changes"]) {
24819
- if (!(nestedKey in value)) {
24820
- continue;
24821
- }
24822
- collectPaths(value[nestedKey], paths, seen, depth + 1);
24823
- if (paths.length >= 8) {
24824
- return;
24825
- }
24826
- }
24827
- }
24828
- function extractPrimaryPath(data) {
24829
- const paths = [];
24830
- collectPaths(data, paths, /* @__PURE__ */ new Set(), 0);
24831
- return paths[0];
24832
- }
24833
- function normalizeEquivalentValue(value) {
24834
- const trimmed3 = asTrimmedString(value);
24835
- if (!trimmed3) {
24836
- return void 0;
24837
- }
24838
- return trimmed3.replace(/\s+/gu, " ").replace(/\s+(?:complete|completed|started)\s*$/iu, "").trim();
24839
- }
24840
- function isEquivalent(left, right) {
24841
- const normalizedLeft = normalizeEquivalentValue(left)?.toLowerCase();
24842
- const normalizedRight = normalizeEquivalentValue(right)?.toLowerCase();
24843
- return normalizedLeft !== void 0 && normalizedLeft === normalizedRight;
24844
- }
24845
- function classifyToolAction(input2) {
24846
- const itemType = input2.itemType ?? void 0;
24847
- const kind = asTrimmedString(input2.data?.["kind"])?.toLowerCase();
24848
- const title = asTrimmedString(input2.title)?.toLowerCase();
24849
- if (itemType === "command_execution" || kind === "execute" || title === "terminal") {
24850
- return "command";
24851
- }
24852
- if (kind === "read" || title === "read file") {
24853
- return "read";
24854
- }
24855
- if (itemType === "file_change" || kind === "edit" || kind === "move" || kind === "delete" || kind === "write") {
24856
- return "file_change";
24857
- }
24858
- if (itemType === "web_search" || kind === "search" || title === "find" || title === "grep") {
24859
- return "search";
24860
- }
24861
- return "other";
24862
- }
24863
- function deriveToolActivityPresentation(input2) {
24864
- const title = asTrimmedString(input2.title);
24865
- const detail = stripTrailingExitCode(asTrimmedString(input2.detail));
24866
- const fallbackSummary = asTrimmedString(input2.fallbackSummary) ?? "Tool";
24867
- const data = isRecord5(input2.data) ? input2.data : void 0;
24868
- const command = extractToolCommand(data, title);
24869
- const primaryPath = extractPrimaryPath(data);
24870
- const action = classifyToolAction({
24871
- itemType: input2.itemType,
24872
- title,
24873
- data
24874
- });
24875
- if (action === "command") {
24876
- return {
24877
- summary: "Ran command",
24878
- ...command ? { detail: command } : {}
24879
- };
24880
- }
24881
- if (action === "read") {
24882
- if (primaryPath) {
24883
- return {
24884
- summary: "Read file",
24885
- detail: primaryPath
24886
- };
24887
- }
24888
- return {
24889
- summary: "Read file"
24890
- };
24891
- }
24892
- if (action === "file_change") {
24893
- return {
24894
- summary: "Changed files",
24895
- ...primaryPath ? { detail: primaryPath } : {}
24896
- };
24897
- }
24898
- if (action === "search") {
24899
- const rawInput = isRecord5(data?.["rawInput"]) ? data["rawInput"] : void 0;
24900
- const query = asTrimmedString(rawInput?.["query"]) ?? asTrimmedString(rawInput?.["pattern"]) ?? asTrimmedString(rawInput?.["searchTerm"]);
24901
- return {
24902
- summary: "Searched files",
24903
- ...query ? { detail: query } : {}
24904
- };
24905
- }
24906
- if (detail && !isEquivalent(detail, title) && !isEquivalent(detail, fallbackSummary)) {
24907
- return {
24908
- summary: title ?? fallbackSummary,
24909
- detail
24910
- };
24911
- }
24912
- return {
24913
- summary: title ?? fallbackSummary
24914
- };
24915
- }
24916
-
24917
24918
  // ../../packages/ycodium-acp-executor/src/runtime-model.ts
24918
24919
  function extractModelConfigId(sessionResponse) {
24919
24920
  const configOptions = sessionResponse.configOptions;
@@ -24944,11 +24945,11 @@ function collectSessionConfigOptionValues(configOption) {
24944
24945
  );
24945
24946
  }
24946
24947
  function collectSessionModelIds(models) {
24947
- if (!isRecord5(models) || !Array.isArray(models["availableModels"])) {
24948
+ if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
24948
24949
  return [];
24949
24950
  }
24950
24951
  return models["availableModels"].flatMap(
24951
- (model) => isRecord5(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
24952
+ (model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
24952
24953
  );
24953
24954
  }
24954
24955
  function catalogModelLastSegment(value) {
@@ -25020,7 +25021,7 @@ function parseAvailableCommandsUpdate(params) {
25020
25021
  }
25021
25022
  const commands = [];
25022
25023
  for (const command of availableCommands) {
25023
- if (!isRecord5(command)) {
25024
+ if (!isRecord3(command)) {
25024
25025
  continue;
25025
25026
  }
25026
25027
  const name = typeof command["name"] === "string" ? command["name"].trim() : "";
@@ -25028,7 +25029,7 @@ function parseAvailableCommandsUpdate(params) {
25028
25029
  continue;
25029
25030
  }
25030
25031
  const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
25031
- const input2 = isRecord5(command["input"]) ? command["input"] : void 0;
25032
+ const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
25032
25033
  const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
25033
25034
  commands.push({
25034
25035
  name,
@@ -25090,7 +25091,7 @@ function extractCommandFromTitle2(title) {
25090
25091
  return match?.[1]?.trim() || void 0;
25091
25092
  }
25092
25093
  function extractToolCallCommand(rawInput, title) {
25093
- if (isRecord5(rawInput)) {
25094
+ if (isRecord3(rawInput)) {
25094
25095
  const directCommand = normalizeCommandValue2(rawInput["command"]);
25095
25096
  if (directCommand) {
25096
25097
  return directCommand;
@@ -25117,7 +25118,7 @@ function boundToolCallOutputText(text3) {
25117
25118
  }
25118
25119
  var RAW_OUTPUT_TEXT_FIELDS = ["content", "stdout", "stderr", "output"];
25119
25120
  function boundToolCallRawOutput(rawOutput) {
25120
- if (!isRecord5(rawOutput)) {
25121
+ if (!isRecord3(rawOutput)) {
25121
25122
  return rawOutput;
25122
25123
  }
25123
25124
  let changed = false;
@@ -25175,21 +25176,6 @@ function extractTextContentFromToolCallContent(content) {
25175
25176
  function normalizeToolKind(kind) {
25176
25177
  return typeof kind === "string" && kind.trim().length > 0 ? kind.trim() : void 0;
25177
25178
  }
25178
- function canonicalItemTypeFromAcpToolKind2(kind) {
25179
- switch (kind) {
25180
- case "execute":
25181
- return "command_execution";
25182
- case "edit":
25183
- case "delete":
25184
- case "move":
25185
- return "file_change";
25186
- case "search":
25187
- case "fetch":
25188
- return "web_search";
25189
- default:
25190
- return "dynamic_tool_call";
25191
- }
25192
- }
25193
25179
  function makeToolCallState(input2, options) {
25194
25180
  const toolCallId = typeof input2.toolCallId === "string" ? input2.toolCallId.trim() : "";
25195
25181
  if (!toolCallId) {
@@ -25205,6 +25191,10 @@ function makeToolCallState(input2, options) {
25205
25191
  if (kind) {
25206
25192
  data["kind"] = kind;
25207
25193
  }
25194
+ const name = readAcpText(input2, "name");
25195
+ if (name) {
25196
+ data["name"] = name;
25197
+ }
25208
25198
  if (command) {
25209
25199
  data["command"] = command;
25210
25200
  }
@@ -25223,7 +25213,7 @@ function makeToolCallState(input2, options) {
25223
25213
  const fallbackDetail = command ?? normalizedTitle ?? textContent;
25224
25214
  const hasPresentationSeed = title !== void 0 || kind !== void 0 || command !== void 0 || normalizedTitle !== void 0 || textContent !== void 0;
25225
25215
  const presentation = hasPresentationSeed ? deriveToolActivityPresentation({
25226
- itemType: canonicalItemTypeFromAcpToolKind2(kind),
25216
+ itemType: canonicalItemTypeFromAcpToolKind(kind),
25227
25217
  title,
25228
25218
  detail: fallbackDetail,
25229
25219
  data,
@@ -25329,7 +25319,7 @@ function readAcpText(source, key) {
25329
25319
  }
25330
25320
  function textFromContentBlocks(blocks) {
25331
25321
  const parts = blocks.flatMap(
25332
- (block) => isRecord5(block) && block["type"] === "text" && typeof block["text"] === "string" ? [block["text"]] : []
25322
+ (block) => isRecord3(block) && block["type"] === "text" && typeof block["text"] === "string" ? [block["text"]] : []
25333
25323
  );
25334
25324
  const joined = parts.join("");
25335
25325
  return joined.trim().length > 0 ? joined : void 0;
@@ -25354,7 +25344,7 @@ function parseSessionUpdateEvent(params) {
25354
25344
  const entries = Array.isArray(upd["entries"]) ? upd["entries"] : [];
25355
25345
  const plan = entries.map((entry, index) => ({
25356
25346
  step: readAcpText(entry, "content") ?? `Step ${index + 1}`,
25357
- status: normalizePlanStepStatus(isRecord5(entry) ? entry["status"] : void 0)
25347
+ status: normalizePlanStepStatus(isRecord3(entry) ? entry["status"] : void 0)
25358
25348
  }));
25359
25349
  if (plan.length > 0) {
25360
25350
  events.push({
@@ -25372,6 +25362,7 @@ function parseSessionUpdateEvent(params) {
25372
25362
  const toolCall = makeToolCallState(
25373
25363
  {
25374
25364
  toolCallId: upd["toolCallId"],
25365
+ name: upd["name"],
25375
25366
  title: typeof upd["title"] === "string" ? upd["title"] : void 0,
25376
25367
  kind: upd["kind"],
25377
25368
  status: upd["status"],
@@ -25393,7 +25384,7 @@ function parseSessionUpdateEvent(params) {
25393
25384
  }
25394
25385
  case "agent_message_chunk":
25395
25386
  case "agent_thought_chunk": {
25396
- const content = isRecord5(upd["content"]) ? upd["content"] : void 0;
25387
+ const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
25397
25388
  const contentType = content?.["type"];
25398
25389
  const streamKind = kind === "agent_thought_chunk" ? "reasoning_text" : "assistant_text";
25399
25390
  if (contentType === "text") {
@@ -25433,7 +25424,7 @@ function parseSessionUpdateEvent(params) {
25433
25424
  }
25434
25425
  case "compaction_summary_chunk": {
25435
25426
  const compactionId = readAcpText(upd, "compactionId");
25436
- const content = isRecord5(upd["content"]) ? upd["content"] : void 0;
25427
+ const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
25437
25428
  const text3 = content?.["type"] === "text" ? content["text"] : void 0;
25438
25429
  if (compactionId === void 0 || typeof text3 !== "string" || text3.length === 0) break;
25439
25430
  events.push({ _tag: "CompactionSummaryChunk", compactionId, text: text3 });
@@ -25465,7 +25456,7 @@ function normalizeModelId(value) {
25465
25456
  return value?.trim() || void 0;
25466
25457
  }
25467
25458
  function modelSelectionStateFromSetup(setup) {
25468
- const sessionModels = isRecord5(setup.models) ? setup.models : void 0;
25459
+ const sessionModels = isRecord3(setup.models) ? setup.models : void 0;
25469
25460
  const modelConfigId = extractModelConfigId(setup);
25470
25461
  const strategy = sessionModels === void 0 && modelConfigId !== void 0 ? "config-option" : "session/set_model";
25471
25462
  const modelConfigOption = modelConfigId === void 0 ? void 0 : findSessionConfigOption(setup.configOptions, modelConfigId);
@@ -26710,7 +26701,7 @@ function createAcpExecutor(options) {
26710
26701
  pendingUserInputs.delete(requestId);
26711
26702
  pending.resolve({
26712
26703
  kind: "answered",
26713
- answers: isRecord5(answers) ? answers : {}
26704
+ answers: isRecord3(answers) ? answers : {}
26714
26705
  });
26715
26706
  };
26716
26707
  const dispose = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-grok",
3
- "version": "0.2.2936",
3
+ "version": "0.2.2942",
4
4
  "description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,9 +21,9 @@
21
21
  "@types/node": "24.12.4",
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
- "@ycodium-ai/plugin-api": "0.2.2936",
25
- "ycodium-acp-executor": "0.2.2936",
26
- "ycodium-executor-testing": "0.0.0"
24
+ "@ycodium-ai/plugin-api": "0.2.2942",
25
+ "ycodium-executor-testing": "0.0.0",
26
+ "ycodium-acp-executor": "0.2.2942"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",