duclaw-cli 1.8.7 → 1.8.8
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/bundle.js
CHANGED
|
@@ -30242,7 +30242,7 @@ function printHelp() {
|
|
|
30242
30242
|
`);
|
|
30243
30243
|
}
|
|
30244
30244
|
function printVersion() {
|
|
30245
|
-
console.log(`duclaw-cli v${true ? "1.8.
|
|
30245
|
+
console.log(`duclaw-cli v${true ? "1.8.8" : "unknown"}`);
|
|
30246
30246
|
}
|
|
30247
30247
|
function getDuclawTemplate() {
|
|
30248
30248
|
return {
|
|
@@ -32616,6 +32616,7 @@ var chokidar_default = { watch, FSWatcher };
|
|
|
32616
32616
|
var import_node_cron = __toESM(require_node_cron());
|
|
32617
32617
|
|
|
32618
32618
|
// src/agent/createAgent.ts
|
|
32619
|
+
var import_node_crypto9 = require("node:crypto");
|
|
32619
32620
|
var import_node_fs6 = require("node:fs");
|
|
32620
32621
|
|
|
32621
32622
|
// src/background/BackgroundManager.ts
|
|
@@ -37568,7 +37569,7 @@ var createAnthropicAdapter = (options) => {
|
|
|
37568
37569
|
} : {}
|
|
37569
37570
|
});
|
|
37570
37571
|
return {
|
|
37571
|
-
async chat(messages, system, tools) {
|
|
37572
|
+
async chat(messages, system, tools, chatOptions) {
|
|
37572
37573
|
const sanitizedMessages = sanitizeToolProtocolMessages(messages);
|
|
37573
37574
|
if (sanitizedMessages.length === 0) {
|
|
37574
37575
|
throw new Error(`[AnthropicAdapter] messages \u4E3A\u7A7A\uFF1A\u6D88\u606F\u5386\u53F2\u6E05\u6D17\u540E\u6CA1\u6709\u53EF\u53D1\u9001\u7684 user \u6D88\u606F`);
|
|
@@ -37582,7 +37583,11 @@ var createAnthropicAdapter = (options) => {
|
|
|
37582
37583
|
tools,
|
|
37583
37584
|
max_tokens: options.maxTokens || 16384,
|
|
37584
37585
|
stream: false
|
|
37585
|
-
}
|
|
37586
|
+
}, chatOptions?.requestId ? {
|
|
37587
|
+
headers: {
|
|
37588
|
+
"X-Duclaw-Request-Id": chatOptions.requestId
|
|
37589
|
+
}
|
|
37590
|
+
} : void 0);
|
|
37586
37591
|
if (!sdkResponse.stop_reason) {
|
|
37587
37592
|
console.error(`${sdkResponse}`);
|
|
37588
37593
|
throw new Error(`[AnthropicAdapter\u5F02\u5E38] \u672A\u77E5\u5F02\u5E38: sdkResponse.stop_reason \u4E3A ${sdkResponse.stop_reason}`);
|
|
@@ -40727,6 +40732,8 @@ function buildImageUnderstandMeteringPayload(input) {
|
|
|
40727
40732
|
toolCallId: stringValue(metadata.toolCallId),
|
|
40728
40733
|
promptChars: input.prompt.length,
|
|
40729
40734
|
resultChars: input.resultText.length,
|
|
40735
|
+
usage: input.usage ?? null,
|
|
40736
|
+
providerResponseId: stringValue(input.providerResponseId),
|
|
40730
40737
|
platform: stringValue(input.userRequest?.platform),
|
|
40731
40738
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
40732
40739
|
metadata: {
|
|
@@ -40884,6 +40891,8 @@ var imageUnderstand = {
|
|
|
40884
40891
|
prompt,
|
|
40885
40892
|
resultText,
|
|
40886
40893
|
imageSource,
|
|
40894
|
+
usage: response.usage,
|
|
40895
|
+
providerResponseId: response.providerResponseId,
|
|
40887
40896
|
authStyle,
|
|
40888
40897
|
userRequest
|
|
40889
40898
|
});
|
|
@@ -44493,6 +44502,10 @@ var assistantMessageFromResponse = (response) => ({
|
|
|
44493
44502
|
...response.providerResponseId ? { providerResponseId: response.providerResponseId } : {},
|
|
44494
44503
|
...response.model ? { model: response.model } : {}
|
|
44495
44504
|
});
|
|
44505
|
+
var llmRequestIdForTurn = (request, messages, system, tools) => {
|
|
44506
|
+
const hash = (0, import_node_crypto9.createHash)("sha256").update(request.requestId).update("\0").update(system).update("\0").update(JSON.stringify(messages)).update("\0").update(JSON.stringify(tools.map((tool) => tool.name).sort())).digest("hex").slice(0, 40);
|
|
44507
|
+
return `dreq_${hash}`;
|
|
44508
|
+
};
|
|
44496
44509
|
var getDefaultAgentConfig = (tools, systemPrompt) => {
|
|
44497
44510
|
loadEnv();
|
|
44498
44511
|
(0, import_node_fs6.mkdirSync)(DEFAULT_WORKSPACE_PATH, { recursive: true });
|
|
@@ -44956,7 +44969,8 @@ ${memoryInjection}` : "") + dreamInjection;
|
|
|
44956
44969
|
response = await llm.chat(
|
|
44957
44970
|
messages,
|
|
44958
44971
|
effectiveSystemPrompt,
|
|
44959
|
-
tools
|
|
44972
|
+
tools,
|
|
44973
|
+
{ requestId: llmRequestIdForTurn(request, messages, effectiveSystemPrompt, tools) }
|
|
44960
44974
|
);
|
|
44961
44975
|
} catch (error) {
|
|
44962
44976
|
if (compactConfig.enabled && isPromptTooLongError(error) && contextRecoveryAttempts < compactConfig.maxFailures) {
|
|
@@ -50739,7 +50753,7 @@ var systemRoutes = new Hono2();
|
|
|
50739
50753
|
var startTime = Date.now();
|
|
50740
50754
|
systemRoutes.get("/system/info", (c) => {
|
|
50741
50755
|
return c.json({
|
|
50742
|
-
version: true ? "1.8.
|
|
50756
|
+
version: true ? "1.8.8" : "unknown",
|
|
50743
50757
|
uptime: Math.floor((Date.now() - startTime) / 1e3),
|
|
50744
50758
|
env: process.env.NODE_ENV || "development",
|
|
50745
50759
|
nodeVersion: process.version
|