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