@ycodium-ai/agent-grok 0.2.3158 → 0.2.3168

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 +72 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -27271,6 +27271,20 @@ function createAcpSessionRegistry(threads, stopBooked2) {
27271
27271
  return { requireThread, stopSession, stopAll };
27272
27272
  }
27273
27273
 
27274
+ // ../../packages/ycodium-acp-executor/src/sessionProcess.ts
27275
+ var fileName = (path) => path.slice(path.lastIndexOf("/") + 1);
27276
+ var withoutExe = (name) => name.replace(/\.exe$/, "");
27277
+ function acpNativeSessionProcessMatcher(program, args) {
27278
+ return (argv, platform) => {
27279
+ const normalize = (value) => platform === "win32" ? withoutExe(value.replaceAll("\\", "/").toLowerCase()) : value;
27280
+ const expected = normalize(program);
27281
+ const actual = normalize(argv[0] ?? "");
27282
+ const sameProgram = expected.includes("/") ? actual === expected : fileName(actual) === fileName(expected);
27283
+ const rest = argv.slice(1);
27284
+ return sameProgram && rest.length === args.length && rest.every((arg, i) => arg === args[i]);
27285
+ };
27286
+ }
27287
+
27274
27288
  // ../../packages/ycodium-acp-executor/src/prompt-dispatch.ts
27275
27289
  var dispatchAcpPrompt = (executor, input2) => {
27276
27290
  const { promise: dispatched, resolve: resolve2 } = Promise.withResolvers();
@@ -28518,6 +28532,50 @@ function grokPluginDirArgs(skills) {
28518
28532
  return skills === void 0 || skills.names.length === 0 ? [] : ["--plugin-dir", skills.pluginDir];
28519
28533
  }
28520
28534
 
28535
+ // src/openCommands.ts
28536
+ import {
28537
+ isPowerShellExecutableName,
28538
+ sameArgv
28539
+ } from "@ycodium-ai/plugin-api/executor";
28540
+ var WINDOWS_POWERSHELL_FLAGS = ["-NoProfile", "-NonInteractive", "-Command"];
28541
+ var basename = (path) => path.split(/[\\/]/).at(-1) ?? "";
28542
+ function grokCommandMatcher(command) {
28543
+ return (argv, platform) => {
28544
+ if (platform !== "win32") return false;
28545
+ const [shell, ...rest] = argv;
28546
+ if (shell === void 0 || !isPowerShellExecutableName(basename(shell))) return false;
28547
+ return sameArgv(rest, [...WINDOWS_POWERSHELL_FLAGS, command]);
28548
+ };
28549
+ }
28550
+ var commandOf = (call) => {
28551
+ if (call.kind !== "execute") return void 0;
28552
+ const rawInput = call.rawInput;
28553
+ if (typeof rawInput !== "object" || rawInput === null) return void 0;
28554
+ const input2 = rawInput;
28555
+ if (input2["is_background"] === true) return void 0;
28556
+ const command = input2["command"];
28557
+ return typeof command === "string" && command.trim() !== "" ? command : void 0;
28558
+ };
28559
+ function grokOpenCommands(session) {
28560
+ const commands = session.openToolCalls.flatMap((call) => {
28561
+ const command = commandOf(call);
28562
+ if (command === void 0) return [];
28563
+ return [
28564
+ {
28565
+ toolCallId: call.toolCallId,
28566
+ startedAtMs: call.startedAtMs,
28567
+ matches: grokCommandMatcher(command)
28568
+ }
28569
+ ];
28570
+ });
28571
+ if (commands.length === 0) return void 0;
28572
+ return {
28573
+ rootPid: session.rootPid,
28574
+ sessionProcess: acpNativeSessionProcessMatcher(session.program, session.args),
28575
+ commands
28576
+ };
28577
+ }
28578
+
28521
28579
  // src/probeModels.ts
28522
28580
  import {
28523
28581
  describeExecutorSpawnFailure,
@@ -28828,9 +28886,9 @@ var createGrokInstance = (config2, host) => {
28828
28886
  ...grokPluginDirArgs(input2.skills),
28829
28887
  ...baseArgs.slice(insertAt)
28830
28888
  ];
28889
+ const spawned = { program: recipe.binaryPath, args };
28831
28890
  const handle = await host.process.spawn({
28832
- program: recipe.binaryPath,
28833
- args,
28891
+ ...spawned,
28834
28892
  cwd,
28835
28893
  owner: { bindingId: host.bindingId },
28836
28894
  ...Object.keys(env).length > 0 ? { env } : {}
@@ -28948,7 +29006,8 @@ var createGrokInstance = (config2, host) => {
28948
29006
  turns: [],
28949
29007
  executor,
28950
29008
  handle,
28951
- forwarding
29009
+ forwarding,
29010
+ spawned
28952
29011
  });
28953
29012
  host.log.info("session started", {
28954
29013
  threadId: input2.threadId,
@@ -29015,6 +29074,15 @@ var createGrokInstance = (config2, host) => {
29015
29074
  await booked.executor.cancel(turnId);
29016
29075
  await yieldTick();
29017
29076
  },
29077
+ openCommandProcesses: async (threadId) => {
29078
+ const booked = threads.get(threadId);
29079
+ if (booked === void 0) return void 0;
29080
+ return grokOpenCommands({
29081
+ rootPid: booked.handle.pid,
29082
+ ...booked.spawned,
29083
+ openToolCalls: booked.executor.openToolCalls()
29084
+ });
29085
+ },
29018
29086
  respondToRequest: async (threadId, requestId, decision, reason) => {
29019
29087
  const booked = requireThread(threadId);
29020
29088
  await booked.executor.respondToRequest(
@@ -29118,7 +29186,7 @@ var executors = [
29118
29186
  ];
29119
29187
  var index_default = definePlugin({
29120
29188
  id: "agent-grok",
29121
- apiVersion: 15,
29189
+ apiVersion: 16,
29122
29190
  executors,
29123
29191
  activate(ctx) {
29124
29192
  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.3158",
3
+ "version": "0.2.3168",
4
4
  "description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,8 +21,8 @@
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.3158",
25
- "ycodium-acp-executor": "0.2.3158",
24
+ "@ycodium-ai/plugin-api": "0.2.3168",
25
+ "ycodium-acp-executor": "0.2.3168",
26
26
  "ycodium-executor-testing": "0.0.0"
27
27
  },
28
28
  "ycodium": {