@ycodium-ai/agent-claude 0.2.2908 → 0.2.2922
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 +20 -15
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -21128,6 +21128,17 @@ var EventBus = class {
|
|
|
21128
21128
|
}
|
|
21129
21129
|
};
|
|
21130
21130
|
|
|
21131
|
+
// src/steerTarget.ts
|
|
21132
|
+
function assertSteeringTarget(expectedTurnId, turnState) {
|
|
21133
|
+
if (expectedTurnId === void 0) return;
|
|
21134
|
+
if (turnState?.turnId === expectedTurnId && turnState.synthetic !== true) return;
|
|
21135
|
+
const rejected = Object.assign(
|
|
21136
|
+
new Error("The target turn has ended. The message was not sent."),
|
|
21137
|
+
{ code: "provider-rejected" }
|
|
21138
|
+
);
|
|
21139
|
+
throw rejected;
|
|
21140
|
+
}
|
|
21141
|
+
|
|
21131
21142
|
// src/sdkModels.ts
|
|
21132
21143
|
import * as NodeOS5 from "node:os";
|
|
21133
21144
|
import { REASONING_OPTION_LABEL as REASONING_OPTION_LABEL2, reasoningEffortShortLabel } from "@ycodium-ai/plugin-api/executor";
|
|
@@ -24705,6 +24716,7 @@ function toClaudeMcpServers(entries) {
|
|
|
24705
24716
|
}
|
|
24706
24717
|
function createClaudeAdapter(recipe, host, options) {
|
|
24707
24718
|
const boundInstanceId = options?.instanceId ?? host.instanceId ?? "claudeAgent";
|
|
24719
|
+
const now = options?.now ?? (() => Date.now());
|
|
24708
24720
|
const claudeHomeEnvironment = makeClaudeEnvironment(recipe, options?.environment);
|
|
24709
24721
|
const claudeSdkExecutablePath = resolveClaudeSdkExecutablePath(
|
|
24710
24722
|
recipe.binaryPath,
|
|
@@ -24728,9 +24740,9 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
24728
24740
|
let modelCatalogFailedAt;
|
|
24729
24741
|
const currentModelCatalog = () => modelCatalog?.models ?? [];
|
|
24730
24742
|
const refreshModelCatalog = (input) => {
|
|
24731
|
-
const fresh = modelCatalog !== void 0 &&
|
|
24743
|
+
const fresh = modelCatalog !== void 0 && now() - modelCatalog.readAt < CLAUDE_SDK_MODELS_TTL_MS;
|
|
24732
24744
|
if (fresh && input?.force !== true) return Promise.resolve();
|
|
24733
|
-
if (input?.force !== true && modelCatalogFailedAt !== void 0 &&
|
|
24745
|
+
if (input?.force !== true && modelCatalogFailedAt !== void 0 && now() - modelCatalogFailedAt < CLAUDE_SDK_MODELS_RETRY_MS) {
|
|
24734
24746
|
return Promise.resolve();
|
|
24735
24747
|
}
|
|
24736
24748
|
if (modelCatalogRead !== void 0) return modelCatalogRead;
|
|
@@ -24748,10 +24760,10 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
24748
24760
|
}
|
|
24749
24761
|
});
|
|
24750
24762
|
if (models === void 0) {
|
|
24751
|
-
modelCatalogFailedAt =
|
|
24763
|
+
modelCatalogFailedAt = now();
|
|
24752
24764
|
} else {
|
|
24753
24765
|
modelCatalogFailedAt = void 0;
|
|
24754
|
-
modelCatalog = { models: claudeCatalogFromSdk(models), readAt:
|
|
24766
|
+
modelCatalog = { models: claudeCatalogFromSdk(models), readAt: now() };
|
|
24755
24767
|
}
|
|
24756
24768
|
})().finally(() => {
|
|
24757
24769
|
modelCatalogRead = void 0;
|
|
@@ -24762,8 +24774,8 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
24762
24774
|
const declaredModels = [CLAUDE_CARD.defaultModel];
|
|
24763
24775
|
const sessions = /* @__PURE__ */ new Map();
|
|
24764
24776
|
const runtimeEventQueue = new EventBus();
|
|
24765
|
-
const nowIso = () =>
|
|
24766
|
-
const randomUUIDv4 = () => crypto.randomUUID();
|
|
24777
|
+
const nowIso = () => new Date(now()).toISOString();
|
|
24778
|
+
const randomUUIDv4 = options?.randomId ?? (() => crypto.randomUUID());
|
|
24767
24779
|
const makeEventStamp = async () => ({ eventId: randomUUIDv4(), createdAt: nowIso() });
|
|
24768
24780
|
const offerRuntimeEvent = (context, event) => {
|
|
24769
24781
|
runtimeEventQueue.push({
|
|
@@ -24967,9 +24979,6 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
24967
24979
|
}
|
|
24968
24980
|
};
|
|
24969
24981
|
const emitRuntimeError = async (context, message, cause) => {
|
|
24970
|
-
if (cause !== void 0) {
|
|
24971
|
-
void cause;
|
|
24972
|
-
}
|
|
24973
24982
|
const turnState = context.turnState;
|
|
24974
24983
|
const stamp = await makeEventStamp();
|
|
24975
24984
|
offerRuntimeEvent(context, {
|
|
@@ -25786,7 +25795,7 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
25786
25795
|
usageLimit: {
|
|
25787
25796
|
rejected: context.turnState.rejectedRateLimits,
|
|
25788
25797
|
latestAssistantRateLimited: context.turnState.latestAssistantRateLimited,
|
|
25789
|
-
nowMs:
|
|
25798
|
+
nowMs: now()
|
|
25790
25799
|
}
|
|
25791
25800
|
}
|
|
25792
25801
|
})
|
|
@@ -27172,11 +27181,7 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
27172
27181
|
};
|
|
27173
27182
|
const sendTurn = async (input) => {
|
|
27174
27183
|
const context = requireSession(input.threadId);
|
|
27175
|
-
const validateSteeringTarget = () =>
|
|
27176
|
-
if (input.expectedTurnId !== void 0 && (context.turnState?.turnId !== input.expectedTurnId || context.turnState.synthetic === true)) {
|
|
27177
|
-
throw new Error("The target turn has ended. The message was not sent.");
|
|
27178
|
-
}
|
|
27179
|
-
};
|
|
27184
|
+
const validateSteeringTarget = () => assertSteeringTarget(input.expectedTurnId, context.turnState);
|
|
27180
27185
|
validateSteeringTarget();
|
|
27181
27186
|
const modelSelection = boundModelSelection(input.modelSelection, boundInstanceId);
|
|
27182
27187
|
const steeringTurnState = context.turnState && context.turnState.synthetic !== true ? context.turnState : null;
|
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.2922",
|
|
4
4
|
"description": "Claude executor: Claude Code CLI via @anthropic-ai/claude-agent-sdk.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -24,9 +24,9 @@
|
|
|
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.2908",
|
|
28
|
-
"ycodium-composer-tokens": "0.0.0",
|
|
29
27
|
"ycodium-executor-testing": "0.0.0",
|
|
28
|
+
"@ycodium-ai/plugin-api": "0.2.2922",
|
|
29
|
+
"ycodium-composer-tokens": "0.0.0",
|
|
30
30
|
"ycodium-jsonl-stream": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"ycodium": {
|