@ycodium-ai/agent-grok 0.2.2996 → 0.2.3000

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 +141 -142
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -24338,6 +24338,9 @@ function asTrimmedString(value) {
24338
24338
  const trimmed3 = value.trim();
24339
24339
  return trimmed3.length > 0 ? trimmed3 : void 0;
24340
24340
  }
24341
+ function readAcpText(source, key) {
24342
+ return asTrimmedString(source?.[key]);
24343
+ }
24341
24344
  var selectPromptTurnId = (input2, activeTurnId, freshTurnId) => {
24342
24345
  const target = input2.expectedActiveTurnId;
24343
24346
  if (target === void 0) return input2.turnId ?? activeTurnId ?? freshTurnId();
@@ -24557,141 +24560,7 @@ function deriveToolActivityPresentation(input2) {
24557
24560
  };
24558
24561
  }
24559
24562
 
24560
- // ../../packages/ycodium-acp-executor/src/runtime-model.ts
24561
- function extractModelConfigId(sessionResponse) {
24562
- const configOptions = sessionResponse.configOptions;
24563
- if (!configOptions) return void 0;
24564
- for (const opt of configOptions) {
24565
- if (opt.category === "model" && opt.id.trim().length > 0) {
24566
- return opt.id.trim();
24567
- }
24568
- }
24569
- return configOptions.find((opt) => opt.id.trim() === "model" && opt.type === "select") ? "model" : void 0;
24570
- }
24571
- function findSessionConfigOption(configOptions, configId) {
24572
- if (!configOptions) {
24573
- return void 0;
24574
- }
24575
- const normalizedConfigId = configId.trim();
24576
- if (!normalizedConfigId) {
24577
- return void 0;
24578
- }
24579
- return configOptions.find((option) => option.id.trim() === normalizedConfigId);
24580
- }
24581
- function collectSessionConfigOptionValues(configOption) {
24582
- if (configOption.type !== "select" || !configOption.options) {
24583
- return [];
24584
- }
24585
- return configOption.options.flatMap(
24586
- (entry) => "value" in entry ? [entry.value] : entry.options.map((option) => option.value)
24587
- );
24588
- }
24589
- function collectSessionModelIds(models) {
24590
- if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
24591
- return [];
24592
- }
24593
- return models["availableModels"].flatMap(
24594
- (model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
24595
- );
24596
- }
24597
- function catalogModelLastSegment(value) {
24598
- if (value.startsWith("[")) {
24599
- let parsed;
24600
- try {
24601
- parsed = JSON.parse(value);
24602
- } catch {
24603
- return void 0;
24604
- }
24605
- if (!Array.isArray(parsed) || parsed.length < 2) return void 0;
24606
- const last = parsed[parsed.length - 1];
24607
- return typeof last === "string" ? last : void 0;
24608
- }
24609
- const separator = value.indexOf("/");
24610
- return separator > 0 && separator < value.length - 1 ? value.slice(separator + 1) : void 0;
24611
- }
24612
- function matchAdvertisedModelValue(requestedModelId, advertisedValues) {
24613
- const wanted = requestedModelId.trim();
24614
- if (!wanted) return void 0;
24615
- if (advertisedValues.includes(wanted)) return wanted;
24616
- const byLastSegment = advertisedValues.filter(
24617
- (value) => catalogModelLastSegment(value) === wanted
24618
- );
24619
- return byLastSegment.length === 1 ? byLastSegment[0] : void 0;
24620
- }
24621
- function parseSessionModeState(sessionResponse) {
24622
- const modes = sessionResponse.modes;
24623
- if (!modes) return void 0;
24624
- const currentModeId = modes.currentModeId.trim();
24625
- if (!currentModeId) {
24626
- return void 0;
24627
- }
24628
- const availableModes = [];
24629
- for (const mode of modes.availableModes) {
24630
- const id = mode.id.trim();
24631
- const name = mode.name.trim();
24632
- if (!id || !name) {
24633
- continue;
24634
- }
24635
- const description = mode.description?.trim() || void 0;
24636
- availableModes.push(
24637
- description !== void 0 ? { id, name, description } : { id, name }
24638
- );
24639
- }
24640
- if (availableModes.length === 0) {
24641
- return void 0;
24642
- }
24643
- return {
24644
- currentModeId,
24645
- availableModes
24646
- };
24647
- }
24648
- function acpCommandsToSlashCommands(commands) {
24649
- return commands.map((command) => ({
24650
- name: command.name,
24651
- ...command.description === void 0 ? {} : { description: command.description },
24652
- ...command.inputHint === void 0 ? {} : { input: { hint: command.inputHint } }
24653
- }));
24654
- }
24655
- function parseAvailableCommandsUpdate(params) {
24656
- const update = params.update;
24657
- if (update["sessionUpdate"] !== "available_commands_update") {
24658
- return void 0;
24659
- }
24660
- const availableCommands = update["availableCommands"];
24661
- if (!Array.isArray(availableCommands)) {
24662
- return [];
24663
- }
24664
- const commands = [];
24665
- for (const command of availableCommands) {
24666
- if (!isRecord3(command)) {
24667
- continue;
24668
- }
24669
- const name = typeof command["name"] === "string" ? command["name"].trim() : "";
24670
- if (!name) {
24671
- continue;
24672
- }
24673
- const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
24674
- const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
24675
- const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
24676
- commands.push({
24677
- name,
24678
- ...description ? { description } : {},
24679
- ...inputHint ? { inputHint } : {}
24680
- });
24681
- }
24682
- return commands;
24683
- }
24684
- function normalizePlanStepStatus(raw) {
24685
- switch (raw) {
24686
- case "completed":
24687
- return "completed";
24688
- case "in_progress":
24689
- case "inProgress":
24690
- return "inProgress";
24691
- default:
24692
- return "pending";
24693
- }
24694
- }
24563
+ // ../../packages/ycodium-acp-executor/src/tool-call-state.ts
24695
24564
  function normalizeToolCallStatus(raw, fallback) {
24696
24565
  switch (raw) {
24697
24566
  case "pending":
@@ -24914,6 +24783,142 @@ function decideToolCallUpdateEmission(input2) {
24914
24783
  }
24915
24784
  return { emit: false, skippedSinceEmit: skippedSinceEmit + 1 };
24916
24785
  }
24786
+
24787
+ // ../../packages/ycodium-acp-executor/src/runtime-model.ts
24788
+ function normalizePlanStepStatus(raw) {
24789
+ switch (raw) {
24790
+ case "completed":
24791
+ return "completed";
24792
+ case "in_progress":
24793
+ case "inProgress":
24794
+ return "inProgress";
24795
+ default:
24796
+ return "pending";
24797
+ }
24798
+ }
24799
+ function extractModelConfigId(sessionResponse) {
24800
+ const configOptions = sessionResponse.configOptions;
24801
+ if (!configOptions) return void 0;
24802
+ for (const opt of configOptions) {
24803
+ if (opt.category === "model" && opt.id.trim().length > 0) {
24804
+ return opt.id.trim();
24805
+ }
24806
+ }
24807
+ return configOptions.find((opt) => opt.id.trim() === "model" && opt.type === "select") ? "model" : void 0;
24808
+ }
24809
+ function findSessionConfigOption(configOptions, configId) {
24810
+ if (!configOptions) {
24811
+ return void 0;
24812
+ }
24813
+ const normalizedConfigId = configId.trim();
24814
+ if (!normalizedConfigId) {
24815
+ return void 0;
24816
+ }
24817
+ return configOptions.find((option) => option.id.trim() === normalizedConfigId);
24818
+ }
24819
+ function collectSessionConfigOptionValues(configOption) {
24820
+ if (configOption.type !== "select" || !configOption.options) {
24821
+ return [];
24822
+ }
24823
+ return configOption.options.flatMap(
24824
+ (entry) => "value" in entry ? [entry.value] : entry.options.map((option) => option.value)
24825
+ );
24826
+ }
24827
+ function collectSessionModelIds(models) {
24828
+ if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
24829
+ return [];
24830
+ }
24831
+ return models["availableModels"].flatMap(
24832
+ (model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
24833
+ );
24834
+ }
24835
+ function catalogModelLastSegment(value) {
24836
+ if (value.startsWith("[")) {
24837
+ let parsed;
24838
+ try {
24839
+ parsed = JSON.parse(value);
24840
+ } catch {
24841
+ return void 0;
24842
+ }
24843
+ if (!Array.isArray(parsed) || parsed.length < 2) return void 0;
24844
+ const last = parsed[parsed.length - 1];
24845
+ return typeof last === "string" ? last : void 0;
24846
+ }
24847
+ const separator = value.indexOf("/");
24848
+ return separator > 0 && separator < value.length - 1 ? value.slice(separator + 1) : void 0;
24849
+ }
24850
+ function matchAdvertisedModelValue(requestedModelId, advertisedValues) {
24851
+ const wanted = requestedModelId.trim();
24852
+ if (!wanted) return void 0;
24853
+ if (advertisedValues.includes(wanted)) return wanted;
24854
+ const byLastSegment = advertisedValues.filter(
24855
+ (value) => catalogModelLastSegment(value) === wanted
24856
+ );
24857
+ return byLastSegment.length === 1 ? byLastSegment[0] : void 0;
24858
+ }
24859
+ function parseSessionModeState(sessionResponse) {
24860
+ const modes = sessionResponse.modes;
24861
+ if (!modes) return void 0;
24862
+ const currentModeId = modes.currentModeId.trim();
24863
+ if (!currentModeId) {
24864
+ return void 0;
24865
+ }
24866
+ const availableModes = [];
24867
+ for (const mode of modes.availableModes) {
24868
+ const id = mode.id.trim();
24869
+ const name = mode.name.trim();
24870
+ if (!id || !name) {
24871
+ continue;
24872
+ }
24873
+ const description = mode.description?.trim() || void 0;
24874
+ availableModes.push(
24875
+ description !== void 0 ? { id, name, description } : { id, name }
24876
+ );
24877
+ }
24878
+ if (availableModes.length === 0) {
24879
+ return void 0;
24880
+ }
24881
+ return {
24882
+ currentModeId,
24883
+ availableModes
24884
+ };
24885
+ }
24886
+ function acpCommandsToSlashCommands(commands) {
24887
+ return commands.map((command) => ({
24888
+ name: command.name,
24889
+ ...command.description === void 0 ? {} : { description: command.description },
24890
+ ...command.inputHint === void 0 ? {} : { input: { hint: command.inputHint } }
24891
+ }));
24892
+ }
24893
+ function parseAvailableCommandsUpdate(params) {
24894
+ const update = params.update;
24895
+ if (update["sessionUpdate"] !== "available_commands_update") {
24896
+ return void 0;
24897
+ }
24898
+ const availableCommands = update["availableCommands"];
24899
+ if (!Array.isArray(availableCommands)) {
24900
+ return [];
24901
+ }
24902
+ const commands = [];
24903
+ for (const command of availableCommands) {
24904
+ if (!isRecord3(command)) {
24905
+ continue;
24906
+ }
24907
+ const name = typeof command["name"] === "string" ? command["name"].trim() : "";
24908
+ if (!name) {
24909
+ continue;
24910
+ }
24911
+ const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
24912
+ const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
24913
+ const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
24914
+ commands.push({
24915
+ name,
24916
+ ...description ? { description } : {},
24917
+ ...inputHint ? { inputHint } : {}
24918
+ });
24919
+ }
24920
+ return commands;
24921
+ }
24917
24922
  function parsePermissionRequest(params) {
24918
24923
  const toolCall = makeToolCallState(
24919
24924
  {
@@ -24953,12 +24958,6 @@ function boundToolCallRawPayload(params, update, toolCall) {
24953
24958
  }
24954
24959
  };
24955
24960
  }
24956
- function readAcpText(source, key) {
24957
- const value = source?.[key];
24958
- if (typeof value !== "string") return void 0;
24959
- const trimmed3 = value.trim();
24960
- return trimmed3.length > 0 ? trimmed3 : void 0;
24961
- }
24962
24961
  function textFromContentBlocks(blocks) {
24963
24962
  const parts = blocks.flatMap(
24964
24963
  (block) => isRecord3(block) && block["type"] === "text" && typeof block["text"] === "string" ? [block["text"]] : []
@@ -28612,7 +28611,7 @@ var executors = [
28612
28611
  ];
28613
28612
  var index_default = definePlugin({
28614
28613
  id: "agent-grok",
28615
- apiVersion: 5,
28614
+ apiVersion: 6,
28616
28615
  executors,
28617
28616
  activate(ctx) {
28618
28617
  ctx.log.info("grok executor ready");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-grok",
3
- "version": "0.2.2996",
3
+ "version": "0.2.3000",
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-acp-executor": "0.2.2996",
24
+ "ycodium-acp-executor": "0.2.3000",
25
25
  "ycodium-executor-testing": "0.0.0",
26
- "@ycodium-ai/plugin-api": "0.2.2996"
26
+ "@ycodium-ai/plugin-api": "0.2.3000"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",