@ycodium-ai/agent-grok 0.2.4486 → 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.
- package/dist/index.js +71 -4
- package/package.json +3 -3
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 =
|
|
11
|
+
var PLUGIN_API_VERSION = 142;
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
import {
|
|
@@ -129,6 +129,7 @@ var GROK_CARD = {
|
|
|
129
129
|
type: "string",
|
|
130
130
|
"x-ycodium-form": {
|
|
131
131
|
titleKey: "form.homePath.title",
|
|
132
|
+
machineLocal: true,
|
|
132
133
|
descriptionKey: "form.homePath.description",
|
|
133
134
|
placeholderKey: "form.homePath.placeholder"
|
|
134
135
|
}
|
|
@@ -1317,7 +1318,15 @@ function parsePermissionRequest(params, known) {
|
|
|
1317
1318
|
{ fallbackStatus: "pending" }
|
|
1318
1319
|
);
|
|
1319
1320
|
const kind = toolCall?.kind ?? "unknown";
|
|
1320
|
-
const
|
|
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;
|
|
1321
1330
|
return {
|
|
1322
1331
|
kind,
|
|
1323
1332
|
...detail ? { detail } : {},
|
|
@@ -1558,6 +1567,7 @@ function makeAcpRequestOpenedEvent(input2) {
|
|
|
1558
1567
|
...input2.detail ? { detail: input2.detail } : {},
|
|
1559
1568
|
...toolName ? { toolName } : {},
|
|
1560
1569
|
args: input2.args,
|
|
1570
|
+
...input2.statement !== void 0 ? { statement: input2.statement } : {},
|
|
1561
1571
|
...input2.options ? { options: input2.options } : {},
|
|
1562
1572
|
...input2.fileChanges ? { fileChanges: input2.fileChanges } : {},
|
|
1563
1573
|
declineReasonRelay: "queued"
|
|
@@ -26831,6 +26841,38 @@ function createPromptResults({
|
|
|
26831
26841
|
return { add, receive, reject, stop, complete, hasInterrupted, forget, wait, finishUnreceived };
|
|
26832
26842
|
}
|
|
26833
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
|
+
|
|
26834
26876
|
// ../../packages/ycodium-acp-executor/src/executor/requests.ts
|
|
26835
26877
|
function createExecutorRequests({
|
|
26836
26878
|
emit,
|
|
@@ -26964,6 +27006,13 @@ function createExecutorRequests({
|
|
|
26964
27006
|
return { outcome: { outcome: "selected", optionId } };
|
|
26965
27007
|
}
|
|
26966
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);
|
|
26967
27016
|
const requestId = randomId();
|
|
26968
27017
|
const outcome = await new Promise((resolve2) => {
|
|
26969
27018
|
const pending = {
|
|
@@ -26983,10 +27032,11 @@ function createExecutorRequests({
|
|
|
26983
27032
|
turnId: shared.activeTurnId,
|
|
26984
27033
|
requestId,
|
|
26985
27034
|
permissionRequest,
|
|
26986
|
-
detail: permissionRequest.detail,
|
|
27035
|
+
detail: statement.command ?? permissionRequest.detail,
|
|
26987
27036
|
args: permissionRequest.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
|
|
27037
|
+
statement,
|
|
26988
27038
|
options: acpApprovalOptions(params),
|
|
26989
|
-
fileChanges
|
|
27039
|
+
fileChanges,
|
|
26990
27040
|
source: "acp.jsonrpc",
|
|
26991
27041
|
method: "session/request_permission",
|
|
26992
27042
|
rawPayload: params
|
|
@@ -30741,6 +30791,22 @@ function prepareGrokFollowUpSteer(homePath, log, threadId) {
|
|
|
30741
30791
|
}
|
|
30742
30792
|
}
|
|
30743
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
|
+
|
|
30744
30810
|
// src/grokInstance.ts
|
|
30745
30811
|
var RESUME_SCHEMA_VERSION = 1;
|
|
30746
30812
|
var yieldTick = () => new Promise((resolve2) => {
|
|
@@ -30961,6 +31027,7 @@ var createGrokInstance = (config2, host) => {
|
|
|
30961
31027
|
// 播报的 `authMethods` 说了算(见 resolveGrokAuthMethodId)。
|
|
30962
31028
|
authMethodId: resolveGrokAuthMethodId,
|
|
30963
31029
|
hooks: {
|
|
31030
|
+
permissionStatement: grokPermissionStatement,
|
|
30964
31031
|
promptSettlement: turnUsage.settlement,
|
|
30965
31032
|
// 运行中再收到的 prompt 由 grok 自己排队、在下一个工具调用结束时并进这一轮(配合上面写的配置)。
|
|
30966
31033
|
queuesPromptsWhileRunning: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-grok",
|
|
3
|
-
"version": "0.2.
|
|
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
|
-
"
|
|
24
|
+
"ycodium-acp-executor": "0.2.5004",
|
|
25
25
|
"ycodium-executor-testing": "0.0.0",
|
|
26
|
-
"ycodium-
|
|
26
|
+
"@ycodium-ai/plugin-api": "0.2.5004"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|