@nuvin/nuvin-core 1.7.2 → 1.8.0
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/VERSION +2 -2
- package/dist/index.d.ts +49 -1
- package/dist/index.js +201 -29
- package/package.json +1 -1
package/dist/VERSION
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1905,6 +1905,54 @@ declare function okJson<T extends Record<string, unknown> | unknown[], M extends
|
|
|
1905
1905
|
};
|
|
1906
1906
|
declare function err(result: string, metadata?: Record<string, unknown>, errorReason?: ErrorReason): ExecResultError;
|
|
1907
1907
|
|
|
1908
|
+
type CommandSource = 'global' | 'profile' | 'local';
|
|
1909
|
+
interface CustomCommandTemplate {
|
|
1910
|
+
id: string;
|
|
1911
|
+
description: string;
|
|
1912
|
+
prompt: string;
|
|
1913
|
+
enabled?: boolean;
|
|
1914
|
+
source: CommandSource;
|
|
1915
|
+
filePath?: string;
|
|
1916
|
+
}
|
|
1917
|
+
interface CompleteCustomCommand extends CustomCommandTemplate {
|
|
1918
|
+
id: string;
|
|
1919
|
+
description: string;
|
|
1920
|
+
prompt: string;
|
|
1921
|
+
enabled: boolean;
|
|
1922
|
+
source: CommandSource;
|
|
1923
|
+
filePath: string;
|
|
1924
|
+
shadowedBy?: CommandSource;
|
|
1925
|
+
}
|
|
1926
|
+
interface CustomCommandFrontmatter {
|
|
1927
|
+
description: string;
|
|
1928
|
+
enabled?: boolean;
|
|
1929
|
+
}
|
|
1930
|
+
declare function isValidCommandId(id: string): boolean;
|
|
1931
|
+
declare function sanitizeCommandId(name: string): string;
|
|
1932
|
+
|
|
1933
|
+
interface CommandFilePersistenceOptions {
|
|
1934
|
+
globalDir: string;
|
|
1935
|
+
profileDir?: string;
|
|
1936
|
+
localDir: string;
|
|
1937
|
+
}
|
|
1938
|
+
declare class CommandFilePersistence {
|
|
1939
|
+
private globalDir;
|
|
1940
|
+
private profileDir?;
|
|
1941
|
+
private localDir;
|
|
1942
|
+
constructor(options: CommandFilePersistenceOptions);
|
|
1943
|
+
setProfileDir(profileDir: string | undefined): void;
|
|
1944
|
+
getDir(source: CommandSource): string;
|
|
1945
|
+
private ensureDir;
|
|
1946
|
+
loadAll(): Promise<CustomCommandTemplate[]>;
|
|
1947
|
+
private loadFromDir;
|
|
1948
|
+
load(filename: string, source: CommandSource): Promise<CustomCommandTemplate | null>;
|
|
1949
|
+
save(command: CustomCommandTemplate): Promise<void>;
|
|
1950
|
+
delete(commandId: string, source: CommandSource): Promise<void>;
|
|
1951
|
+
exists(commandId: string, source: CommandSource): boolean;
|
|
1952
|
+
private parseFrontmatter;
|
|
1953
|
+
private buildMarkdown;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1908
1956
|
/**
|
|
1909
1957
|
* Sub-agent related types
|
|
1910
1958
|
* These types track the state and execution of delegated specialist agents
|
|
@@ -2255,4 +2303,4 @@ declare function resolveBackspaces(s: string): string;
|
|
|
2255
2303
|
declare function stripAnsiAndControls(s: string): string;
|
|
2256
2304
|
declare function canonicalizeTerminalPaste(raw: string): string;
|
|
2257
2305
|
|
|
2258
|
-
export { AGENT_CREATOR_SYSTEM_PROMPT, AbortError, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM, type AssignErrorResult, type AssignParams, type AssignResult, type AssignSuccessResult$1 as AssignSuccessResult, type AssignTaskArgs, type AssignTaskMetadata, type BaseLLMOptions, type BashErrorResult, type BashParams, type BashResult, type BashSuccessResult$1 as BashSuccessResult, BashTool, type BashToolArgs, type BashToolMetadata, type CommandMetadata, type CompleteAgent, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DEFAULT_RETRY_CONFIG, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationMetadata, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type DirEntry, type DirLsArgs, type DirLsMetadata, type DirLsParams, type DirLsResult, type DirLsSuccessResult$1 as DirLsSuccessResult, type ErrorMetadata, ErrorReason, type ExecResult, type ExecResultError, type ExecResultSuccess, type FileEditArgs, type FileEditMetadata, type FileEditResult, type FileEditSuccessResult$1 as FileEditSuccessResult, type FileMetadata, type FileNewArgs, type FileNewMetadata, type FileNewParams, type FileNewResult, type FileNewSuccessResult$1 as FileNewSuccessResult, type FileReadArgs, type FileReadErrorResult, type FileReadMetadata, type FileReadParams, type FileReadResult, type FileReadSuccessResult$1 as FileReadSuccessResult, type FolderTreeOptions, type FunctionTool, GithubLLM, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type LineRangeMetadata, type MCPConfig, type MCPServerConfig, MCPToolPort, type MemoryPort, MemoryPortMetadataAdapter, type Message, type MessageContent, type MessageContentPart, type MetadataPort, type MetricsChangeHandler, type MetricsPort, type MetricsSnapshot, type ModelInfo, type ModelLimits, NoopMetricsPort, NoopReminders, type OrchestratorAwareToolPort, type ParseResult, PersistedMemory, PersistingConsoleEventPort, type RetryConfig, RetryTransport, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SpecialistAgentConfig, type SpecialistAgentResult, type SubAgentState, type SubAgentToolCall, SystemClock, type TodoWriteArgs, type TodoWriteMetadata, type TodoWriteResult, type TodoWriteSuccessResult$1 as TodoWriteSuccessResult, type ToolApprovalDecision, type ToolArguments, type ToolCall, type ToolCallValidation, type ToolErrorMetadata, type ToolExecutionContext, type ToolExecutionResult, type ToolMetadataMap, type ToolName, type ToolParameterMap, type ToolPort, ToolRegistry, type ToolValidator, type TypedToolInvocation, type UsageData, type UserAttachment, type UserMessagePayload, type ValidationResult, type WebFetchArgs, type WebFetchMetadata, type WebFetchParams, type WebFetchResult, type WebFetchSuccessResult$1 as WebFetchSuccessResult, type WebSearchArgs, type WebSearchMetadata, type WebSearchParams, type WebSearchResult, type WebSearchSuccessResult$1 as WebSearchSuccessResult, type WebSearchToolResult, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, convertToolCall, convertToolCalls, createEmptySnapshot, createLLM, deduplicateModels, err, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderLabel, isAssignResult, isAssignSuccess, isAssignTaskArgs, isBashResult, isBashSuccess, isBashToolArgs, isDirLsArgs, isDirLsResult, isDirLsSuccess, isError, isFileEditArgs, isFileEditResult, isFileEditSuccess, isFileNewArgs, isFileNewResult, isFileNewSuccess, isFileReadArgs, isFileReadResult, isFileReadSuccess, isJsonResult, isRetryableError, isRetryableStatusCode, isSuccess, isSuccessJson, isSuccessText, isTextResult, isTodoWriteArgs, isTodoWriteResult, isTodoWriteSuccess, isWebFetchArgs, isWebFetchResult, isWebFetchSuccess, isWebSearchArgs, isWebSearchResult, isWebSearchSuccess, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, okJson, okText, parseJSON, parseSubAgentToolCallArguments, parseToolArguments, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels, toolValidators };
|
|
2306
|
+
export { AGENT_CREATOR_SYSTEM_PROMPT, AbortError, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM, type AssignErrorResult, type AssignParams, type AssignResult, type AssignSuccessResult$1 as AssignSuccessResult, type AssignTaskArgs, type AssignTaskMetadata, type BaseLLMOptions, type BashErrorResult, type BashParams, type BashResult, type BashSuccessResult$1 as BashSuccessResult, BashTool, type BashToolArgs, type BashToolMetadata, CommandFilePersistence, type CommandMetadata, type CommandSource, type CompleteAgent, type CompleteCustomCommand, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, type CustomCommandFrontmatter, type CustomCommandTemplate, DEFAULT_RETRY_CONFIG, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationMetadata, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, type DirEntry, type DirLsArgs, type DirLsMetadata, type DirLsParams, type DirLsResult, type DirLsSuccessResult$1 as DirLsSuccessResult, type ErrorMetadata, ErrorReason, type ExecResult, type ExecResultError, type ExecResultSuccess, type FileEditArgs, type FileEditMetadata, type FileEditResult, type FileEditSuccessResult$1 as FileEditSuccessResult, type FileMetadata, type FileNewArgs, type FileNewMetadata, type FileNewParams, type FileNewResult, type FileNewSuccessResult$1 as FileNewSuccessResult, type FileReadArgs, type FileReadErrorResult, type FileReadMetadata, type FileReadParams, type FileReadResult, type FileReadSuccessResult$1 as FileReadSuccessResult, type FolderTreeOptions, type FunctionTool, GithubLLM, InMemoryMemory, InMemoryMetadata, InMemoryMetricsPort, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type LineRangeMetadata, type MCPConfig, type MCPServerConfig, MCPToolPort, type MemoryPort, MemoryPortMetadataAdapter, type Message, type MessageContent, type MessageContentPart, type MetadataPort, type MetricsChangeHandler, type MetricsPort, type MetricsSnapshot, type ModelInfo, type ModelLimits, NoopMetricsPort, NoopReminders, type OrchestratorAwareToolPort, type ParseResult, PersistedMemory, PersistingConsoleEventPort, type RetryConfig, RetryTransport, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SpecialistAgentConfig, type SpecialistAgentResult, type SubAgentState, type SubAgentToolCall, SystemClock, type TodoWriteArgs, type TodoWriteMetadata, type TodoWriteResult, type TodoWriteSuccessResult$1 as TodoWriteSuccessResult, type ToolApprovalDecision, type ToolArguments, type ToolCall, type ToolCallValidation, type ToolErrorMetadata, type ToolExecutionContext, type ToolExecutionResult, type ToolMetadataMap, type ToolName, type ToolParameterMap, type ToolPort, ToolRegistry, type ToolValidator, type TypedToolInvocation, type UsageData, type UserAttachment, type UserMessagePayload, type ValidationResult, type WebFetchArgs, type WebFetchMetadata, type WebFetchParams, type WebFetchResult, type WebFetchSuccessResult$1 as WebFetchSuccessResult, type WebSearchArgs, type WebSearchMetadata, type WebSearchParams, type WebSearchResult, type WebSearchSuccessResult$1 as WebSearchSuccessResult, type WebSearchToolResult, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, convertToolCall, convertToolCalls, createEmptySnapshot, createLLM, deduplicateModels, err, generateFolderTree, getAvailableProviders, getFallbackLimits, getProviderLabel, isAssignResult, isAssignSuccess, isAssignTaskArgs, isBashResult, isBashSuccess, isBashToolArgs, isDirLsArgs, isDirLsResult, isDirLsSuccess, isError, isFileEditArgs, isFileEditResult, isFileEditSuccess, isFileNewArgs, isFileNewResult, isFileNewSuccess, isFileReadArgs, isFileReadResult, isFileReadSuccess, isJsonResult, isRetryableError, isRetryableStatusCode, isSuccess, isSuccessJson, isSuccessText, isTextResult, isTodoWriteArgs, isTodoWriteResult, isTodoWriteSuccess, isValidCommandId, isWebFetchArgs, isWebFetchResult, isWebFetchSuccess, isWebSearchArgs, isWebSearchResult, isWebSearchSuccess, normalizeModelInfo, normalizeModelLimits, normalizeNewlines, okJson, okText, parseJSON, parseSubAgentToolCallArguments, parseToolArguments, renderTemplate, resolveBackspaces, resolveCarriageReturns, sanitizeCommandId, stripAnsiAndControls, supportsGetModels, toolValidators };
|
package/dist/index.js
CHANGED
|
@@ -268,9 +268,9 @@ var JsonFileMemoryPersistence = class {
|
|
|
268
268
|
}
|
|
269
269
|
async load() {
|
|
270
270
|
try {
|
|
271
|
-
const
|
|
272
|
-
if (!
|
|
273
|
-
const text =
|
|
271
|
+
const fs10 = await import("fs");
|
|
272
|
+
if (!fs10.existsSync(this.filename)) return {};
|
|
273
|
+
const text = fs10.readFileSync(this.filename, "utf-8");
|
|
274
274
|
const data = JSON.parse(text);
|
|
275
275
|
return typeof data === "object" && data ? data : {};
|
|
276
276
|
} catch {
|
|
@@ -280,13 +280,13 @@ var JsonFileMemoryPersistence = class {
|
|
|
280
280
|
}
|
|
281
281
|
async save(snapshot) {
|
|
282
282
|
try {
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
const dir =
|
|
286
|
-
if (dir && dir !== "." && !
|
|
287
|
-
|
|
283
|
+
const fs10 = await import("fs");
|
|
284
|
+
const path9 = await import("path");
|
|
285
|
+
const dir = path9.dirname(this.filename);
|
|
286
|
+
if (dir && dir !== "." && !fs10.existsSync(dir)) {
|
|
287
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
fs10.writeFileSync(this.filename, JSON.stringify(snapshot, null, 2), "utf-8");
|
|
290
290
|
} catch (err2) {
|
|
291
291
|
console.warn(`Failed to save memory to ${this.filename}`, err2);
|
|
292
292
|
}
|
|
@@ -4581,6 +4581,175 @@ var AgentFilePersistence = class {
|
|
|
4581
4581
|
}
|
|
4582
4582
|
};
|
|
4583
4583
|
|
|
4584
|
+
// src/command-file-persistence.ts
|
|
4585
|
+
import * as fs9 from "fs";
|
|
4586
|
+
import * as path8 from "path";
|
|
4587
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
4588
|
+
|
|
4589
|
+
// src/command-types.ts
|
|
4590
|
+
function isValidCommandId(id) {
|
|
4591
|
+
return /^[a-z][a-z0-9-]*$/.test(id);
|
|
4592
|
+
}
|
|
4593
|
+
function sanitizeCommandId(name) {
|
|
4594
|
+
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
4595
|
+
}
|
|
4596
|
+
|
|
4597
|
+
// src/command-file-persistence.ts
|
|
4598
|
+
var CommandFilePersistence = class {
|
|
4599
|
+
globalDir;
|
|
4600
|
+
profileDir;
|
|
4601
|
+
localDir;
|
|
4602
|
+
constructor(options) {
|
|
4603
|
+
this.globalDir = options.globalDir;
|
|
4604
|
+
this.profileDir = options.profileDir;
|
|
4605
|
+
this.localDir = options.localDir;
|
|
4606
|
+
}
|
|
4607
|
+
setProfileDir(profileDir) {
|
|
4608
|
+
this.profileDir = profileDir;
|
|
4609
|
+
}
|
|
4610
|
+
getDir(source) {
|
|
4611
|
+
switch (source) {
|
|
4612
|
+
case "global":
|
|
4613
|
+
return this.globalDir;
|
|
4614
|
+
case "profile":
|
|
4615
|
+
if (!this.profileDir) {
|
|
4616
|
+
throw new Error("Profile directory not set");
|
|
4617
|
+
}
|
|
4618
|
+
return this.profileDir;
|
|
4619
|
+
case "local":
|
|
4620
|
+
return this.localDir;
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
ensureDir(dir) {
|
|
4624
|
+
if (!fs9.existsSync(dir)) {
|
|
4625
|
+
fs9.mkdirSync(dir, { recursive: true });
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
async loadAll() {
|
|
4629
|
+
const commands = [];
|
|
4630
|
+
const sources = ["global", "local"];
|
|
4631
|
+
if (this.profileDir) {
|
|
4632
|
+
sources.splice(1, 0, "profile");
|
|
4633
|
+
}
|
|
4634
|
+
for (const source of sources) {
|
|
4635
|
+
try {
|
|
4636
|
+
const dir = this.getDir(source);
|
|
4637
|
+
const loaded = await this.loadFromDir(dir, source);
|
|
4638
|
+
commands.push(...loaded);
|
|
4639
|
+
} catch {
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
return commands;
|
|
4643
|
+
}
|
|
4644
|
+
async loadFromDir(dir, source) {
|
|
4645
|
+
const commands = [];
|
|
4646
|
+
if (!fs9.existsSync(dir)) {
|
|
4647
|
+
return commands;
|
|
4648
|
+
}
|
|
4649
|
+
const files = fs9.readdirSync(dir);
|
|
4650
|
+
const mdFiles = files.filter((f) => f.endsWith(".md"));
|
|
4651
|
+
for (const file of mdFiles) {
|
|
4652
|
+
try {
|
|
4653
|
+
const command = await this.load(file, source);
|
|
4654
|
+
if (command) {
|
|
4655
|
+
commands.push(command);
|
|
4656
|
+
}
|
|
4657
|
+
} catch (error) {
|
|
4658
|
+
console.warn(`Failed to load command from ${file}:`, error);
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
return commands;
|
|
4662
|
+
}
|
|
4663
|
+
async load(filename, source) {
|
|
4664
|
+
try {
|
|
4665
|
+
const dir = this.getDir(source);
|
|
4666
|
+
const filePath = path8.join(dir, filename);
|
|
4667
|
+
const content = fs9.readFileSync(filePath, "utf8");
|
|
4668
|
+
const { frontmatter, body } = this.parseFrontmatter(content);
|
|
4669
|
+
if (!frontmatter.description) {
|
|
4670
|
+
console.warn(`Invalid command template in ${filename}: missing description`);
|
|
4671
|
+
return null;
|
|
4672
|
+
}
|
|
4673
|
+
const id = path8.basename(filename, ".md");
|
|
4674
|
+
return {
|
|
4675
|
+
id,
|
|
4676
|
+
description: frontmatter.description,
|
|
4677
|
+
prompt: body.trim(),
|
|
4678
|
+
enabled: frontmatter.enabled ?? true,
|
|
4679
|
+
source,
|
|
4680
|
+
filePath
|
|
4681
|
+
};
|
|
4682
|
+
} catch (error) {
|
|
4683
|
+
console.warn(`Failed to load command from ${filename}:`, error);
|
|
4684
|
+
return null;
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
async save(command) {
|
|
4688
|
+
const dir = this.getDir(command.source);
|
|
4689
|
+
this.ensureDir(dir);
|
|
4690
|
+
const id = sanitizeCommandId(command.id);
|
|
4691
|
+
const filename = `${id}.md`;
|
|
4692
|
+
const filePath = path8.join(dir, filename);
|
|
4693
|
+
const frontmatter = {
|
|
4694
|
+
description: command.description
|
|
4695
|
+
};
|
|
4696
|
+
if (command.enabled === false) {
|
|
4697
|
+
frontmatter.enabled = false;
|
|
4698
|
+
}
|
|
4699
|
+
const content = this.buildMarkdown(frontmatter, command.prompt);
|
|
4700
|
+
fs9.writeFileSync(filePath, content, "utf8");
|
|
4701
|
+
}
|
|
4702
|
+
async delete(commandId, source) {
|
|
4703
|
+
const dir = this.getDir(source);
|
|
4704
|
+
const filename = `${sanitizeCommandId(commandId)}.md`;
|
|
4705
|
+
const filePath = path8.join(dir, filename);
|
|
4706
|
+
if (fs9.existsSync(filePath)) {
|
|
4707
|
+
fs9.unlinkSync(filePath);
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
exists(commandId, source) {
|
|
4711
|
+
try {
|
|
4712
|
+
const dir = this.getDir(source);
|
|
4713
|
+
const filename = `${sanitizeCommandId(commandId)}.md`;
|
|
4714
|
+
const filePath = path8.join(dir, filename);
|
|
4715
|
+
return fs9.existsSync(filePath);
|
|
4716
|
+
} catch {
|
|
4717
|
+
return false;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
parseFrontmatter(content) {
|
|
4721
|
+
const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/;
|
|
4722
|
+
const match = content.match(frontmatterRegex);
|
|
4723
|
+
if (!match) {
|
|
4724
|
+
return {
|
|
4725
|
+
frontmatter: {},
|
|
4726
|
+
body: content
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
try {
|
|
4730
|
+
const frontmatter = parseYaml(match[1] || "");
|
|
4731
|
+
return {
|
|
4732
|
+
frontmatter: frontmatter || {},
|
|
4733
|
+
body: match[2] || ""
|
|
4734
|
+
};
|
|
4735
|
+
} catch {
|
|
4736
|
+
return {
|
|
4737
|
+
frontmatter: {},
|
|
4738
|
+
body: content
|
|
4739
|
+
};
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
buildMarkdown(frontmatter, body) {
|
|
4743
|
+
const yamlContent = stringifyYaml(frontmatter, { lineWidth: 0 }).trim();
|
|
4744
|
+
return `---
|
|
4745
|
+
${yamlContent}
|
|
4746
|
+
---
|
|
4747
|
+
|
|
4748
|
+
${body}
|
|
4749
|
+
`;
|
|
4750
|
+
}
|
|
4751
|
+
};
|
|
4752
|
+
|
|
4584
4753
|
// src/sub-agent-types.ts
|
|
4585
4754
|
function parseSubAgentToolCallArguments(argsString) {
|
|
4586
4755
|
if (!argsString) return {};
|
|
@@ -4917,21 +5086,21 @@ var NetworkLogger = class {
|
|
|
4917
5086
|
async appendToLogFile(entry) {
|
|
4918
5087
|
if (!this.opts.persistFile) return;
|
|
4919
5088
|
try {
|
|
4920
|
-
const
|
|
4921
|
-
const
|
|
5089
|
+
const fs10 = await import("fs/promises");
|
|
5090
|
+
const path9 = await import("path");
|
|
4922
5091
|
const file = this.opts.persistFile;
|
|
4923
|
-
const dir =
|
|
5092
|
+
const dir = path9.dirname(file);
|
|
4924
5093
|
if (dir && dir !== ".") {
|
|
4925
5094
|
try {
|
|
4926
|
-
await
|
|
5095
|
+
await fs10.mkdir(dir, { recursive: true });
|
|
4927
5096
|
} catch {
|
|
4928
5097
|
}
|
|
4929
5098
|
}
|
|
4930
5099
|
const logLine = this.formatLogEntry(entry);
|
|
4931
|
-
await
|
|
5100
|
+
await fs10.appendFile(file, `${logLine}
|
|
4932
5101
|
`, "utf-8");
|
|
4933
5102
|
if (this.opts.maxFileSize) {
|
|
4934
|
-
const stats = await
|
|
5103
|
+
const stats = await fs10.stat(file);
|
|
4935
5104
|
if (stats.size > this.opts.maxFileSize) {
|
|
4936
5105
|
await this.rotateLogFile(file);
|
|
4937
5106
|
}
|
|
@@ -4951,9 +5120,9 @@ var NetworkLogger = class {
|
|
|
4951
5120
|
}
|
|
4952
5121
|
async rotateLogFile(file) {
|
|
4953
5122
|
try {
|
|
4954
|
-
const
|
|
5123
|
+
const fs10 = await import("fs/promises");
|
|
4955
5124
|
const rotatedFile = `${file}.${Date.now()}`;
|
|
4956
|
-
await
|
|
5125
|
+
await fs10.rename(file, rotatedFile);
|
|
4957
5126
|
} catch {
|
|
4958
5127
|
}
|
|
4959
5128
|
}
|
|
@@ -5180,12 +5349,12 @@ var GithubAuthTransport = class {
|
|
|
5180
5349
|
this.dynamicApiUrl = data.endpoints.api;
|
|
5181
5350
|
}
|
|
5182
5351
|
}
|
|
5183
|
-
buildFullUrl(
|
|
5184
|
-
if (
|
|
5352
|
+
buildFullUrl(path9) {
|
|
5353
|
+
if (path9.startsWith("/")) {
|
|
5185
5354
|
const apiUrl = this.dynamicApiUrl ?? this.baseUrl;
|
|
5186
|
-
return `${apiUrl}${
|
|
5355
|
+
return `${apiUrl}${path9}`;
|
|
5187
5356
|
}
|
|
5188
|
-
return
|
|
5357
|
+
return path9;
|
|
5189
5358
|
}
|
|
5190
5359
|
hasVisionPayload(body) {
|
|
5191
5360
|
if (!body || typeof body !== "object") return false;
|
|
@@ -5539,11 +5708,11 @@ var AnthropicAuthTransport = class {
|
|
|
5539
5708
|
this.refreshPromise = null;
|
|
5540
5709
|
}
|
|
5541
5710
|
}
|
|
5542
|
-
buildFullUrl(
|
|
5543
|
-
if (
|
|
5544
|
-
return `${this.baseUrl}${
|
|
5711
|
+
buildFullUrl(path9) {
|
|
5712
|
+
if (path9.startsWith("/")) {
|
|
5713
|
+
return `${this.baseUrl}${path9}`;
|
|
5545
5714
|
}
|
|
5546
|
-
return
|
|
5715
|
+
return path9;
|
|
5547
5716
|
}
|
|
5548
5717
|
makeAuthHeaders(headers) {
|
|
5549
5718
|
const base = {
|
|
@@ -5650,11 +5819,11 @@ var BaseBearerAuthTransport = class {
|
|
|
5650
5819
|
this.version = version;
|
|
5651
5820
|
this.customHeaders = customHeaders;
|
|
5652
5821
|
}
|
|
5653
|
-
buildFullUrl(
|
|
5654
|
-
if (
|
|
5655
|
-
return `${this.baseUrl}${
|
|
5822
|
+
buildFullUrl(path9) {
|
|
5823
|
+
if (path9.startsWith("/")) {
|
|
5824
|
+
return `${this.baseUrl}${path9}`;
|
|
5656
5825
|
}
|
|
5657
|
-
return
|
|
5826
|
+
return path9;
|
|
5658
5827
|
}
|
|
5659
5828
|
makeAuthHeaders(headers) {
|
|
5660
5829
|
const base = headers ? { ...headers } : {};
|
|
@@ -6741,6 +6910,7 @@ export {
|
|
|
6741
6910
|
AgentRegistry,
|
|
6742
6911
|
AnthropicAISDKLLM,
|
|
6743
6912
|
BashTool,
|
|
6913
|
+
CommandFilePersistence,
|
|
6744
6914
|
CompositeToolPort,
|
|
6745
6915
|
ConversationContext,
|
|
6746
6916
|
ConversationStore,
|
|
@@ -6814,6 +6984,7 @@ export {
|
|
|
6814
6984
|
isTodoWriteArgs,
|
|
6815
6985
|
isTodoWriteResult,
|
|
6816
6986
|
isTodoWriteSuccess,
|
|
6987
|
+
isValidCommandId,
|
|
6817
6988
|
isWebFetchArgs,
|
|
6818
6989
|
isWebFetchResult,
|
|
6819
6990
|
isWebFetchSuccess,
|
|
@@ -6831,6 +7002,7 @@ export {
|
|
|
6831
7002
|
renderTemplate,
|
|
6832
7003
|
resolveBackspaces,
|
|
6833
7004
|
resolveCarriageReturns,
|
|
7005
|
+
sanitizeCommandId,
|
|
6834
7006
|
stripAnsiAndControls,
|
|
6835
7007
|
supportsGetModels,
|
|
6836
7008
|
toolValidators
|