@ycodium-ai/agent-grok 0.2.5763 → 0.2.5877
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 +58 -18
- 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 =
|
|
11
|
+
var PLUGIN_API_VERSION = 184;
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
import { registerEffectiveHomeCommand } from "@ycodium-ai/plugin-api/instance-config";
|
|
@@ -72,6 +72,7 @@ var GROK_CARD = {
|
|
|
72
72
|
verifiedSkills: true,
|
|
73
73
|
everydayHarness: false,
|
|
74
74
|
capabilities: {
|
|
75
|
+
hostMcpToolListing: "full",
|
|
75
76
|
// 握手失败后的重连行为与带游标换进程续接都没实测:先不自动换代。
|
|
76
77
|
recoversMcpByRelaunch: false,
|
|
77
78
|
// 型号与思考档都在会话里切,不重开(重开会把进程里的子 agent 一起关掉):执行器发送前经
|
|
@@ -267,14 +268,14 @@ function buildSpawnEnv(recipe, resolvedHomePath, homeConfigured) {
|
|
|
267
268
|
|
|
268
269
|
// src/grokInstance.ts
|
|
269
270
|
import { sessionReadFromImport } from "@ycodium-ai/plugin-api/session-history";
|
|
270
|
-
import * as
|
|
271
|
+
import * as NodeCrypto5 from "node:crypto";
|
|
271
272
|
import {
|
|
272
273
|
raceAbort as raceAbort2
|
|
273
274
|
} from "@ycodium-ai/plugin-api/executor";
|
|
274
275
|
import { nodeStreamsFromHandle as nodeStreamsFromHandle2 } from "@ycodium-ai/plugin-api/process-stdin";
|
|
275
276
|
|
|
276
277
|
// ../../packages/ycodium-acp-executor/src/executor.ts
|
|
277
|
-
import * as
|
|
278
|
+
import * as NodeCrypto4 from "node:crypto";
|
|
278
279
|
|
|
279
280
|
// ../../packages/ycodium-acp-executor/src/approvals.ts
|
|
280
281
|
function createApprovalGate(input2) {
|
|
@@ -1388,9 +1389,9 @@ function parseSessionUpdateEvent(params) {
|
|
|
1388
1389
|
break;
|
|
1389
1390
|
}
|
|
1390
1391
|
case "compaction_update": {
|
|
1391
|
-
const compactionId = readAcpText(upd, "compactionId");
|
|
1392
|
+
const compactionId = readAcpText(upd, "compactionId") ?? readAcpText(upd, "id");
|
|
1392
1393
|
const status = readAcpText(upd, "status");
|
|
1393
|
-
if (
|
|
1394
|
+
if (status === void 0) break;
|
|
1394
1395
|
const rawSummary = upd["summary"];
|
|
1395
1396
|
events.push({
|
|
1396
1397
|
_tag: "CompactionUpdated",
|
|
@@ -1402,10 +1403,10 @@ function parseSessionUpdateEvent(params) {
|
|
|
1402
1403
|
break;
|
|
1403
1404
|
}
|
|
1404
1405
|
case "compaction_summary_chunk": {
|
|
1405
|
-
const compactionId = readAcpText(upd, "compactionId");
|
|
1406
|
+
const compactionId = readAcpText(upd, "compactionId") ?? readAcpText(upd, "id");
|
|
1406
1407
|
const content = isRecord3(upd["content"]) ? upd["content"] : void 0;
|
|
1407
1408
|
const text4 = content?.["type"] === "text" ? content["text"] : void 0;
|
|
1408
|
-
if (
|
|
1409
|
+
if (typeof text4 !== "string" || text4.length === 0) break;
|
|
1409
1410
|
events.push({ _tag: "CompactionSummaryChunk", compactionId, text: text4 });
|
|
1410
1411
|
break;
|
|
1411
1412
|
}
|
|
@@ -1685,6 +1686,9 @@ function createChildSessionRegistry(limit = CHILD_LIMIT) {
|
|
|
1685
1686
|
};
|
|
1686
1687
|
}
|
|
1687
1688
|
|
|
1689
|
+
// ../../packages/ycodium-acp-executor/src/executor/lifecycle.ts
|
|
1690
|
+
import * as NodeCrypto2 from "node:crypto";
|
|
1691
|
+
|
|
1688
1692
|
// ../../node_modules/.pnpm/@agentclientprotocol+sdk@1.4.0_zod@4.6.5/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
1689
1693
|
var AGENT_METHODS = {
|
|
1690
1694
|
initialize: "initialize",
|
|
@@ -25779,7 +25783,7 @@ function createExecutorLifecycle({
|
|
|
25779
25783
|
);
|
|
25780
25784
|
}
|
|
25781
25785
|
const record4 = {
|
|
25782
|
-
snapshotId: randomId(),
|
|
25786
|
+
snapshotId: randomId()?.trim() || NodeCrypto2.randomUUID(),
|
|
25783
25787
|
trigger: "manual",
|
|
25784
25788
|
startedAtMs: nowMs(),
|
|
25785
25789
|
summary: void 0,
|
|
@@ -27820,6 +27824,9 @@ function createExecutorSettlement({
|
|
|
27820
27824
|
return { rememberSettledPromptKey, abortPendingSettlement, settleFromNotification };
|
|
27821
27825
|
}
|
|
27822
27826
|
|
|
27827
|
+
// ../../packages/ycodium-acp-executor/src/executor/updates.ts
|
|
27828
|
+
import * as NodeCrypto3 from "node:crypto";
|
|
27829
|
+
|
|
27823
27830
|
// ../../packages/ycodium-acp-executor/src/executor/subagent-sessions.ts
|
|
27824
27831
|
function parseState(raw) {
|
|
27825
27832
|
if (!isRecord3(raw)) return { status: void 0, error: void 0 };
|
|
@@ -27944,6 +27951,7 @@ function createSubagentSessionTracker(registry2) {
|
|
|
27944
27951
|
// ../../packages/ycodium-acp-executor/src/executor/updates.ts
|
|
27945
27952
|
var COMPACTION_SUMMARY_MAX_CHARS = 8e3;
|
|
27946
27953
|
var SHOWN_TOOL_CALL_LIMIT = 256;
|
|
27954
|
+
var ANONYMOUS_COMPACTION_KEY = "__acp_default_compaction__";
|
|
27947
27955
|
function createExecutorUpdates({
|
|
27948
27956
|
emit,
|
|
27949
27957
|
stamp,
|
|
@@ -27961,7 +27969,14 @@ function createExecutorUpdates({
|
|
|
27961
27969
|
const shownToolCallIds = /* @__PURE__ */ new Set();
|
|
27962
27970
|
const markChildSession = shared.childSessions.mark;
|
|
27963
27971
|
const subagentSessions = options.subagentSessions === true ? createSubagentSessionTracker(shared.childSessions) : void 0;
|
|
27972
|
+
const resolveCompactionSnapshotId = (candidate) => {
|
|
27973
|
+
const trimmed3 = candidate?.trim();
|
|
27974
|
+
if (trimmed3) return trimmed3;
|
|
27975
|
+
const generated = randomId()?.trim();
|
|
27976
|
+
return generated || NodeCrypto3.randomUUID();
|
|
27977
|
+
};
|
|
27964
27978
|
const emitCompactionState = (record4, state) => {
|
|
27979
|
+
record4.snapshotId = resolveCompactionSnapshotId(record4.snapshotId);
|
|
27965
27980
|
const summary = record4.summary?.trim() ?? "";
|
|
27966
27981
|
const truncated = summary.length > COMPACTION_SUMMARY_MAX_CHARS;
|
|
27967
27982
|
emit({
|
|
@@ -27985,14 +28000,18 @@ function createExecutorUpdates({
|
|
|
27985
28000
|
});
|
|
27986
28001
|
};
|
|
27987
28002
|
const applyCompactionUpdate = (event) => {
|
|
27988
|
-
|
|
28003
|
+
const mapKey = event.compactionId ?? ANONYMOUS_COMPACTION_KEY;
|
|
28004
|
+
let record4 = compactions.get(mapKey);
|
|
27989
28005
|
if (record4 === void 0) {
|
|
27990
28006
|
if (shared.manualCompaction !== void 0 && !shared.manualCompaction.adopted) {
|
|
27991
28007
|
shared.manualCompaction.adopted = true;
|
|
28008
|
+
shared.manualCompaction.snapshotId = resolveCompactionSnapshotId(
|
|
28009
|
+
shared.manualCompaction.snapshotId
|
|
28010
|
+
);
|
|
27992
28011
|
record4 = shared.manualCompaction;
|
|
27993
28012
|
} else {
|
|
27994
28013
|
record4 = {
|
|
27995
|
-
snapshotId:
|
|
28014
|
+
snapshotId: resolveCompactionSnapshotId(),
|
|
27996
28015
|
trigger: "automatic",
|
|
27997
28016
|
startedAtMs: nowMs(),
|
|
27998
28017
|
summary: void 0,
|
|
@@ -28001,7 +28020,7 @@ function createExecutorUpdates({
|
|
|
28001
28020
|
adopted: false
|
|
28002
28021
|
};
|
|
28003
28022
|
}
|
|
28004
|
-
compactions.set(
|
|
28023
|
+
compactions.set(mapKey, record4);
|
|
28005
28024
|
}
|
|
28006
28025
|
if (event.summary !== void 0) record4.summary = event.summary ?? void 0;
|
|
28007
28026
|
switch (event.status) {
|
|
@@ -28014,13 +28033,13 @@ function createExecutorUpdates({
|
|
|
28014
28033
|
case "completed":
|
|
28015
28034
|
record4.announced = true;
|
|
28016
28035
|
record4.finished = true;
|
|
28017
|
-
compactions.delete(
|
|
28036
|
+
compactions.delete(mapKey);
|
|
28018
28037
|
emitCompactionState(record4, "compacted");
|
|
28019
28038
|
return;
|
|
28020
28039
|
case "failed":
|
|
28021
28040
|
case "cancelled":
|
|
28022
28041
|
record4.finished = true;
|
|
28023
|
-
compactions.delete(
|
|
28042
|
+
compactions.delete(mapKey);
|
|
28024
28043
|
emit({
|
|
28025
28044
|
type: "runtime.warning",
|
|
28026
28045
|
...stamp(),
|
|
@@ -28128,9 +28147,11 @@ function createExecutorUpdates({
|
|
|
28128
28147
|
nowMs
|
|
28129
28148
|
});
|
|
28130
28149
|
const hasToolHooks = toolSubagents !== void 0 || hooks.onToolCallUpdated !== void 0;
|
|
28150
|
+
const toolName = typeof nextToolCall.data["name"] === "string" ? nextToolCall.data["name"] : void 0;
|
|
28131
28151
|
const call = !hasToolHooks ? void 0 : {
|
|
28132
28152
|
toolCallId: nextToolCall.toolCallId,
|
|
28133
28153
|
status: nextToolCall.status,
|
|
28154
|
+
...toolName === void 0 ? {} : { name: toolName },
|
|
28134
28155
|
title: nextToolCall.title,
|
|
28135
28156
|
kind: nextToolCall.kind,
|
|
28136
28157
|
rawInput: nextToolCall.data["rawInput"],
|
|
@@ -28186,7 +28207,7 @@ function createExecutorUpdates({
|
|
|
28186
28207
|
continue;
|
|
28187
28208
|
}
|
|
28188
28209
|
if (event._tag === "CompactionSummaryChunk") {
|
|
28189
|
-
const record4 = compactions.get(event.compactionId);
|
|
28210
|
+
const record4 = compactions.get(event.compactionId ?? ANONYMOUS_COMPACTION_KEY) ?? shared.manualCompaction;
|
|
28190
28211
|
if (record4 !== void 0 && !record4.finished) {
|
|
28191
28212
|
record4.summary = (record4.summary ?? "") + event.text;
|
|
28192
28213
|
}
|
|
@@ -28388,7 +28409,7 @@ function defaultNowIso() {
|
|
|
28388
28409
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
28389
28410
|
}
|
|
28390
28411
|
function defaultRandomId() {
|
|
28391
|
-
return
|
|
28412
|
+
return NodeCrypto4.randomUUID();
|
|
28392
28413
|
}
|
|
28393
28414
|
function createAcpExecutor(options) {
|
|
28394
28415
|
const hooks = { ...defaultVendorHooks, ...options.hooks };
|
|
@@ -29835,6 +29856,17 @@ function buildGrokBackgroundTaskEvents(input2) {
|
|
|
29835
29856
|
}
|
|
29836
29857
|
return events;
|
|
29837
29858
|
}
|
|
29859
|
+
function settleGrokBackgroundTasks(tasks) {
|
|
29860
|
+
const events = [];
|
|
29861
|
+
for (const task of tasks.values()) {
|
|
29862
|
+
events.push({
|
|
29863
|
+
type: "task.completed",
|
|
29864
|
+
payload: { ...task.payload, status: "stopped" }
|
|
29865
|
+
});
|
|
29866
|
+
}
|
|
29867
|
+
tasks.clear();
|
|
29868
|
+
return events;
|
|
29869
|
+
}
|
|
29838
29870
|
|
|
29839
29871
|
// src/grokImageArtifacts.ts
|
|
29840
29872
|
var IMAGE_RESULT_TYPES = /* @__PURE__ */ new Set(["ImageGen", "ImageEdit"]);
|
|
@@ -31409,7 +31441,10 @@ var createGrokInstance = (config2, host) => {
|
|
|
31409
31441
|
}),
|
|
31410
31442
|
// 子 agent 名单与 CLI 自己重试(限流、容量不足)时的本轮提示。
|
|
31411
31443
|
...grokObservationHooks(subagents),
|
|
31412
|
-
onSessionEnded:
|
|
31444
|
+
onSessionEnded: () => [
|
|
31445
|
+
...subagents.onSessionEnded(),
|
|
31446
|
+
...settleGrokBackgroundTasks(backgroundTasks)
|
|
31447
|
+
],
|
|
31413
31448
|
onExtensionRequest: async (method, params, ctx) => {
|
|
31414
31449
|
if (XAI_EXIT_PLAN_MODE_METHODS.includes(method)) {
|
|
31415
31450
|
const plan = parseXAiExitPlanModeParams(params);
|
|
@@ -31479,7 +31514,7 @@ var createGrokInstance = (config2, host) => {
|
|
|
31479
31514
|
if (caveat !== void 0) {
|
|
31480
31515
|
input2.events.emit({
|
|
31481
31516
|
type: "runtime.warning",
|
|
31482
|
-
eventId:
|
|
31517
|
+
eventId: NodeCrypto5.randomUUID(),
|
|
31483
31518
|
provider: GROK_DRIVER_KIND,
|
|
31484
31519
|
providerInstanceId: host.instanceId,
|
|
31485
31520
|
threadId: input2.threadId,
|
|
@@ -31543,7 +31578,12 @@ var createGrokInstance = (config2, host) => {
|
|
|
31543
31578
|
var executors = [
|
|
31544
31579
|
{
|
|
31545
31580
|
card: GROK_CARD,
|
|
31546
|
-
lifecycle: [
|
|
31581
|
+
lifecycle: [
|
|
31582
|
+
{ kind: "install", reversible: false },
|
|
31583
|
+
{ kind: "detect", reversible: true },
|
|
31584
|
+
{ kind: "sign-in", reversible: false },
|
|
31585
|
+
{ kind: "update", reversible: false }
|
|
31586
|
+
],
|
|
31547
31587
|
createInstance: async (config2, host) => {
|
|
31548
31588
|
host.log.info("createInstance");
|
|
31549
31589
|
return createGrokInstance(config2, host);
|
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.5877",
|
|
4
4
|
"description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -21,10 +21,10 @@
|
|
|
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.
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.5877",
|
|
25
25
|
"ycodium-credential-account": "0.0.0",
|
|
26
|
-
"ycodium-executor
|
|
27
|
-
"ycodium-
|
|
26
|
+
"ycodium-acp-executor": "0.2.5877",
|
|
27
|
+
"ycodium-executor-testing": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|
|
30
30
|
"plugin": "./dist/index.js",
|