@ycodium-ai/agent-claude 0.2.4688 → 0.2.5029
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 +33 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as NodePath20 from "node:path";
|
|
|
3
3
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
4
4
|
|
|
5
5
|
// ../../packages/plugin-api/src/version.ts
|
|
6
|
-
var PLUGIN_API_VERSION =
|
|
6
|
+
var PLUGIN_API_VERSION = 143;
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import {
|
|
@@ -24622,7 +24622,7 @@ var makeSdkStream = (deps) => {
|
|
|
24622
24622
|
return;
|
|
24623
24623
|
case "assistant":
|
|
24624
24624
|
await handleAssistantMessage(context, message);
|
|
24625
|
-
noteStartupEstablished(context);
|
|
24625
|
+
if (!isClaudeSyntheticApiErrorMessage(message)) noteStartupEstablished(context);
|
|
24626
24626
|
return;
|
|
24627
24627
|
case "result":
|
|
24628
24628
|
await handleResultMessage(context, message);
|
|
@@ -25367,6 +25367,24 @@ var makeSendTurn = (deps) => {
|
|
|
25367
25367
|
return { sendTurn };
|
|
25368
25368
|
};
|
|
25369
25369
|
|
|
25370
|
+
// src/requestStatement.ts
|
|
25371
|
+
function claudeRequestStatement(toolName, requestType, input) {
|
|
25372
|
+
const isCommand = requestType === "command_execution_approval";
|
|
25373
|
+
const covered = [];
|
|
25374
|
+
const description = isCommand || classifyToolItemType(toolName) === "collab_agent_tool_call" ? readString2(input.description) : void 0;
|
|
25375
|
+
if (description !== void 0) covered.push("description");
|
|
25376
|
+
const command = isCommand ? readString2(input.command) : void 0;
|
|
25377
|
+
if (command !== void 0) covered.push("command");
|
|
25378
|
+
const outsideSandbox = input.dangerouslyDisableSandbox === true;
|
|
25379
|
+
if (outsideSandbox) covered.push("dangerouslyDisableSandbox");
|
|
25380
|
+
return {
|
|
25381
|
+
...description !== void 0 ? { description } : {},
|
|
25382
|
+
...command !== void 0 ? { command } : {},
|
|
25383
|
+
...outsideSandbox ? { outsideSandbox: true } : {},
|
|
25384
|
+
...covered.length > 0 ? { coveredArgs: covered } : {}
|
|
25385
|
+
};
|
|
25386
|
+
}
|
|
25387
|
+
|
|
25370
25388
|
// src/usage.ts
|
|
25371
25389
|
function maxClaudeContextWindowFromModelUsage(modelUsage) {
|
|
25372
25390
|
if (!modelUsage) return void 0;
|
|
@@ -25745,6 +25763,7 @@ var makeSessionCallbacks = (deps) => {
|
|
|
25745
25763
|
toolName: requestToolName,
|
|
25746
25764
|
args: toolInput,
|
|
25747
25765
|
...fileChanges ? { fileChanges } : {},
|
|
25766
|
+
statement: claudeRequestStatement(toolName, requestType, toolInput),
|
|
25748
25767
|
declineReasonRelay: "native"
|
|
25749
25768
|
},
|
|
25750
25769
|
providerRefs: nativeProviderRefs({
|
|
@@ -26846,6 +26865,8 @@ var makeStartSession = (deps) => {
|
|
|
26846
26865
|
};
|
|
26847
26866
|
|
|
26848
26867
|
// src/unresumableSessions.ts
|
|
26868
|
+
var GATEWAY_REBOUND_PREFIX = "API Error: 400 ";
|
|
26869
|
+
var GATEWAY_REBOUND_PHRASE = "\u6B64 session \u5DF2\u7ED1\u5B9A\u53E6\u5916\u7684ai\u8D26\u53F7";
|
|
26849
26870
|
var missingConversationLine = (sessionId) => `No conversation found with session ID: ${sessionId}`.toLowerCase();
|
|
26850
26871
|
var createUnresumableSessions = () => {
|
|
26851
26872
|
const reasons = /* @__PURE__ */ new Map();
|
|
@@ -26859,6 +26880,14 @@ var createUnresumableSessions = () => {
|
|
|
26859
26880
|
return {
|
|
26860
26881
|
/** 失败结果里 CLI 列出的错误项,逐项整条比。 */
|
|
26861
26882
|
noteResultErrors: noteDiagnostics,
|
|
26883
|
+
/** 失败结果的状态码与正文:网关拒绝续接这个号(见模块头部)。 */
|
|
26884
|
+
noteRejectedResume: (context, apiErrorStatus, resultText) => {
|
|
26885
|
+
const { launch } = context;
|
|
26886
|
+
if (!launch.resumed || context.launchConfirmed || apiErrorStatus !== 400) return;
|
|
26887
|
+
const text2 = resultText?.trim();
|
|
26888
|
+
if (text2 !== void 0 && text2.startsWith(GATEWAY_REBOUND_PREFIX) && text2.includes(GATEWAY_REBOUND_PHRASE))
|
|
26889
|
+
reasons.set(launch.sessionId, "missing");
|
|
26890
|
+
},
|
|
26862
26891
|
/** CLI 写给 stderr 的尾巴,逐行整行比。 */
|
|
26863
26892
|
noteStderr: (context, stderr) => noteDiagnostics(context, stderr.split(/\r?\n/u)),
|
|
26864
26893
|
/** 进程自己退了(不是宿主停的):新会话还没建立就退,预先定的号作废。 */
|
|
@@ -28290,6 +28319,8 @@ var makeTurnMessageHandlers = (deps) => {
|
|
|
28290
28319
|
if (status === "failed") {
|
|
28291
28320
|
if ("errors" in message && Array.isArray(message.errors))
|
|
28292
28321
|
unresumableSessions.noteResultErrors(context, message.errors);
|
|
28322
|
+
if ("result" in message)
|
|
28323
|
+
unresumableSessions.noteRejectedResume(context, message.api_error_status, message.result);
|
|
28293
28324
|
const missingConversation = unresumableSessions.reasonFor(context.launch.sessionId) === "missing";
|
|
28294
28325
|
if (suppressStartupFailure(context, missingConversation)) return;
|
|
28295
28326
|
await emitRuntimeError(context, errorMessage ?? "Claude turn failed.", void 0, category);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-claude",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5029",
|
|
4
4
|
"description": "Claude executor: Claude Code CLI via @anthropic-ai/claude-agent-sdk.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@types/node": "24.12.4",
|
|
25
25
|
"esbuild": "0.28.1",
|
|
26
26
|
"vite-plus": "0.2.2",
|
|
27
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
27
|
+
"@ycodium-ai/plugin-api": "0.2.5029",
|
|
28
28
|
"ycodium-composer-tokens": "0.0.0",
|
|
29
|
-
"ycodium-
|
|
30
|
-
"ycodium-
|
|
29
|
+
"ycodium-executor-testing": "0.0.0",
|
|
30
|
+
"ycodium-jsonl-stream": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"ycodium": {
|
|
33
33
|
"plugin": "./dist/index.js",
|