@ethosagent/core 0.3.5 → 0.3.7
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.d.ts +40 -3
- package/dist/index.js +159 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _ethosagent_types from '@ethosagent/types';
|
|
2
|
-
import { ClarifyStore, PendingClarify, ClarifyResponse, ClarifyAnswerableBy, ClarifySurfaceType, PersonalityObservabilityConfig, SpanKind, EventSeverity, HookRegistry, LLMProvider, ToolRegistry, PersonalityRegistry, MemoryProvider, SessionStore, ContextInjector, Storage, ContextEngineRegistry, RequestDumpStore, SteerSink, Attachment, KeyValueStore, SecretRef, ToolCapabilities, ToolContext, Tool, PersonalityConfig, ContextEngine, ContextEngineCompactInput, ContextEngineCompactOutput, Message, Session, SessionFilter, StoredMessage, SessionUsage, SearchResult, CompressionEvent, MemoryContext, MemorySnapshot, MemoryEntry, SearchOpts, MemoryUpdate, ListOpts, MemoryEntryRef, VoidHooks, ModifyingHooks, ClaimingHooks, ToolDefinitionLite, CompletionOptions, CompletionChunk, LLMProviderRegistry, LLMProviderFactory, MemoryProviderRegistry, MemoryProviderFactory, RequestDumpRecord, ScopedFetch, ScopedFs, ScopedFsEntry, ScopedProcess, SpawnOpts, ProcessResult, ScopedSecretsResolver, ToolFilterOpts
|
|
2
|
+
import { ClarifyStore, PendingClarify, ClarifyResponse, ClarifyAnswerableBy, ClarifySurfaceType, PersonalityObservabilityConfig, SpanKind, EventSeverity, HookRegistry, LLMProvider, ToolRegistry, PersonalityRegistry, MemoryProvider, SessionStore, ContextInjector, Storage, ContextEngineRegistry, RequestDumpStore, SteerSink, Attachment, KeyValueStore, SecretRef, ToolCapabilities, ToolContext, Tool, PersonalityConfig, ContextEngine, ContextEngineCompactInput, ContextEngineCompactOutput, Message, Session, SessionFilter, StoredMessage, SessionUsage, SearchResult, CompressionEvent, MemoryContext, MemorySnapshot, MemoryEntry, SearchOpts, MemoryUpdate, ListOpts, MemoryEntryRef, ToolResult, VoidHooks, ModifyingHooks, ClaimingHooks, ToolDefinitionLite, CompletionOptions, CompletionChunk, LLMProviderRegistry, LLMProviderFactory, MemoryProviderRegistry, MemoryProviderFactory, RequestDumpRecord, ScopedFetch, ScopedFs, ScopedFsEntry, ScopedProcess, SpawnOpts, ProcessResult, ScopedSecretsResolver, ToolFilterOpts } from '@ethosagent/types';
|
|
3
3
|
export { MemoryConflictError } from '@ethosagent/types';
|
|
4
4
|
import * as _ethosagent_safety_watcher from '@ethosagent/safety-watcher';
|
|
5
5
|
import { InjectionClassifier } from '@ethosagent/safety-injection';
|
|
@@ -150,7 +150,7 @@ interface AgentLoopObservability {
|
|
|
150
150
|
flush(): void;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
declare const KNOWN_AGENT_EVENT_TYPES: readonly ["text_delta", "thinking_delta", "tool_start", "tool_progress", "tool_end", "usage", "error", "done", "context_meta", "run_start"];
|
|
153
|
+
declare const KNOWN_AGENT_EVENT_TYPES: readonly ["text_delta", "thinking_delta", "tool_start", "tool_progress", "tool_end", "usage", "error", "done", "context_meta", "run_start", "dry_run_summary"];
|
|
154
154
|
type KnownAgentEventType = (typeof KNOWN_AGENT_EVENT_TYPES)[number];
|
|
155
155
|
/**
|
|
156
156
|
* Returns true when the event's `type` is one a current consumer knows
|
|
@@ -170,6 +170,11 @@ type KnownAgentEventType = (typeof KNOWN_AGENT_EVENT_TYPES)[number];
|
|
|
170
170
|
declare function isKnownAgentEvent(event: {
|
|
171
171
|
type: string;
|
|
172
172
|
}): event is AgentEvent;
|
|
173
|
+
interface DryRunToolPlan {
|
|
174
|
+
toolCallId: string;
|
|
175
|
+
toolName: string;
|
|
176
|
+
args: unknown;
|
|
177
|
+
}
|
|
173
178
|
type AgentEvent = {
|
|
174
179
|
type: 'text_delta';
|
|
175
180
|
text: string;
|
|
@@ -230,6 +235,10 @@ type AgentEvent = {
|
|
|
230
235
|
provider: string;
|
|
231
236
|
model: string;
|
|
232
237
|
source: 'team-coordinator' | 'team-personality' | 'personality' | 'global';
|
|
238
|
+
} | {
|
|
239
|
+
type: 'dry_run_summary';
|
|
240
|
+
plan: DryRunToolPlan[];
|
|
241
|
+
capped: number;
|
|
233
242
|
};
|
|
234
243
|
interface AgentLoopConfig {
|
|
235
244
|
llm: LLMProvider;
|
|
@@ -353,6 +362,14 @@ interface RunOptions {
|
|
|
353
362
|
sessionKey?: string;
|
|
354
363
|
personalityId?: string;
|
|
355
364
|
abortSignal?: AbortSignal;
|
|
365
|
+
/** Sampling temperature forwarded to the LLM provider. */
|
|
366
|
+
temperature?: number;
|
|
367
|
+
/** Top-P (nucleus sampling) forwarded to the LLM provider. */
|
|
368
|
+
topP?: number;
|
|
369
|
+
/** Maps to CompletionOptions.maxTokens — separate name to avoid collision with AgentLoop's own maxTokens semantics. */
|
|
370
|
+
maxCompletionTokens?: number;
|
|
371
|
+
/** RNG seed forwarded to providers that support it (e.g. OpenAI-compat). */
|
|
372
|
+
seed?: number;
|
|
356
373
|
/**
|
|
357
374
|
* Identifier surfaced to tools as `ToolContext.agentId`. Delegation tools
|
|
358
375
|
* use this to thread spawn depth (`depth:N`) into child loops so
|
|
@@ -379,6 +396,8 @@ interface RunOptions {
|
|
|
379
396
|
* Consumed once; does not persist across runs.
|
|
380
397
|
*/
|
|
381
398
|
tierOverride?: _ethosagent_types.ModelTierName;
|
|
399
|
+
dryRun?: boolean;
|
|
400
|
+
dryRunMaxToolCalls?: number;
|
|
382
401
|
}
|
|
383
402
|
declare class AgentLoop {
|
|
384
403
|
private readonly llm;
|
|
@@ -452,6 +471,20 @@ declare class AgentLoop {
|
|
|
452
471
|
|
|
453
472
|
declare function buildAttachmentAnnotation(attachments: Attachment[]): string;
|
|
454
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Derive a stable `botKey` from an opaque seed string.
|
|
476
|
+
*
|
|
477
|
+
* Returns the first 24 hex chars of sha256(seed) — 96 bits, wide enough
|
|
478
|
+
* that birthday collisions are cosmologically unlikely. The value is used
|
|
479
|
+
* as a routing/lane key and as a duplicate-detection key in bot binding
|
|
480
|
+
* validation.
|
|
481
|
+
*
|
|
482
|
+
* Every adapter and config layer that needs a stable bot identity must
|
|
483
|
+
* call this function rather than rolling its own hash. Two sources of
|
|
484
|
+
* truth for the algorithm means two sources of divergence.
|
|
485
|
+
*/
|
|
486
|
+
declare function deriveBotKey(seed: string): string;
|
|
487
|
+
|
|
455
488
|
interface CapabilityBackends {
|
|
456
489
|
kvStoreFactory?: (tool: string, scopeId: string) => KeyValueStore;
|
|
457
490
|
secretsBackend?: (ref: SecretRef) => Promise<string>;
|
|
@@ -609,6 +642,10 @@ declare class DefaultPersonalityRegistry implements PersonalityRegistry {
|
|
|
609
642
|
remove(id: string): void;
|
|
610
643
|
}
|
|
611
644
|
|
|
645
|
+
declare function redactArgs(args: unknown): unknown;
|
|
646
|
+
declare function synthesizeDryRunResult(toolName: string, args: unknown): ToolResult;
|
|
647
|
+
declare function synthesizeDryRunCapResult(_toolName: string, cap: number): ToolResult;
|
|
648
|
+
|
|
612
649
|
declare class DefaultHookRegistry implements HookRegistry {
|
|
613
650
|
private readonly voidHandlers;
|
|
614
651
|
private readonly modifyingHandlers;
|
|
@@ -983,4 +1020,4 @@ declare class SsrfError extends Error {
|
|
|
983
1020
|
*/
|
|
984
1021
|
declare function validateUrl(urlStr: string, opts?: ValidateUrlOptions): URL;
|
|
985
1022
|
|
|
986
|
-
export { type AgentEvent, AgentLoop, type AgentLoopConfig, type AgentLoopObservability, BoundaryEscapeError, type CapabilityBackends, type CapabilityScopeIds, type CapabilityValidationError, ChainedProvider, type ChainedProviderOptions, ClarifyBridge, ClarifyBusyError, ClarifyNoSurfaceError, type ClarifyPresenter, type ClarifyRequestInput, type ClarifyResolvedListener, ClarifyTimedOutNoDefaultError, DefaultContextEngineRegistry, type DefaultContextEngineRegistryOptions, DefaultHookRegistry, DefaultLLMProviderRegistry, DefaultMemoryProviderRegistry, DefaultPersonalityRegistry, DefaultToolRegistry, DropOldestEngine, EagerPrefetchPolicy, FileClarifyStore, InMemoryRequestDumpStore, InMemorySessionStore, type InMemoryToolContextOptions, KNOWN_AGENT_EVENT_TYPES, type KnownAgentEventType, LastWriteWinsPolicy, LazyOnDemandPolicy, NoopMemoryProvider, type PluginFactory, PluginRegistry, ReferencePreservingEngine, type RunOptions, ScopedFetchImpl, ScopedFsImpl, ScopedProcessImpl, ScopedSecretsImpl, type SecretsBackend, SemanticSummaryEngine, SsrfError, type SummarizerFn, type ValidateUrlOptions, assertWithinBase, buildAttachmentAnnotation, estimateMessageTokens, estimateMessagesTokens, estimateTokens, isKnownAgentEvent, makeTestToolContext, resolveCapabilities, stripAnsiEscapes, validateRegistration, validateUrl };
|
|
1023
|
+
export { type AgentEvent, AgentLoop, type AgentLoopConfig, type AgentLoopObservability, BoundaryEscapeError, type CapabilityBackends, type CapabilityScopeIds, type CapabilityValidationError, ChainedProvider, type ChainedProviderOptions, ClarifyBridge, ClarifyBusyError, ClarifyNoSurfaceError, type ClarifyPresenter, type ClarifyRequestInput, type ClarifyResolvedListener, ClarifyTimedOutNoDefaultError, DefaultContextEngineRegistry, type DefaultContextEngineRegistryOptions, DefaultHookRegistry, DefaultLLMProviderRegistry, DefaultMemoryProviderRegistry, DefaultPersonalityRegistry, DefaultToolRegistry, DropOldestEngine, type DryRunToolPlan, EagerPrefetchPolicy, FileClarifyStore, InMemoryRequestDumpStore, InMemorySessionStore, type InMemoryToolContextOptions, KNOWN_AGENT_EVENT_TYPES, type KnownAgentEventType, LastWriteWinsPolicy, LazyOnDemandPolicy, NoopMemoryProvider, type PluginFactory, PluginRegistry, ReferencePreservingEngine, type RunOptions, ScopedFetchImpl, ScopedFsImpl, ScopedProcessImpl, ScopedSecretsImpl, type SecretsBackend, SemanticSummaryEngine, SsrfError, type SummarizerFn, type ValidateUrlOptions, assertWithinBase, buildAttachmentAnnotation, deriveBotKey, estimateMessageTokens, estimateMessagesTokens, estimateTokens, isKnownAgentEvent, makeTestToolContext, redactArgs, resolveCapabilities, stripAnsiEscapes, synthesizeDryRunCapResult, synthesizeDryRunResult, validateRegistration, validateUrl };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __esm = (fn, res) => function __init() {
|
|
4
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
+
};
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/dry-run.ts
|
|
12
|
+
var dry_run_exports = {};
|
|
13
|
+
__export(dry_run_exports, {
|
|
14
|
+
redactArgs: () => redactArgs,
|
|
15
|
+
synthesizeDryRunCapResult: () => synthesizeDryRunCapResult,
|
|
16
|
+
synthesizeDryRunResult: () => synthesizeDryRunResult
|
|
17
|
+
});
|
|
18
|
+
import { redactString } from "@ethosagent/safety-redact";
|
|
19
|
+
function redactArgs(args) {
|
|
20
|
+
if (typeof args === "string") {
|
|
21
|
+
const redacted = redactString(args);
|
|
22
|
+
if (redacted.length > MAX_STRING_LENGTH) {
|
|
23
|
+
return `${redacted.slice(0, MAX_STRING_LENGTH)}...[truncated, ${redacted.length} chars]`;
|
|
24
|
+
}
|
|
25
|
+
return redacted;
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(args)) {
|
|
28
|
+
return args.map(redactArgs);
|
|
29
|
+
}
|
|
30
|
+
if (args !== null && typeof args === "object") {
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const [k, v] of Object.entries(args)) {
|
|
33
|
+
out[k] = redactArgs(v);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
return args;
|
|
38
|
+
}
|
|
39
|
+
function synthesizeDryRunResult(toolName, args) {
|
|
40
|
+
const redacted = redactArgs(args);
|
|
41
|
+
return {
|
|
42
|
+
ok: true,
|
|
43
|
+
value: `[dry-run] ${toolName} would be called with: ${JSON.stringify(redacted)}`
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function synthesizeDryRunCapResult(_toolName, cap) {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
error: `[dry-run] tool call cap (${cap}) reached \u2014 stopping tool execution for this turn`,
|
|
50
|
+
code: "not_available"
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
var MAX_STRING_LENGTH;
|
|
54
|
+
var init_dry_run = __esm({
|
|
55
|
+
"src/dry-run.ts"() {
|
|
56
|
+
"use strict";
|
|
57
|
+
MAX_STRING_LENGTH = 500;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
1
61
|
// src/agent-loop.ts
|
|
2
62
|
import { createHash as createHash3, randomUUID } from "crypto";
|
|
3
63
|
import { homedir as homedir2 } from "os";
|
|
@@ -141,6 +201,9 @@ function encodeAttr(value) {
|
|
|
141
201
|
return value.replace(/[\r\n]+/g, " ").replace(/[<>]/g, "").replace(/"/g, "'").slice(0, 256);
|
|
142
202
|
}
|
|
143
203
|
|
|
204
|
+
// src/agent-loop.ts
|
|
205
|
+
import { redactString as redactString2 } from "@ethosagent/safety-redact";
|
|
206
|
+
|
|
144
207
|
// ../storage-fs/src/default-deny.ts
|
|
145
208
|
import { homedir } from "os";
|
|
146
209
|
function defaultAlwaysDeny() {
|
|
@@ -168,6 +231,38 @@ function defaultAlwaysDeny() {
|
|
|
168
231
|
];
|
|
169
232
|
}
|
|
170
233
|
|
|
234
|
+
// ../storage-fs/src/env-secrets.ts
|
|
235
|
+
import { readFileSync } from "fs";
|
|
236
|
+
var ENV_TO_REF = {
|
|
237
|
+
ANTHROPIC_API_KEY: "providers/anthropic/apiKey",
|
|
238
|
+
OPENAI_API_KEY: "providers/openai/apiKey",
|
|
239
|
+
OPENROUTER_API_KEY: "providers/openrouter/apiKey",
|
|
240
|
+
GEMINI_API_KEY: "providers/gemini/apiKey",
|
|
241
|
+
GROQ_API_KEY: "providers/groq/apiKey",
|
|
242
|
+
DEEPSEEK_API_KEY: "providers/deepseek/apiKey",
|
|
243
|
+
OLLAMA_HOST: "providers/ollama/host",
|
|
244
|
+
EXA_API_KEY: "providers/exa/apiKey",
|
|
245
|
+
REPLICATE_API_TOKEN: "providers/replicate/apiToken",
|
|
246
|
+
TELEGRAM_BOT_TOKEN: "channels/telegram/default/botToken",
|
|
247
|
+
SLACK_BOT_TOKEN: "channels/slack/default/botToken",
|
|
248
|
+
SLACK_APP_TOKEN: "channels/slack/default/appToken",
|
|
249
|
+
SLACK_SIGNING_SECRET: "channels/slack/default/signingSecret",
|
|
250
|
+
DISCORD_BOT_TOKEN: "channels/discord/default/botToken",
|
|
251
|
+
WHATSAPP_ACCESS_TOKEN: "channels/whatsapp/default/accessToken",
|
|
252
|
+
WHATSAPP_PHONE_NUMBER_ID: "channels/whatsapp/default/phoneNumberId",
|
|
253
|
+
SMTP_HOST: "channels/email/default/smtp/host",
|
|
254
|
+
SMTP_PORT: "channels/email/default/smtp/port",
|
|
255
|
+
SMTP_USER: "channels/email/default/smtp/user",
|
|
256
|
+
SMTP_PASSWORD: "channels/email/default/smtp/password",
|
|
257
|
+
IMAP_HOST: "channels/email/default/imap/host",
|
|
258
|
+
IMAP_USER: "channels/email/default/imap/user",
|
|
259
|
+
IMAP_PASSWORD: "channels/email/default/imap/password"
|
|
260
|
+
};
|
|
261
|
+
var REF_TO_ENV = /* @__PURE__ */ new Map();
|
|
262
|
+
for (const [envKey, ref] of Object.entries(ENV_TO_REF)) {
|
|
263
|
+
REF_TO_ENV.set(ref, envKey);
|
|
264
|
+
}
|
|
265
|
+
|
|
171
266
|
// ../storage-fs/src/fs-attachment-cache.ts
|
|
172
267
|
import { createHash } from "crypto";
|
|
173
268
|
import { join, resolve, sep } from "path";
|
|
@@ -672,6 +767,9 @@ var DefaultPersonalityRegistry = class {
|
|
|
672
767
|
}
|
|
673
768
|
};
|
|
674
769
|
|
|
770
|
+
// src/agent-loop.ts
|
|
771
|
+
init_dry_run();
|
|
772
|
+
|
|
675
773
|
// src/hook-registry.ts
|
|
676
774
|
function isAllowed(h, allowedPlugins) {
|
|
677
775
|
if (allowedPlugins === void 0) return true;
|
|
@@ -1557,6 +1655,14 @@ var DefaultToolRegistry = class {
|
|
|
1557
1655
|
}
|
|
1558
1656
|
};
|
|
1559
1657
|
}
|
|
1658
|
+
if (ctx.dryRun) {
|
|
1659
|
+
const { synthesizeDryRunResult: synthesizeDryRunResult2 } = await Promise.resolve().then(() => (init_dry_run(), dry_run_exports));
|
|
1660
|
+
return {
|
|
1661
|
+
toolCallId: call.toolCallId,
|
|
1662
|
+
name: call.name,
|
|
1663
|
+
result: synthesizeDryRunResult2(call.name, call.args)
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1560
1666
|
const budget = Math.min(perCallBudget, entry.tool.maxResultChars ?? perCallBudget);
|
|
1561
1667
|
const toolCtx = { ...ctx, resultBudgetChars: budget };
|
|
1562
1668
|
try {
|
|
@@ -1622,7 +1728,8 @@ var KNOWN_AGENT_EVENT_TYPES = [
|
|
|
1622
1728
|
"error",
|
|
1623
1729
|
"done",
|
|
1624
1730
|
"context_meta",
|
|
1625
|
-
"run_start"
|
|
1731
|
+
"run_start",
|
|
1732
|
+
"dry_run_summary"
|
|
1626
1733
|
];
|
|
1627
1734
|
function isKnownAgentEvent(event) {
|
|
1628
1735
|
return KNOWN_AGENT_EVENT_TYPES.includes(event.type);
|
|
@@ -1895,7 +2002,7 @@ ${text}` : text;
|
|
|
1895
2002
|
const heading = orderHints[e.key] ?? e.key;
|
|
1896
2003
|
blocks.push(`## ${heading}
|
|
1897
2004
|
|
|
1898
|
-
${e.content.trim()}`);
|
|
2005
|
+
${redactString2(e.content.trim())}`);
|
|
1899
2006
|
}
|
|
1900
2007
|
if (blocks.length > 0) {
|
|
1901
2008
|
let rendered = `## Memory
|
|
@@ -1926,6 +2033,11 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
1926
2033
|
if (buildResult.prependSystem) systemParts.unshift(buildResult.prependSystem);
|
|
1927
2034
|
if (buildResult.appendSystem) systemParts.push(buildResult.appendSystem);
|
|
1928
2035
|
}
|
|
2036
|
+
if (opts.dryRun) {
|
|
2037
|
+
systemParts.push(
|
|
2038
|
+
'IMPORTANT: You are in DRY-RUN mode. Every tool call will be intercepted and return a stub result \u2014 no tool actually executes. Plan your tool calls as normal but do NOT retry or loop when you see "[dry-run]" in the result. After your first batch of tool calls, summarize what you would have done and stop.'
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
1929
2041
|
const systemPrompt = systemParts.join("\n\n").trim() || void 0;
|
|
1930
2042
|
let llmMessages = this.toLLMMessages(this.dedupHistory(history));
|
|
1931
2043
|
const compacted = await this.maybeCompact(llmMessages, systemPrompt ?? "", personality, {
|
|
@@ -1951,6 +2063,10 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
1951
2063
|
let totalToolCalls = 0;
|
|
1952
2064
|
let successfulToolCalls = 0;
|
|
1953
2065
|
const toolNameCounts = /* @__PURE__ */ new Map();
|
|
2066
|
+
const dryRunCap = opts.dryRun ? opts.dryRunMaxToolCalls ?? 5 : Infinity;
|
|
2067
|
+
let dryRunCallCount = 0;
|
|
2068
|
+
let dryRunCapped = 0;
|
|
2069
|
+
const dryRunPlan = [];
|
|
1954
2070
|
const dgConfig = personality.safety?.injectionDefense?.postReadDowngrade;
|
|
1955
2071
|
const dgEnabled = injectionDefenseEnabled && dgConfig?.enabled !== false;
|
|
1956
2072
|
const dgTurns = dgConfig?.turns ?? 2;
|
|
@@ -2078,7 +2194,11 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2078
2194
|
cacheSystemPrompt: true,
|
|
2079
2195
|
abortSignal: combinedSignal,
|
|
2080
2196
|
...iterModelOverride ? { modelOverride: iterModelOverride } : {},
|
|
2081
|
-
...cacheBreakpoints ? { cacheBreakpoints } : {}
|
|
2197
|
+
...cacheBreakpoints ? { cacheBreakpoints } : {},
|
|
2198
|
+
...opts.temperature !== void 0 ? { temperature: opts.temperature } : {},
|
|
2199
|
+
...opts.topP !== void 0 ? { topP: opts.topP } : {},
|
|
2200
|
+
...opts.maxCompletionTokens !== void 0 ? { maxTokens: opts.maxCompletionTokens } : {},
|
|
2201
|
+
...opts.seed !== void 0 ? { seed: opts.seed } : {}
|
|
2082
2202
|
});
|
|
2083
2203
|
for await (const chunk of stream) {
|
|
2084
2204
|
if (abortSignal.aborted) break;
|
|
@@ -2240,6 +2360,7 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2240
2360
|
memoryScope: personality.memoryScope,
|
|
2241
2361
|
memoryScopeId: memScopeId,
|
|
2242
2362
|
...this.teamId !== void 0 && { teamId: this.teamId },
|
|
2363
|
+
...opts.dryRun ? { dryRun: true } : {},
|
|
2243
2364
|
currentTurn: turnCount,
|
|
2244
2365
|
messageCount: allMessages.length + turnCount,
|
|
2245
2366
|
abortSignal,
|
|
@@ -2351,6 +2472,21 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2351
2472
|
opts.attachments
|
|
2352
2473
|
) : [];
|
|
2353
2474
|
const execResultMap = new Map(execResults.map((r) => [r.toolCallId, r]));
|
|
2475
|
+
if (opts.dryRun) {
|
|
2476
|
+
for (const input of execInputs) {
|
|
2477
|
+
dryRunPlan.push({
|
|
2478
|
+
toolCallId: input.toolCallId,
|
|
2479
|
+
toolName: input.name,
|
|
2480
|
+
args: redactArgs(input.args)
|
|
2481
|
+
});
|
|
2482
|
+
dryRunCallCount++;
|
|
2483
|
+
if (dryRunCallCount >= dryRunCap) {
|
|
2484
|
+
const remaining = execInputs.length - execInputs.indexOf(input) - 1;
|
|
2485
|
+
dryRunCapped += remaining;
|
|
2486
|
+
break;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2354
2490
|
if (typeof personality.model === "object" && personality.provider === this.llm.name) {
|
|
2355
2491
|
for (const r of execResults) {
|
|
2356
2492
|
if (r.name === "think_deeper" && r.result.ok) {
|
|
@@ -2510,6 +2646,13 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2510
2646
|
if (traceId) this.observability?.endTrace(traceId, "ok");
|
|
2511
2647
|
this.observability?.flush();
|
|
2512
2648
|
yield { type: "done", text: fullText, turnCount };
|
|
2649
|
+
if (opts.dryRun && dryRunPlan.length > 0) {
|
|
2650
|
+
yield {
|
|
2651
|
+
type: "dry_run_summary",
|
|
2652
|
+
plan: dryRunPlan,
|
|
2653
|
+
capped: dryRunCapped
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2513
2656
|
}
|
|
2514
2657
|
*handleChunk(chunk, pendingToolCalls, onText) {
|
|
2515
2658
|
switch (chunk.type) {
|
|
@@ -2813,6 +2956,12 @@ function describeSource(toolName, args) {
|
|
|
2813
2956
|
return void 0;
|
|
2814
2957
|
}
|
|
2815
2958
|
|
|
2959
|
+
// src/bot-key.ts
|
|
2960
|
+
import { createHash as createHash4 } from "crypto";
|
|
2961
|
+
function deriveBotKey(seed) {
|
|
2962
|
+
return createHash4("sha256").update(seed).digest("hex").slice(0, 24);
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2816
2965
|
// src/clarify/clarify-bridge.ts
|
|
2817
2966
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2818
2967
|
var ClarifyBusyError = class extends Error {
|
|
@@ -3123,6 +3272,9 @@ function makeTestToolContext(opts) {
|
|
|
3123
3272
|
return ctx;
|
|
3124
3273
|
}
|
|
3125
3274
|
|
|
3275
|
+
// src/index.ts
|
|
3276
|
+
init_dry_run();
|
|
3277
|
+
|
|
3126
3278
|
// src/memory-policies.ts
|
|
3127
3279
|
import { MemoryConflictError } from "@ethosagent/types";
|
|
3128
3280
|
import { MemoryConflictError as MemoryConflictError2 } from "@ethosagent/types";
|
|
@@ -3626,13 +3778,17 @@ export {
|
|
|
3626
3778
|
SsrfError,
|
|
3627
3779
|
assertWithinBase,
|
|
3628
3780
|
buildAttachmentAnnotation,
|
|
3781
|
+
deriveBotKey,
|
|
3629
3782
|
estimateMessageTokens,
|
|
3630
3783
|
estimateMessagesTokens,
|
|
3631
3784
|
estimateTokens,
|
|
3632
3785
|
isKnownAgentEvent,
|
|
3633
3786
|
makeTestToolContext,
|
|
3787
|
+
redactArgs,
|
|
3634
3788
|
resolveCapabilities,
|
|
3635
3789
|
stripAnsiEscapes,
|
|
3790
|
+
synthesizeDryRunCapResult,
|
|
3791
|
+
synthesizeDryRunResult,
|
|
3636
3792
|
validateRegistration,
|
|
3637
3793
|
validateUrl2 as validateUrl
|
|
3638
3794
|
};
|