deepagents 1.16.4 → 1.17.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/{agent-BAuGxPZn.d.ts → agent-CLlZT-Mb.d.ts} +36 -3
- package/dist/{agent-DOFzksfM.d.cts → agent-Di09Mxb3.d.cts} +34 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{langsmith-DfobOVRO.js → langsmith-DYAFTn0y.js} +256 -34
- package/dist/langsmith-DYAFTn0y.js.map +1 -0
- package/dist/{langsmith-D_tzVwxp.cjs → langsmith-Fjf2fY1X.cjs} +260 -32
- package/dist/langsmith-Fjf2fY1X.cjs.map +1 -0
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{src-KaJuKnnd.js → src-B8R36RZW.js} +151 -26
- package/dist/src-B8R36RZW.js.map +1 -0
- package/dist/{src-DTOh2Xrc.cjs → src-BC1al3Te.cjs} +151 -26
- package/dist/src-BC1al3Te.cjs.map +1 -0
- package/package.json +4 -4
- package/dist/langsmith-D_tzVwxp.cjs.map +0 -1
- package/dist/langsmith-DfobOVRO.js.map +0 -1
- package/dist/src-DTOh2Xrc.cjs.map +0 -1
- package/dist/src-KaJuKnnd.js.map +0 -1
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_langsmith = require("./langsmith-
|
|
3
|
-
const require_src = require("./src-
|
|
2
|
+
const require_langsmith = require("./langsmith-Fjf2fY1X.cjs");
|
|
3
|
+
const require_src = require("./src-BC1al3Te.cjs");
|
|
4
4
|
exports.ASYNC_TASK_SYSTEM_PROMPT = require_langsmith.ASYNC_TASK_SYSTEM_PROMPT;
|
|
5
5
|
exports.BASE_AGENT_PROMPT = require_langsmith.BASE_AGENT_PROMPT;
|
|
6
6
|
exports.BaseSandbox = require_langsmith.BaseSandbox;
|
package/dist/node.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as scrubUnsupportedMultimodalContent, $t as SystemPromptConfig, A as createSettings, An as SandboxGetOrCreateOptions, At as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, B as FlattenSubAgentMiddleware, Bn as BackendProtocolV2, Bt as parseHarnessProfileConfig, C as listSkills, Cn as MaybePromise, Ct as StateBackend, D as filesValue, Dn as SandboxDeleteOptions, Dt as DEFAULT_SUBAGENT_PROMPT, E as createAgentMemoryMiddleware, En as SandboxBackendProtocol, Et as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, F as CreateDeepAgentParams, Fn as WriteResult, Ft as getHarnessProfile, G as InferSubagentByName, Gt as HarnessProfile, H as InferDeepAgentType, Hn as BackendProtocolV1, Ht as EMPTY_HARNESS_PROFILE, I as DeepAgent, In as applyGrepMaxCount, It as registerHarnessProfile, J as ResolveDeepAgentTypeConfig, Jt as ConfigurationError, K as InferSubagentReactAgentType, Kt as HarnessProfileOptions, L as DeepAgentTypeConfig, Ln as isSandboxBackend, Lt as HarnessProfileConfigData, M as DeepAgentRunStream, Mn as SandboxListOptions, Mt as SubAgentMiddlewareOptions, N as SubagentRunStream, Nn as SandboxListResponse, Nt as createSubAgent, O as Settings, On as SandboxError, Ot as ForkedSubAgent, P as AnySubAgent, Pn as StateAndStore, Pt as createSubAgentMiddleware, Q as multimodalBlockSupported, Qt as EXECUTION_SYSTEM_PROMPT, R as DefaultDeepAgentTypeConfig, Rn as isSandboxProtocol, Rt as generalPurposeSubagentConfigSchema, S as SkillMetadata, Sn as LsResult, St as createMemoryMiddleware, T as AgentMemoryMiddlewareOptions, Tn as ReadResult, Tt as CompiledSubAgent, U as InferStructuredResponse, Un as SandboxBackendProtocolV1, Ut as createHarnessProfile, V as InferDeepAgentSubagents, Vn as SandboxBackendProtocolV2, Vt as serializeProfile, W as InferSubAgentMiddlewareStates, Wt as GeneralPurposeSubagentConfig, X as MULTIMODAL_BLOCK_TYPES, Xt as ASYNC_TASK_SYSTEM_PROMPT, Y as SupportedResponseFormat, Yt as ConfigurationErrorCode, Z as createUnsupportedContentMiddleware, Zt as BASE_AGENT_PROMPT, _ as StoreBackend, _n as FileOperationError, _t as SkillsMiddlewareOptions, a as adaptBackendProtocol, an as FilesystemPermission, at as createAsyncSubAgentMiddleware, b as StoreBackendOptions, bn as GrepMatch, bt as skillsMetadataValue, c as LangSmithSandbox, cn as BackendFactory, ct as createSummarizationMiddleware, d as BaseSandbox, dn as DeleteResult, dt as MAX_SKILL_DESCRIPTION_LENGTH, en as TASK_SYSTEM_PROMPT, et as AsyncSubAgent, f as LocalShellBackend, fn as EditResult, ft as MAX_SKILL_FILE_SIZE, g as FilesystemBackend, gn as FileInfo, gt as SkillToolResolver, h as CompositeBackend, hn as FileDownloadResponse, ht as SkillMetadataEntry, i as LangSmithStartSandboxOptions, in as FilesystemOperation, it as TaskEvent, j as findProjectRoot, jn as SandboxInfo, jt as SubAgent, k as SettingsOptions, kn as SandboxErrorCode, kt as GENERAL_PURPOSE_SUBAGENT, l as LangSmithSandboxCreateOptions, ln as BackendProtocol, lt as CompletionCallbackOptions, m as ContextHubBackend, mn as FileData, mt as SkillMetadata$1, n as LangSmithCaptureSnapshotOptions, nn as FsToolName, nt as AsyncTask, o as adaptSandboxProtocol, on as PermissionMode, ot as isAsyncSubAgent, p as LocalShellBackendOptions, pn as ExecuteResponse, pt as MAX_SKILL_NAME_LENGTH, q as MergedDeepAgentState, qt as REQUIRED_MIDDLEWARE_NAMES, r as LangSmithSnapshot, rn as createFilesystemMiddleware, rt as AsyncTaskStatus, s as normalizeReadPagination, sn as AnyBackendProtocol, st as computeSummarizationDefaults, t as createDeepAgent, tn as FilesystemMiddlewareOptions, tt as AsyncSubAgentMiddlewareOptions, u as LangSmithSandboxOptions, un as BackendRuntime, ut as createCompletionCallbackMiddleware, v as StoreBackendContext, vn as FileUploadResponse, vt as createSkillsMiddleware, w as parseSkillMetadata, wn as ReadRawResult, wt as createPatchToolCallsMiddleware, x as ListSkillsOptions, xn as GrepResult, xt as MemoryMiddlewareOptions, y as StoreBackendNamespaceFactory, yn as GlobResult, yt as pinnedSkillsValue, z as ExtractSubAgentMiddleware, zn as resolveBackend, zt as harnessProfileConfigSchema } from "./agent-
|
|
1
|
+
import { $ as scrubUnsupportedMultimodalContent, $t as SystemPromptConfig, A as createSettings, An as SandboxGetOrCreateOptions, At as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, B as FlattenSubAgentMiddleware, Bn as BackendProtocolV2, Bt as parseHarnessProfileConfig, C as listSkills, Cn as MaybePromise, Ct as StateBackend, D as filesValue, Dn as SandboxDeleteOptions, Dt as DEFAULT_SUBAGENT_PROMPT, E as createAgentMemoryMiddleware, En as SandboxBackendProtocol, Et as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, F as CreateDeepAgentParams, Fn as WriteResult, Ft as getHarnessProfile, G as InferSubagentByName, Gt as HarnessProfile, H as InferDeepAgentType, Hn as BackendProtocolV1, Ht as EMPTY_HARNESS_PROFILE, I as DeepAgent, In as applyGrepMaxCount, It as registerHarnessProfile, J as ResolveDeepAgentTypeConfig, Jt as ConfigurationError, K as InferSubagentReactAgentType, Kt as HarnessProfileOptions, L as DeepAgentTypeConfig, Ln as isSandboxBackend, Lt as HarnessProfileConfigData, M as DeepAgentRunStream, Mn as SandboxListOptions, Mt as SubAgentMiddlewareOptions, N as SubagentRunStream, Nn as SandboxListResponse, Nt as createSubAgent, O as Settings, On as SandboxError, Ot as ForkedSubAgent, P as AnySubAgent, Pn as StateAndStore, Pt as createSubAgentMiddleware, Q as multimodalBlockSupported, Qt as EXECUTION_SYSTEM_PROMPT, R as DefaultDeepAgentTypeConfig, Rn as isSandboxProtocol, Rt as generalPurposeSubagentConfigSchema, S as SkillMetadata, Sn as LsResult, St as createMemoryMiddleware, T as AgentMemoryMiddlewareOptions, Tn as ReadResult, Tt as CompiledSubAgent, U as InferStructuredResponse, Un as SandboxBackendProtocolV1, Ut as createHarnessProfile, V as InferDeepAgentSubagents, Vn as SandboxBackendProtocolV2, Vt as serializeProfile, W as InferSubAgentMiddlewareStates, Wt as GeneralPurposeSubagentConfig, X as MULTIMODAL_BLOCK_TYPES, Xt as ASYNC_TASK_SYSTEM_PROMPT, Y as SupportedResponseFormat, Yt as ConfigurationErrorCode, Z as createUnsupportedContentMiddleware, Zt as BASE_AGENT_PROMPT, _ as StoreBackend, _n as FileOperationError, _t as SkillsMiddlewareOptions, a as adaptBackendProtocol, an as FilesystemPermission, at as createAsyncSubAgentMiddleware, b as StoreBackendOptions, bn as GrepMatch, bt as skillsMetadataValue, c as LangSmithSandbox, cn as BackendFactory, ct as createSummarizationMiddleware, d as BaseSandbox, dn as DeleteResult, dt as MAX_SKILL_DESCRIPTION_LENGTH, en as TASK_SYSTEM_PROMPT, et as AsyncSubAgent, f as LocalShellBackend, fn as EditResult, ft as MAX_SKILL_FILE_SIZE, g as FilesystemBackend, gn as FileInfo, gt as SkillToolResolver, h as CompositeBackend, hn as FileDownloadResponse, ht as SkillMetadataEntry, i as LangSmithStartSandboxOptions, in as FilesystemOperation, it as TaskEvent, j as findProjectRoot, jn as SandboxInfo, jt as SubAgent, k as SettingsOptions, kn as SandboxErrorCode, kt as GENERAL_PURPOSE_SUBAGENT, l as LangSmithSandboxCreateOptions, ln as BackendProtocol, lt as CompletionCallbackOptions, m as ContextHubBackend, mn as FileData, mt as SkillMetadata$1, n as LangSmithCaptureSnapshotOptions, nn as FsToolName, nt as AsyncTask, o as adaptSandboxProtocol, on as PermissionMode, ot as isAsyncSubAgent, p as LocalShellBackendOptions, pn as ExecuteResponse, pt as MAX_SKILL_NAME_LENGTH, q as MergedDeepAgentState, qt as REQUIRED_MIDDLEWARE_NAMES, r as LangSmithSnapshot, rn as createFilesystemMiddleware, rt as AsyncTaskStatus, s as normalizeReadPagination, sn as AnyBackendProtocol, st as computeSummarizationDefaults, t as createDeepAgent, tn as FilesystemMiddlewareOptions, tt as AsyncSubAgentMiddlewareOptions, u as LangSmithSandboxOptions, un as BackendRuntime, ut as createCompletionCallbackMiddleware, v as StoreBackendContext, vn as FileUploadResponse, vt as createSkillsMiddleware, w as parseSkillMetadata, wn as ReadRawResult, wt as createPatchToolCallsMiddleware, x as ListSkillsOptions, xn as GrepResult, xt as MemoryMiddlewareOptions, y as StoreBackendNamespaceFactory, yn as GlobResult, yt as pinnedSkillsValue, z as ExtractSubAgentMiddleware, zn as resolveBackend, zt as harnessProfileConfigSchema } from "./agent-Di09Mxb3.cjs";
|
|
2
2
|
export { ASYNC_TASK_SYSTEM_PROMPT, type AgentMemoryMiddlewareOptions, type AnyBackendProtocol, type AnySubAgent, type AsyncSubAgent, type AsyncSubAgentMiddlewareOptions, type AsyncTask, type AsyncTaskStatus, BASE_AGENT_PROMPT, type BackendFactory, type BackendProtocol, type BackendProtocolV1, type BackendProtocolV2, type BackendRuntime, BaseSandbox, type CompiledSubAgent, type CompletionCallbackOptions, CompositeBackend, ConfigurationError, type ConfigurationErrorCode, ContextHubBackend, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentRunStream, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type DeleteResult, EMPTY_HARNESS_PROFILE, EXECUTION_SYSTEM_PROMPT, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FilesystemOperation, type FilesystemPermission, type FlattenSubAgentMiddleware, type ForkedSubAgent, type FsToolName, GENERAL_PURPOSE_SUBAGENT, type GeneralPurposeSubagentConfig, type GlobResult, type GrepMatch, type GrepResult, type HarnessProfile, type HarnessProfileConfigData, type HarnessProfileOptions, type InferDeepAgentSubagents, type InferDeepAgentType, type InferStructuredResponse, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type LangSmithCaptureSnapshotOptions, LangSmithSandbox, type LangSmithSandboxCreateOptions, type LangSmithSandboxOptions, type LangSmithSnapshot, type LangSmithStartSandboxOptions, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, LocalShellBackend, type LocalShellBackendOptions, type LsResult, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, MULTIMODAL_BLOCK_TYPES, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type PermissionMode, REQUIRED_MIDDLEWARE_NAMES, type ReadRawResult, type ReadResult, type ResolveDeepAgentTypeConfig, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, type SandboxBackendProtocol, type SandboxBackendProtocolV1, type SandboxBackendProtocolV2, type SandboxDeleteOptions, SandboxError, type SandboxErrorCode, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type Settings, type SettingsOptions, type SkillMetadata$1 as SkillMetadata, type SkillMetadataEntry, type SkillToolResolver, type SkillsMiddlewareOptions, type StateAndStore, StateBackend, StoreBackend, type StoreBackendContext, type StoreBackendNamespaceFactory, type StoreBackendOptions, type SubAgent, type SubAgentMiddlewareOptions, type SubagentRunStream, type SupportedResponseFormat, type SystemPromptConfig, TASK_SYSTEM_PROMPT, type TaskEvent, type WriteResult, adaptBackendProtocol, adaptSandboxProtocol, applyGrepMaxCount, computeSummarizationDefaults, createAgentMemoryMiddleware, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createHarnessProfile, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgent, createSubAgentMiddleware, createSummarizationMiddleware, createUnsupportedContentMiddleware, filesValue, findProjectRoot, generalPurposeSubagentConfigSchema, getHarnessProfile, harnessProfileConfigSchema, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, listSkills, multimodalBlockSupported, normalizeReadPagination, parseHarnessProfileConfig, parseSkillMetadata, pinnedSkillsValue, registerHarnessProfile, resolveBackend, scrubUnsupportedMultimodalContent, serializeProfile, skillsMetadataValue };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as scrubUnsupportedMultimodalContent, $t as SystemPromptConfig, A as createSettings, An as SandboxGetOrCreateOptions, At as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, B as FlattenSubAgentMiddleware, Bn as BackendProtocolV2, Bt as parseHarnessProfileConfig, C as listSkills, Cn as MaybePromise, Ct as StateBackend, D as filesValue, Dn as SandboxDeleteOptions, Dt as DEFAULT_SUBAGENT_PROMPT, E as createAgentMemoryMiddleware, En as SandboxBackendProtocol, Et as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, F as CreateDeepAgentParams, Fn as WriteResult, Ft as getHarnessProfile, G as InferSubagentByName, Gt as HarnessProfile, H as InferDeepAgentType, Hn as BackendProtocolV1, Ht as EMPTY_HARNESS_PROFILE, I as DeepAgent, In as applyGrepMaxCount, It as registerHarnessProfile, J as ResolveDeepAgentTypeConfig, Jt as ConfigurationError, K as InferSubagentReactAgentType, Kt as HarnessProfileOptions, L as DeepAgentTypeConfig, Ln as isSandboxBackend, Lt as HarnessProfileConfigData, M as DeepAgentRunStream, Mn as SandboxListOptions, Mt as SubAgentMiddlewareOptions, N as SubagentRunStream, Nn as SandboxListResponse, Nt as createSubAgent, O as Settings, On as SandboxError, Ot as ForkedSubAgent, P as AnySubAgent, Pn as StateAndStore, Pt as createSubAgentMiddleware, Q as multimodalBlockSupported, Qt as EXECUTION_SYSTEM_PROMPT, R as DefaultDeepAgentTypeConfig, Rn as isSandboxProtocol, Rt as generalPurposeSubagentConfigSchema, S as SkillMetadata, Sn as LsResult, St as createMemoryMiddleware, T as AgentMemoryMiddlewareOptions, Tn as ReadResult, Tt as CompiledSubAgent, U as InferStructuredResponse, Un as SandboxBackendProtocolV1, Ut as createHarnessProfile, V as InferDeepAgentSubagents, Vn as SandboxBackendProtocolV2, Vt as serializeProfile, W as InferSubAgentMiddlewareStates, Wt as GeneralPurposeSubagentConfig, X as MULTIMODAL_BLOCK_TYPES, Xt as ASYNC_TASK_SYSTEM_PROMPT, Y as SupportedResponseFormat, Yt as ConfigurationErrorCode, Z as createUnsupportedContentMiddleware, Zt as BASE_AGENT_PROMPT, _ as StoreBackend, _n as FileOperationError, _t as SkillsMiddlewareOptions, a as adaptBackendProtocol, an as FilesystemPermission, at as createAsyncSubAgentMiddleware, b as StoreBackendOptions, bn as GrepMatch, bt as skillsMetadataValue, c as LangSmithSandbox, cn as BackendFactory, ct as createSummarizationMiddleware, d as BaseSandbox, dn as DeleteResult, dt as MAX_SKILL_DESCRIPTION_LENGTH, en as TASK_SYSTEM_PROMPT, et as AsyncSubAgent, f as LocalShellBackend, fn as EditResult, ft as MAX_SKILL_FILE_SIZE, g as FilesystemBackend, gn as FileInfo, gt as SkillToolResolver, h as CompositeBackend, hn as FileDownloadResponse, ht as SkillMetadataEntry, i as LangSmithStartSandboxOptions, in as FilesystemOperation, it as TaskEvent, j as findProjectRoot, jn as SandboxInfo, jt as SubAgent, k as SettingsOptions, kn as SandboxErrorCode, kt as GENERAL_PURPOSE_SUBAGENT, l as LangSmithSandboxCreateOptions, ln as BackendProtocol, lt as CompletionCallbackOptions, m as ContextHubBackend, mn as FileData, mt as SkillMetadata$1, n as LangSmithCaptureSnapshotOptions, nn as FsToolName, nt as AsyncTask, o as adaptSandboxProtocol, on as PermissionMode, ot as isAsyncSubAgent, p as LocalShellBackendOptions, pn as ExecuteResponse, pt as MAX_SKILL_NAME_LENGTH, q as MergedDeepAgentState, qt as REQUIRED_MIDDLEWARE_NAMES, r as LangSmithSnapshot, rn as createFilesystemMiddleware, rt as AsyncTaskStatus, s as normalizeReadPagination, sn as AnyBackendProtocol, st as computeSummarizationDefaults, t as createDeepAgent, tn as FilesystemMiddlewareOptions, tt as AsyncSubAgentMiddlewareOptions, u as LangSmithSandboxOptions, un as BackendRuntime, ut as createCompletionCallbackMiddleware, v as StoreBackendContext, vn as FileUploadResponse, vt as createSkillsMiddleware, w as parseSkillMetadata, wn as ReadRawResult, wt as createPatchToolCallsMiddleware, x as ListSkillsOptions, xn as GrepResult, xt as MemoryMiddlewareOptions, y as StoreBackendNamespaceFactory, yn as GlobResult, yt as pinnedSkillsValue, z as ExtractSubAgentMiddleware, zn as resolveBackend, zt as harnessProfileConfigSchema } from "./agent-
|
|
1
|
+
import { $ as scrubUnsupportedMultimodalContent, $t as SystemPromptConfig, A as createSettings, An as SandboxGetOrCreateOptions, At as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, B as FlattenSubAgentMiddleware, Bn as BackendProtocolV2, Bt as parseHarnessProfileConfig, C as listSkills, Cn as MaybePromise, Ct as StateBackend, D as filesValue, Dn as SandboxDeleteOptions, Dt as DEFAULT_SUBAGENT_PROMPT, E as createAgentMemoryMiddleware, En as SandboxBackendProtocol, Et as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, F as CreateDeepAgentParams, Fn as WriteResult, Ft as getHarnessProfile, G as InferSubagentByName, Gt as HarnessProfile, H as InferDeepAgentType, Hn as BackendProtocolV1, Ht as EMPTY_HARNESS_PROFILE, I as DeepAgent, In as applyGrepMaxCount, It as registerHarnessProfile, J as ResolveDeepAgentTypeConfig, Jt as ConfigurationError, K as InferSubagentReactAgentType, Kt as HarnessProfileOptions, L as DeepAgentTypeConfig, Ln as isSandboxBackend, Lt as HarnessProfileConfigData, M as DeepAgentRunStream, Mn as SandboxListOptions, Mt as SubAgentMiddlewareOptions, N as SubagentRunStream, Nn as SandboxListResponse, Nt as createSubAgent, O as Settings, On as SandboxError, Ot as ForkedSubAgent, P as AnySubAgent, Pn as StateAndStore, Pt as createSubAgentMiddleware, Q as multimodalBlockSupported, Qt as EXECUTION_SYSTEM_PROMPT, R as DefaultDeepAgentTypeConfig, Rn as isSandboxProtocol, Rt as generalPurposeSubagentConfigSchema, S as SkillMetadata, Sn as LsResult, St as createMemoryMiddleware, T as AgentMemoryMiddlewareOptions, Tn as ReadResult, Tt as CompiledSubAgent, U as InferStructuredResponse, Un as SandboxBackendProtocolV1, Ut as createHarnessProfile, V as InferDeepAgentSubagents, Vn as SandboxBackendProtocolV2, Vt as serializeProfile, W as InferSubAgentMiddlewareStates, Wt as GeneralPurposeSubagentConfig, X as MULTIMODAL_BLOCK_TYPES, Xt as ASYNC_TASK_SYSTEM_PROMPT, Y as SupportedResponseFormat, Yt as ConfigurationErrorCode, Z as createUnsupportedContentMiddleware, Zt as BASE_AGENT_PROMPT, _ as StoreBackend, _n as FileOperationError, _t as SkillsMiddlewareOptions, a as adaptBackendProtocol, an as FilesystemPermission, at as createAsyncSubAgentMiddleware, b as StoreBackendOptions, bn as GrepMatch, bt as skillsMetadataValue, c as LangSmithSandbox, cn as BackendFactory, ct as createSummarizationMiddleware, d as BaseSandbox, dn as DeleteResult, dt as MAX_SKILL_DESCRIPTION_LENGTH, en as TASK_SYSTEM_PROMPT, et as AsyncSubAgent, f as LocalShellBackend, fn as EditResult, ft as MAX_SKILL_FILE_SIZE, g as FilesystemBackend, gn as FileInfo, gt as SkillToolResolver, h as CompositeBackend, hn as FileDownloadResponse, ht as SkillMetadataEntry, i as LangSmithStartSandboxOptions, in as FilesystemOperation, it as TaskEvent, j as findProjectRoot, jn as SandboxInfo, jt as SubAgent, k as SettingsOptions, kn as SandboxErrorCode, kt as GENERAL_PURPOSE_SUBAGENT, l as LangSmithSandboxCreateOptions, ln as BackendProtocol, lt as CompletionCallbackOptions, m as ContextHubBackend, mn as FileData, mt as SkillMetadata$1, n as LangSmithCaptureSnapshotOptions, nn as FsToolName, nt as AsyncTask, o as adaptSandboxProtocol, on as PermissionMode, ot as isAsyncSubAgent, p as LocalShellBackendOptions, pn as ExecuteResponse, pt as MAX_SKILL_NAME_LENGTH, q as MergedDeepAgentState, qt as REQUIRED_MIDDLEWARE_NAMES, r as LangSmithSnapshot, rn as createFilesystemMiddleware, rt as AsyncTaskStatus, s as normalizeReadPagination, sn as AnyBackendProtocol, st as computeSummarizationDefaults, t as createDeepAgent, tn as FilesystemMiddlewareOptions, tt as AsyncSubAgentMiddlewareOptions, u as LangSmithSandboxOptions, un as BackendRuntime, ut as createCompletionCallbackMiddleware, v as StoreBackendContext, vn as FileUploadResponse, vt as createSkillsMiddleware, w as parseSkillMetadata, wn as ReadRawResult, wt as createPatchToolCallsMiddleware, x as ListSkillsOptions, xn as GrepResult, xt as MemoryMiddlewareOptions, y as StoreBackendNamespaceFactory, yn as GlobResult, yt as pinnedSkillsValue, z as ExtractSubAgentMiddleware, zn as resolveBackend, zt as harnessProfileConfigSchema } from "./agent-CLlZT-Mb.js";
|
|
2
2
|
export { ASYNC_TASK_SYSTEM_PROMPT, type AgentMemoryMiddlewareOptions, type AnyBackendProtocol, type AnySubAgent, type AsyncSubAgent, type AsyncSubAgentMiddlewareOptions, type AsyncTask, type AsyncTaskStatus, BASE_AGENT_PROMPT, type BackendFactory, type BackendProtocol, type BackendProtocolV1, type BackendProtocolV2, type BackendRuntime, BaseSandbox, type CompiledSubAgent, type CompletionCallbackOptions, CompositeBackend, ConfigurationError, type ConfigurationErrorCode, ContextHubBackend, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentRunStream, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type DeleteResult, EMPTY_HARNESS_PROFILE, EXECUTION_SYSTEM_PROMPT, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FilesystemOperation, type FilesystemPermission, type FlattenSubAgentMiddleware, type ForkedSubAgent, type FsToolName, GENERAL_PURPOSE_SUBAGENT, type GeneralPurposeSubagentConfig, type GlobResult, type GrepMatch, type GrepResult, type HarnessProfile, type HarnessProfileConfigData, type HarnessProfileOptions, type InferDeepAgentSubagents, type InferDeepAgentType, type InferStructuredResponse, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type LangSmithCaptureSnapshotOptions, LangSmithSandbox, type LangSmithSandboxCreateOptions, type LangSmithSandboxOptions, type LangSmithSnapshot, type LangSmithStartSandboxOptions, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, LocalShellBackend, type LocalShellBackendOptions, type LsResult, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, MULTIMODAL_BLOCK_TYPES, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type PermissionMode, REQUIRED_MIDDLEWARE_NAMES, type ReadRawResult, type ReadResult, type ResolveDeepAgentTypeConfig, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, type SandboxBackendProtocol, type SandboxBackendProtocolV1, type SandboxBackendProtocolV2, type SandboxDeleteOptions, SandboxError, type SandboxErrorCode, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type Settings, type SettingsOptions, type SkillMetadata$1 as SkillMetadata, type SkillMetadataEntry, type SkillToolResolver, type SkillsMiddlewareOptions, type StateAndStore, StateBackend, StoreBackend, type StoreBackendContext, type StoreBackendNamespaceFactory, type StoreBackendOptions, type SubAgent, type SubAgentMiddlewareOptions, type SubagentRunStream, type SupportedResponseFormat, type SystemPromptConfig, TASK_SYSTEM_PROMPT, type TaskEvent, type WriteResult, adaptBackendProtocol, adaptSandboxProtocol, applyGrepMaxCount, computeSummarizationDefaults, createAgentMemoryMiddleware, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createHarnessProfile, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgent, createSubAgentMiddleware, createSummarizationMiddleware, createUnsupportedContentMiddleware, filesValue, findProjectRoot, generalPurposeSubagentConfigSchema, getHarnessProfile, harnessProfileConfigSchema, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, listSkills, multimodalBlockSupported, normalizeReadPagination, parseHarnessProfileConfig, parseSkillMetadata, pinnedSkillsValue, registerHarnessProfile, resolveBackend, scrubUnsupportedMultimodalContent, serializeProfile, skillsMetadataValue };
|
package/dist/node.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as adaptSandboxProtocol, A as filesValue, B as createFilesystemMiddleware, C as MAX_SKILL_FILE_SIZE, D as skillsMetadataValue, E as pinnedSkillsValue, F as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, G as scrubUnsupportedMultimodalContent, H as MULTIMODAL_BLOCK_TYPES, I as createSubAgent, J as applyGrepMaxCount, K as StateBackend, L as createSubAgentMiddleware, M as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, N as DEFAULT_SUBAGENT_PROMPT, O as ConfigurationError, P as GENERAL_PURPOSE_SUBAGENT, Q as adaptBackendProtocol, R as computeSummarizationDefaults, S as MAX_SKILL_DESCRIPTION_LENGTH, T as createSkillsMiddleware, U as createUnsupportedContentMiddleware, V as CompositeBackend, W as multimodalBlockSupported, X as isSandboxProtocol, Y as isSandboxBackend, Z as resolveBackend, _ as createHarnessProfile, a as ASYNC_TASK_SYSTEM_PROMPT, b as isAsyncSubAgent, c as TASK_SYSTEM_PROMPT, d as registerHarnessProfile, f as generalPurposeSubagentConfigSchema, g as EMPTY_HARNESS_PROFILE, h as serializeProfile, i as StoreBackend, j as createPatchToolCallsMiddleware, k as createMemoryMiddleware, l as createDeepAgent, m as parseHarnessProfileConfig, n as BaseSandbox, o as BASE_AGENT_PROMPT, p as harnessProfileConfigSchema, q as SandboxError, r as ContextHubBackend, rt as normalizeReadPagination, s as EXECUTION_SYSTEM_PROMPT, t as LangSmithSandbox, u as getHarnessProfile, v as REQUIRED_MIDDLEWARE_NAMES, w as MAX_SKILL_NAME_LENGTH, x as createCompletionCallbackMiddleware, y as createAsyncSubAgentMiddleware, z as createSummarizationMiddleware } from "./langsmith-
|
|
2
|
-
import { a as createAgentMemoryMiddleware, i as parseSkillMetadata, n as FilesystemBackend, o as createSettings, r as listSkills, s as findProjectRoot, t as LocalShellBackend } from "./src-
|
|
1
|
+
import { $ as adaptSandboxProtocol, A as filesValue, B as createFilesystemMiddleware, C as MAX_SKILL_FILE_SIZE, D as skillsMetadataValue, E as pinnedSkillsValue, F as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, G as scrubUnsupportedMultimodalContent, H as MULTIMODAL_BLOCK_TYPES, I as createSubAgent, J as applyGrepMaxCount, K as StateBackend, L as createSubAgentMiddleware, M as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, N as DEFAULT_SUBAGENT_PROMPT, O as ConfigurationError, P as GENERAL_PURPOSE_SUBAGENT, Q as adaptBackendProtocol, R as computeSummarizationDefaults, S as MAX_SKILL_DESCRIPTION_LENGTH, T as createSkillsMiddleware, U as createUnsupportedContentMiddleware, V as CompositeBackend, W as multimodalBlockSupported, X as isSandboxProtocol, Y as isSandboxBackend, Z as resolveBackend, _ as createHarnessProfile, a as ASYNC_TASK_SYSTEM_PROMPT, b as isAsyncSubAgent, c as TASK_SYSTEM_PROMPT, d as registerHarnessProfile, f as generalPurposeSubagentConfigSchema, g as EMPTY_HARNESS_PROFILE, h as serializeProfile, i as StoreBackend, j as createPatchToolCallsMiddleware, k as createMemoryMiddleware, l as createDeepAgent, m as parseHarnessProfileConfig, n as BaseSandbox, o as BASE_AGENT_PROMPT, p as harnessProfileConfigSchema, q as SandboxError, r as ContextHubBackend, rt as normalizeReadPagination, s as EXECUTION_SYSTEM_PROMPT, t as LangSmithSandbox, u as getHarnessProfile, v as REQUIRED_MIDDLEWARE_NAMES, w as MAX_SKILL_NAME_LENGTH, x as createCompletionCallbackMiddleware, y as createAsyncSubAgentMiddleware, z as createSummarizationMiddleware } from "./langsmith-DYAFTn0y.js";
|
|
2
|
+
import { a as createAgentMemoryMiddleware, i as parseSkillMetadata, n as FilesystemBackend, o as createSettings, r as listSkills, s as findProjectRoot, t as LocalShellBackend } from "./src-B8R36RZW.js";
|
|
3
3
|
export { ASYNC_TASK_SYSTEM_PROMPT, BASE_AGENT_PROMPT, BaseSandbox, CompositeBackend, ConfigurationError, ContextHubBackend, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, EMPTY_HARNESS_PROFILE, EXECUTION_SYSTEM_PROMPT, FilesystemBackend, GENERAL_PURPOSE_SUBAGENT, LangSmithSandbox, LocalShellBackend, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, MULTIMODAL_BLOCK_TYPES, REQUIRED_MIDDLEWARE_NAMES, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, SandboxError, StateBackend, StoreBackend, TASK_SYSTEM_PROMPT, adaptBackendProtocol, adaptSandboxProtocol, applyGrepMaxCount, computeSummarizationDefaults, createAgentMemoryMiddleware, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createHarnessProfile, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgent, createSubAgentMiddleware, createSummarizationMiddleware, createUnsupportedContentMiddleware, filesValue, findProjectRoot, generalPurposeSubagentConfigSchema, getHarnessProfile, harnessProfileConfigSchema, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, listSkills, multimodalBlockSupported, normalizeReadPagination, parseHarnessProfileConfig, parseSkillMetadata, pinnedSkillsValue, registerHarnessProfile, resolveBackend, scrubUnsupportedMultimodalContent, serializeProfile, skillsMetadataValue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as applyGrepMaxCount, at as
|
|
1
|
+
import { J as applyGrepMaxCount, at as setPin, et as checkEmptyContent, it as performStringReplacement, nt as isTextMimeType, ot as setRealpath, q as SandboxError, rt as normalizeReadPagination, tt as getMimeType } from "./langsmith-DYAFTn0y.js";
|
|
2
2
|
import { createMiddleware } from "langchain";
|
|
3
3
|
import { omitPayload } from "@langchain/core/tracers/tracer_langchain";
|
|
4
4
|
import micromatch from "micromatch";
|
|
@@ -7,6 +7,7 @@ import yaml from "yaml";
|
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import os from "node:os";
|
|
10
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
11
|
import fs$1 from "node:fs/promises";
|
|
11
12
|
import cp, { spawn } from "node:child_process";
|
|
12
13
|
import fg from "fast-glob";
|
|
@@ -532,6 +533,17 @@ function listSkills(options) {
|
|
|
532
533
|
* and optional glob include filtering, while preserving virtual path behavior
|
|
533
534
|
*/
|
|
534
535
|
const SUPPORTS_NOFOLLOW = fs.constants.O_NOFOLLOW !== void 0;
|
|
536
|
+
/**
|
|
537
|
+
* Linux exposes each open descriptor as `/proc/self/fd/<n>`: reading the link
|
|
538
|
+
* gives the real path of what is open, and resolving through it stays inside
|
|
539
|
+
* that directory. Elsewhere the pin hook is not installed.
|
|
540
|
+
*/
|
|
541
|
+
const PROC_FD = "/proc/self/fd";
|
|
542
|
+
const SUPPORTS_PIN = process.platform === "linux" && fs.existsSync(PROC_FD);
|
|
543
|
+
const DIR_FLAGS = 2097152 | fs.constants.O_DIRECTORY;
|
|
544
|
+
function notFound(nativePath) {
|
|
545
|
+
return Object.assign(/* @__PURE__ */ new Error(`ENOENT: no such file or directory, '${nativePath}'`), { code: "ENOENT" });
|
|
546
|
+
}
|
|
535
547
|
/** A Windows drive root (`C:\`) or network-share root (`\\server\share\`). */
|
|
536
548
|
const WIN32_VOLUME_ROOT = /^(?:[A-Za-z]:[\\/]|[\\/]{2}(?![?.][\\/])[^\\/]+[\\/][^\\/]+[\\/]?)$/;
|
|
537
549
|
/**
|
|
@@ -560,12 +572,14 @@ var FilesystemBackend = class {
|
|
|
560
572
|
cwd;
|
|
561
573
|
virtualMode;
|
|
562
574
|
maxFileSizeBytes;
|
|
575
|
+
pinnedDir = new AsyncLocalStorage();
|
|
563
576
|
constructor(options = {}) {
|
|
564
577
|
const { rootDir, virtualMode = false, maxFileSizeMb = 10 } = options;
|
|
565
578
|
this.cwd = rootDir ? path.resolve(rootDir) : process.cwd();
|
|
566
579
|
this.virtualMode = virtualMode;
|
|
567
580
|
this.maxFileSizeBytes = maxFileSizeMb * 1024 * 1024;
|
|
568
581
|
setRealpath(this, (key) => this.resolveRealPath(key));
|
|
582
|
+
if (SUPPORTS_PIN) setPin(this, (key, options, authorize, operation) => this.runPinned(key, options, authorize, operation));
|
|
569
583
|
}
|
|
570
584
|
/**
|
|
571
585
|
* Resolve a file path with security checks.
|
|
@@ -658,7 +672,13 @@ var FilesystemBackend = class {
|
|
|
658
672
|
anchor = parent;
|
|
659
673
|
}
|
|
660
674
|
}
|
|
661
|
-
|
|
675
|
+
return this.toToolPath(path.join(realAnchor, ...missing), key);
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Map a native real path to the tool path form. Paths inside the root keep
|
|
679
|
+
* the root's configured form; in virtual mode a path outside the root throws.
|
|
680
|
+
*/
|
|
681
|
+
async toToolPath(realPath, key) {
|
|
662
682
|
let realRoot;
|
|
663
683
|
try {
|
|
664
684
|
realRoot = await fs$1.realpath(this.cwd);
|
|
@@ -674,6 +694,94 @@ var FilesystemBackend = class {
|
|
|
674
694
|
return toSlashRootedPath(insideRoot ? path.join(this.cwd, relative) : realPath);
|
|
675
695
|
}
|
|
676
696
|
/**
|
|
697
|
+
* {@link PinFn} implementation. Opens the deepest existing directory above
|
|
698
|
+
* `key`, authorizes the real path the kernel reports for it, creates any
|
|
699
|
+
* missing directories beneath it without following symlinks (when
|
|
700
|
+
* `options.create`), then runs `operation` with I/O on `key` routed through
|
|
701
|
+
* the open directory. A path component swapped after the directory is
|
|
702
|
+
* opened cannot redirect the operation.
|
|
703
|
+
*/
|
|
704
|
+
async runPinned(key, options, authorize, operation) {
|
|
705
|
+
const pinned = await this.pinParent(key, options, authorize);
|
|
706
|
+
if (pinned === void 0) return operation();
|
|
707
|
+
if (!("handle" in pinned)) return pinned;
|
|
708
|
+
const fdPath = `${PROC_FD}/${pinned.handle.fd}/`;
|
|
709
|
+
try {
|
|
710
|
+
const result = await this.pinnedDir.run(pinned, operation);
|
|
711
|
+
return typeof result.error === "string" ? {
|
|
712
|
+
...result,
|
|
713
|
+
error: result.error.replaceAll(fdPath, `${pinned.parent}/`)
|
|
714
|
+
} : result;
|
|
715
|
+
} finally {
|
|
716
|
+
await pinned.handle.close();
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Open and authorize the parent directory for {@link runPinned}. Returns
|
|
721
|
+
* `undefined` when `key` has no parent to pin (the root), and throws when
|
|
722
|
+
* the directory cannot be pinned.
|
|
723
|
+
*/
|
|
724
|
+
async pinParent(key, options, authorize) {
|
|
725
|
+
const target = this.resolvePath(key);
|
|
726
|
+
const parent = path.dirname(target);
|
|
727
|
+
if (parent === target || this.virtualMode && target === this.cwd) return;
|
|
728
|
+
const missing = [];
|
|
729
|
+
let dir = parent;
|
|
730
|
+
let handle;
|
|
731
|
+
while (handle === void 0) try {
|
|
732
|
+
handle = await fs$1.open(dir, DIR_FLAGS);
|
|
733
|
+
} catch (error) {
|
|
734
|
+
const code = error.code;
|
|
735
|
+
const next = path.dirname(dir);
|
|
736
|
+
if (code !== "ENOENT" && code !== "ENOTDIR" || next === dir) throw error;
|
|
737
|
+
missing.unshift(path.basename(dir));
|
|
738
|
+
dir = next;
|
|
739
|
+
}
|
|
740
|
+
let current = dir;
|
|
741
|
+
try {
|
|
742
|
+
const realDir = await fs$1.readlink(`${PROC_FD}/${handle.fd}`);
|
|
743
|
+
if (realDir.endsWith(" (deleted)")) throw notFound(dir);
|
|
744
|
+
const denied = await authorize(await this.toToolPath(path.join(realDir, ...missing, path.basename(target)), key));
|
|
745
|
+
if (denied !== void 0) {
|
|
746
|
+
await handle.close();
|
|
747
|
+
return { error: denied };
|
|
748
|
+
}
|
|
749
|
+
if (missing.length > 0 && !options.create) throw notFound(target);
|
|
750
|
+
for (const segment of missing) {
|
|
751
|
+
const child = `${PROC_FD}/${handle.fd}/${segment}`;
|
|
752
|
+
try {
|
|
753
|
+
await fs$1.mkdir(child);
|
|
754
|
+
} catch (error) {
|
|
755
|
+
if (error.code !== "EEXIST") throw error;
|
|
756
|
+
}
|
|
757
|
+
const next = await fs$1.open(child, DIR_FLAGS | fs.constants.O_NOFOLLOW);
|
|
758
|
+
const previous = handle;
|
|
759
|
+
handle = next;
|
|
760
|
+
current = path.join(current, segment);
|
|
761
|
+
await previous.close();
|
|
762
|
+
}
|
|
763
|
+
return {
|
|
764
|
+
parent,
|
|
765
|
+
handle
|
|
766
|
+
};
|
|
767
|
+
} catch (error) {
|
|
768
|
+
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") error.message = error.message.replaceAll(`${PROC_FD}/${handle.fd}/`, `${current}/`);
|
|
769
|
+
await handle.close();
|
|
770
|
+
throw error;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* The path to use for I/O on `resolvedPath`: routed through the directory
|
|
775
|
+
* pinned by {@link runPinned} when it is the parent, otherwise unchanged.
|
|
776
|
+
*/
|
|
777
|
+
ioPath(resolvedPath) {
|
|
778
|
+
return this.pinnedPath(resolvedPath) ?? resolvedPath;
|
|
779
|
+
}
|
|
780
|
+
pinnedPath(resolvedPath) {
|
|
781
|
+
const pinned = this.pinnedDir.getStore();
|
|
782
|
+
return pinned !== void 0 && path.dirname(resolvedPath) === pinned.parent ? `${PROC_FD}/${pinned.handle.fd}/${path.basename(resolvedPath)}` : void 0;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
677
785
|
* Resolve the concrete path to unlink for a virtual delete operation.
|
|
678
786
|
*/
|
|
679
787
|
async resolveDeletePath(resolvedPath, filePath) {
|
|
@@ -755,12 +863,13 @@ var FilesystemBackend = class {
|
|
|
755
863
|
try {
|
|
756
864
|
const resolvedPath = this.resolvePath(filePath);
|
|
757
865
|
await this.assertRealPathWithinRoot(resolvedPath, filePath, { includeLeaf: true });
|
|
866
|
+
const ioPath = this.ioPath(resolvedPath);
|
|
758
867
|
const mimeType = getMimeType(filePath);
|
|
759
868
|
const isBinary = !isTextMimeType(mimeType);
|
|
760
869
|
let content;
|
|
761
870
|
if (SUPPORTS_NOFOLLOW) {
|
|
762
|
-
if (!(await fs$1.stat(
|
|
763
|
-
const fd = await fs$1.open(
|
|
871
|
+
if (!(await fs$1.stat(ioPath)).isFile()) return { error: `File '${filePath}' not found` };
|
|
872
|
+
const fd = await fs$1.open(ioPath, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
764
873
|
try {
|
|
765
874
|
if (isBinary) {
|
|
766
875
|
const buffer = await fd.readFile();
|
|
@@ -774,17 +883,17 @@ var FilesystemBackend = class {
|
|
|
774
883
|
await fd.close();
|
|
775
884
|
}
|
|
776
885
|
} else {
|
|
777
|
-
const stat = await fs$1.lstat(
|
|
886
|
+
const stat = await fs$1.lstat(ioPath);
|
|
778
887
|
if (stat.isSymbolicLink()) return { error: `Symlinks are not allowed: ${filePath}` };
|
|
779
888
|
if (!stat.isFile()) return { error: `File '${filePath}' not found` };
|
|
780
889
|
if (isBinary) {
|
|
781
|
-
const buffer = await fs$1.readFile(
|
|
890
|
+
const buffer = await fs$1.readFile(ioPath);
|
|
782
891
|
return {
|
|
783
892
|
content: new Uint8Array(buffer),
|
|
784
893
|
mimeType
|
|
785
894
|
};
|
|
786
895
|
}
|
|
787
|
-
content = await fs$1.readFile(
|
|
896
|
+
content = await fs$1.readFile(ioPath, "utf-8");
|
|
788
897
|
}
|
|
789
898
|
const emptyMsg = checkEmptyContent(content);
|
|
790
899
|
if (emptyMsg) return {
|
|
@@ -875,15 +984,16 @@ var FilesystemBackend = class {
|
|
|
875
984
|
try {
|
|
876
985
|
const resolvedPath = this.resolvePath(filePath);
|
|
877
986
|
await this.assertRealPathWithinRoot(resolvedPath, filePath, { includeLeaf: true });
|
|
987
|
+
const ioPath = this.ioPath(resolvedPath);
|
|
878
988
|
const mimeType = getMimeType(filePath);
|
|
879
989
|
const isBinary = !isTextMimeType(mimeType);
|
|
880
990
|
try {
|
|
881
|
-
if ((await fs$1.lstat(
|
|
991
|
+
if ((await fs$1.lstat(ioPath)).isSymbolicLink()) return { error: `Cannot write to ${filePath} because it is a symlink. Symlinks are not allowed.` };
|
|
882
992
|
} catch {}
|
|
883
|
-
await fs$1.mkdir(path.dirname(
|
|
993
|
+
await fs$1.mkdir(path.dirname(ioPath), { recursive: true });
|
|
884
994
|
if (SUPPORTS_NOFOLLOW) {
|
|
885
995
|
const flags = fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_TRUNC | fs.constants.O_NOFOLLOW;
|
|
886
|
-
const fd = await fs$1.open(
|
|
996
|
+
const fd = await fs$1.open(ioPath, flags, 420);
|
|
887
997
|
try {
|
|
888
998
|
if (isBinary) {
|
|
889
999
|
const buffer = Buffer.from(content, "base64");
|
|
@@ -894,8 +1004,8 @@ var FilesystemBackend = class {
|
|
|
894
1004
|
}
|
|
895
1005
|
} else if (isBinary) {
|
|
896
1006
|
const buffer = Buffer.from(content, "base64");
|
|
897
|
-
await fs$1.writeFile(
|
|
898
|
-
} else await fs$1.writeFile(
|
|
1007
|
+
await fs$1.writeFile(ioPath, buffer);
|
|
1008
|
+
} else await fs$1.writeFile(ioPath, content, "utf-8");
|
|
899
1009
|
return {
|
|
900
1010
|
path: filePath,
|
|
901
1011
|
filesUpdate: null
|
|
@@ -926,7 +1036,7 @@ var FilesystemBackend = class {
|
|
|
926
1036
|
filesUpdate: null
|
|
927
1037
|
};
|
|
928
1038
|
}
|
|
929
|
-
const deletePath = await this.resolveDeletePath(resolvedPath, filePath);
|
|
1039
|
+
const deletePath = this.pinnedPath(resolvedPath) ?? await this.resolveDeletePath(resolvedPath, filePath);
|
|
930
1040
|
const stat = await fs$1.lstat(deletePath).catch(() => null);
|
|
931
1041
|
if (!stat) return { error: `Error: '${filePath}' not found` };
|
|
932
1042
|
if (stat.isDirectory() && !stat.isSymbolicLink()) await fs$1.rm(deletePath, {
|
|
@@ -950,33 +1060,34 @@ var FilesystemBackend = class {
|
|
|
950
1060
|
try {
|
|
951
1061
|
const resolvedPath = this.resolvePath(filePath);
|
|
952
1062
|
await this.assertRealPathWithinRoot(resolvedPath, filePath, { includeLeaf: true });
|
|
1063
|
+
const ioPath = this.ioPath(resolvedPath);
|
|
953
1064
|
let content;
|
|
954
1065
|
if (SUPPORTS_NOFOLLOW) {
|
|
955
|
-
if (!(await fs$1.stat(
|
|
956
|
-
const fd = await fs$1.open(
|
|
1066
|
+
if (!(await fs$1.stat(ioPath)).isFile()) return { error: `Error: File '${filePath}' not found` };
|
|
1067
|
+
const fd = await fs$1.open(ioPath, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
957
1068
|
try {
|
|
958
1069
|
content = await fd.readFile({ encoding: "utf-8" });
|
|
959
1070
|
} finally {
|
|
960
1071
|
await fd.close();
|
|
961
1072
|
}
|
|
962
1073
|
} else {
|
|
963
|
-
const stat = await fs$1.lstat(
|
|
1074
|
+
const stat = await fs$1.lstat(ioPath);
|
|
964
1075
|
if (stat.isSymbolicLink()) return { error: `Error: Symlinks are not allowed: ${filePath}` };
|
|
965
1076
|
if (!stat.isFile()) return { error: `Error: File '${filePath}' not found` };
|
|
966
|
-
content = await fs$1.readFile(
|
|
1077
|
+
content = await fs$1.readFile(ioPath, "utf-8");
|
|
967
1078
|
}
|
|
968
1079
|
const result = performStringReplacement(content, oldString, newString, replaceAll);
|
|
969
1080
|
if (typeof result === "string") return { error: result };
|
|
970
1081
|
const [newContent, occurrences] = result;
|
|
971
1082
|
if (SUPPORTS_NOFOLLOW) {
|
|
972
1083
|
const flags = fs.constants.O_WRONLY | fs.constants.O_TRUNC | fs.constants.O_NOFOLLOW;
|
|
973
|
-
const fd = await fs$1.open(
|
|
1084
|
+
const fd = await fs$1.open(ioPath, flags);
|
|
974
1085
|
try {
|
|
975
1086
|
await fd.writeFile(newContent, "utf-8");
|
|
976
1087
|
} finally {
|
|
977
1088
|
await fd.close();
|
|
978
1089
|
}
|
|
979
|
-
} else await fs$1.writeFile(
|
|
1090
|
+
} else await fs$1.writeFile(ioPath, newContent, "utf-8");
|
|
980
1091
|
return {
|
|
981
1092
|
path: filePath,
|
|
982
1093
|
filesUpdate: null,
|
|
@@ -1236,12 +1347,26 @@ var FilesystemBackend = class {
|
|
|
1236
1347
|
for (const filePath of paths) try {
|
|
1237
1348
|
const resolvedPath = this.resolvePath(filePath);
|
|
1238
1349
|
await this.assertRealPathWithinRoot(resolvedPath, filePath, { includeLeaf: true });
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1350
|
+
const fd = await fs$1.open(resolvedPath, fs.constants.O_RDONLY | (fs.constants.O_NONBLOCK ?? 0));
|
|
1351
|
+
try {
|
|
1352
|
+
const stat = await fd.stat();
|
|
1353
|
+
if (!stat.isFile()) {
|
|
1354
|
+
responses.push({
|
|
1355
|
+
path: filePath,
|
|
1356
|
+
content: null,
|
|
1357
|
+
error: stat.isDirectory() ? "is_directory" : "file_not_found"
|
|
1358
|
+
});
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
const content = await fd.readFile();
|
|
1362
|
+
responses.push({
|
|
1363
|
+
path: filePath,
|
|
1364
|
+
content,
|
|
1365
|
+
error: null
|
|
1366
|
+
});
|
|
1367
|
+
} finally {
|
|
1368
|
+
await fd.close();
|
|
1369
|
+
}
|
|
1245
1370
|
} catch (e) {
|
|
1246
1371
|
if (e.code === "ENOENT") responses.push({
|
|
1247
1372
|
path: filePath,
|
|
@@ -1563,4 +1688,4 @@ var LocalShellBackend = class LocalShellBackend extends FilesystemBackend {
|
|
|
1563
1688
|
};
|
|
1564
1689
|
export { createAgentMemoryMiddleware as a, parseSkillMetadata as i, FilesystemBackend as n, createSettings as o, listSkills as r, findProjectRoot as s, LocalShellBackend as t };
|
|
1565
1690
|
|
|
1566
|
-
//# sourceMappingURL=src-
|
|
1691
|
+
//# sourceMappingURL=src-B8R36RZW.js.map
|