@ycodium-ai/agent-grok 0.2.4688 → 0.2.5004

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 +70 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  import { definePlugin } from "@ycodium-ai/plugin-api";
9
9
 
10
10
  // ../../packages/plugin-api/src/version.ts
11
- var PLUGIN_API_VERSION = 128;
11
+ var PLUGIN_API_VERSION = 142;
12
12
 
13
13
  // src/index.ts
14
14
  import {
@@ -1318,7 +1318,15 @@ function parsePermissionRequest(params, known) {
1318
1318
  { fallbackStatus: "pending" }
1319
1319
  );
1320
1320
  const kind = toolCall?.kind ?? "unknown";
1321
- const detail = toolCall?.command ?? toolCall?.title ?? toolCall?.detail;
1321
+ const content = toolCall?.data["content"];
1322
+ const firstText = Array.isArray(content) ? content.flatMap((entry) => {
1323
+ if (!isRecord3(entry) || entry["type"] !== "content" || !isRecord3(entry["content"]))
1324
+ return [];
1325
+ const block = entry["content"];
1326
+ return block["type"] === "text" && typeof block["text"] === "string" && block["text"].trim() ? [block["text"]] : [];
1327
+ })[0] : void 0;
1328
+ const originalTitle = (request.title ?? known?.rawTitle)?.trim() || void 0;
1329
+ const detail = toolCall?.command ?? firstText ?? originalTitle;
1322
1330
  return {
1323
1331
  kind,
1324
1332
  ...detail ? { detail } : {},
@@ -1559,6 +1567,7 @@ function makeAcpRequestOpenedEvent(input2) {
1559
1567
  ...input2.detail ? { detail: input2.detail } : {},
1560
1568
  ...toolName ? { toolName } : {},
1561
1569
  args: input2.args,
1570
+ ...input2.statement !== void 0 ? { statement: input2.statement } : {},
1562
1571
  ...input2.options ? { options: input2.options } : {},
1563
1572
  ...input2.fileChanges ? { fileChanges: input2.fileChanges } : {},
1564
1573
  declineReasonRelay: "queued"
@@ -26832,6 +26841,38 @@ function createPromptResults({
26832
26841
  return { add, receive, reject, stop, complete, hasInterrupted, forget, wait, finishUnreceived };
26833
26842
  }
26834
26843
 
26844
+ // ../../packages/ycodium-acp-executor/src/permission-statement.ts
26845
+ function defaultPermissionStatement(request) {
26846
+ const rawInput = request.toolCall?.data["rawInput"];
26847
+ const input2 = isRecord3(rawInput) ? rawInput : {};
26848
+ const coveredArgs = [];
26849
+ const text4 = (name) => {
26850
+ const value = input2[name];
26851
+ if (typeof value !== "string" || value.trim().length === 0) return void 0;
26852
+ coveredArgs.push(name);
26853
+ return value;
26854
+ };
26855
+ const description = text4("description");
26856
+ const justification = text4("justification") ?? text4("reason");
26857
+ const command = request.kind === "execute" ? text4("command") ?? text4("cmd") ?? request.toolCall?.command : void 0;
26858
+ let outsideSandbox = false;
26859
+ for (const name of ["sandbox_permissions", "sandboxPermissions", "dangerouslyDisableSandbox"]) {
26860
+ const value = input2[name];
26861
+ const outside = name === "dangerouslyDisableSandbox" ? value === true || value === "true" : typeof value === "string" && /full[-_]access|danger|escalat/i.test(value);
26862
+ if (!outside) continue;
26863
+ outsideSandbox = true;
26864
+ coveredArgs.push(name);
26865
+ }
26866
+ if ("timeoutMs" in input2) coveredArgs.push("timeoutMs");
26867
+ return {
26868
+ ...description !== void 0 ? { description } : {},
26869
+ ...justification !== void 0 ? { justification } : {},
26870
+ ...command !== void 0 ? { command } : {},
26871
+ ...outsideSandbox ? { outsideSandbox: true } : {},
26872
+ ...coveredArgs.length > 0 ? { coveredArgs } : {}
26873
+ };
26874
+ }
26875
+
26835
26876
  // ../../packages/ycodium-acp-executor/src/executor/requests.ts
26836
26877
  function createExecutorRequests({
26837
26878
  emit,
@@ -26965,6 +27006,13 @@ function createExecutorRequests({
26965
27006
  return { outcome: { outcome: "selected", optionId } };
26966
27007
  }
26967
27008
  }
27009
+ const permissionContext = {
27010
+ request: params,
27011
+ permissionRequest,
27012
+ previousToolCall: tracked?.state
27013
+ };
27014
+ const statement = hooks.permissionStatement?.(permissionContext) ?? defaultPermissionStatement(permissionRequest);
27015
+ const fileChanges = hooks.permissionFileChanges?.(permissionContext) ?? fileChangesFromAcpPermission(permissionRequest);
26968
27016
  const requestId = randomId();
26969
27017
  const outcome = await new Promise((resolve2) => {
26970
27018
  const pending = {
@@ -26984,10 +27032,11 @@ function createExecutorRequests({
26984
27032
  turnId: shared.activeTurnId,
26985
27033
  requestId,
26986
27034
  permissionRequest,
26987
- detail: permissionRequest.detail,
27035
+ detail: statement.command ?? permissionRequest.detail,
26988
27036
  args: permissionRequest.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
27037
+ statement,
26989
27038
  options: acpApprovalOptions(params),
26990
- fileChanges: fileChangesFromAcpPermission(permissionRequest),
27039
+ fileChanges,
26991
27040
  source: "acp.jsonrpc",
26992
27041
  method: "session/request_permission",
26993
27042
  rawPayload: params
@@ -30742,6 +30791,22 @@ function prepareGrokFollowUpSteer(homePath, log, threadId) {
30742
30791
  }
30743
30792
  }
30744
30793
 
30794
+ // src/approvalStatement.ts
30795
+ var grokPermissionStatement = ({
30796
+ permissionRequest
30797
+ }) => {
30798
+ const statement = defaultPermissionStatement(permissionRequest);
30799
+ const input2 = permissionRequest.toolCall?.data["rawInput"];
30800
+ const hidden = ["variant", "is_background", "block_until_ms"];
30801
+ return {
30802
+ ...statement,
30803
+ coveredArgs: [
30804
+ ...statement.coveredArgs ?? [],
30805
+ ...hidden.filter((name) => typeof input2 === "object" && input2 !== null && name in input2)
30806
+ ]
30807
+ };
30808
+ };
30809
+
30745
30810
  // src/grokInstance.ts
30746
30811
  var RESUME_SCHEMA_VERSION = 1;
30747
30812
  var yieldTick = () => new Promise((resolve2) => {
@@ -30962,6 +31027,7 @@ var createGrokInstance = (config2, host) => {
30962
31027
  // 播报的 `authMethods` 说了算(见 resolveGrokAuthMethodId)。
30963
31028
  authMethodId: resolveGrokAuthMethodId,
30964
31029
  hooks: {
31030
+ permissionStatement: grokPermissionStatement,
30965
31031
  promptSettlement: turnUsage.settlement,
30966
31032
  // 运行中再收到的 prompt 由 grok 自己排队、在下一个工具调用结束时并进这一轮(配合上面写的配置)。
30967
31033
  queuesPromptsWhileRunning: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-grok",
3
- "version": "0.2.4688",
3
+ "version": "0.2.5004",
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.4688",
25
- "ycodium-acp-executor": "0.2.4688",
26
- "ycodium-executor-testing": "0.0.0"
24
+ "ycodium-acp-executor": "0.2.5004",
25
+ "ycodium-executor-testing": "0.0.0",
26
+ "@ycodium-ai/plugin-api": "0.2.5004"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",