noumen 0.6.0 → 0.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/README.md +237 -93
- package/dist/a2a/index.d.ts +5 -7
- package/dist/a2a/index.js +3 -4
- package/dist/a2a/index.js.map +1 -1
- package/dist/acp/index.d.ts +5 -7
- package/dist/acp/index.js +0 -1
- package/dist/acp/index.js.map +1 -1
- package/dist/{agent-DWE4_P5X.d.ts → agent-D0gl-qYi.d.ts} +89 -34
- package/dist/{chunk-6MMYCGJQ.js → chunk-5HY4IYNT.js} +1529 -2321
- package/dist/chunk-5HY4IYNT.js.map +1 -0
- package/dist/chunk-BC5BLWBC.js +21 -0
- package/dist/chunk-BC5BLWBC.js.map +1 -0
- package/dist/{chunk-XZN4QZLK.js → chunk-CX4BL6PC.js} +25 -15
- package/dist/chunk-CX4BL6PC.js.map +1 -0
- package/dist/{chunk-5GEX6ZSB.js → chunk-HQISH4D7.js} +60 -1
- package/dist/chunk-HQISH4D7.js.map +1 -0
- package/dist/{chunk-Y45R3PQL.js → chunk-NUCJXOUV.js} +32 -18
- package/dist/{chunk-Y45R3PQL.js.map → chunk-NUCJXOUV.js.map} +1 -1
- package/dist/chunk-OPFFLQZL.js +40 -0
- package/dist/chunk-OPFFLQZL.js.map +1 -0
- package/dist/chunk-PDEAJ272.js +660 -0
- package/dist/chunk-PDEAJ272.js.map +1 -0
- package/dist/chunk-PKHLGGEC.js +115 -0
- package/dist/chunk-PKHLGGEC.js.map +1 -0
- package/dist/chunk-XQTNXRE7.js +176 -0
- package/dist/chunk-XQTNXRE7.js.map +1 -0
- package/dist/chunk-XZPAA5TO.js +817 -0
- package/dist/chunk-XZPAA5TO.js.map +1 -0
- package/dist/cli/index.js +77 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.js +0 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client-JJFLE6RT.js +9 -0
- package/dist/{computer-BPdxSo6X.d.ts → computer-DzMR92tK.d.ts} +1 -1
- package/dist/docker.d.ts +2 -2
- package/dist/docker.js +0 -1
- package/dist/docker.js.map +1 -1
- package/dist/e2b.d.ts +2 -2
- package/dist/e2b.js +0 -1
- package/dist/e2b.js.map +1 -1
- package/dist/freestyle.d.ts +2 -2
- package/dist/freestyle.js +0 -1
- package/dist/freestyle.js.map +1 -1
- package/dist/{headless-FFU2DESQ.js → headless-25DU4MJQ.js} +1 -3
- package/dist/{headless-FFU2DESQ.js.map → headless-25DU4MJQ.js.map} +1 -1
- package/dist/{history-snip-64GYP4ZL.js → history-snip-HAWNAYKY.js} +1 -2
- package/dist/index.d.ts +351 -72
- package/dist/index.js +54 -55
- package/dist/jsonrpc/index.js +0 -1
- package/dist/local.d.ts +168 -0
- package/dist/local.js +40 -0
- package/dist/local.js.map +1 -0
- package/dist/lsp/index.d.ts +4 -5
- package/dist/lsp/index.js +0 -1
- package/dist/{lsp-PS3BWIHC.js → lsp-3APWNKB2.js} +1 -2
- package/dist/{manager-DLXK63XC.js → manager-Z5EQ7YYV.js} +1 -2
- package/dist/mcp/index.d.ts +16 -8
- package/dist/mcp/index.js +5 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/{mcp-auth-AEI2R4ZC.js → mcp-auth-NOIQPF7W.js} +1 -2
- package/dist/{provider-factory-TUHU3DIG.js → provider-factory-KNBSHXJ6.js} +3 -3
- package/dist/{render-GRN4ZSSW.js → render-4VEODRK7.js} +1 -2
- package/dist/{resolve-6KUZNEYW.js → resolve-AGQZFMKD.js} +3 -3
- package/dist/sandbox-DAqQo0Tj.d.ts +49 -0
- package/dist/sandbox-index-ODNREIFA.js +32 -0
- package/dist/sandbox-index-ODNREIFA.js.map +1 -0
- package/dist/server/index.d.ts +18 -7
- package/dist/server/index.js +9 -5
- package/dist/server/index.js.map +1 -1
- package/dist/{server-BzNGKTP6.d.ts → server-DFXdlqyX.d.ts} +1 -1
- package/dist/{spinner-OJNR6NFO.js → spinner-72JEISPK.js} +1 -2
- package/dist/sprites.d.ts +2 -2
- package/dist/sprites.js +0 -1
- package/dist/sprites.js.map +1 -1
- package/dist/ssh.d.ts +2 -2
- package/dist/ssh.js +0 -1
- package/dist/ssh.js.map +1 -1
- package/dist/{types-DhXwOQwD.d.ts → types-BX4ALqoN.d.ts} +76 -4
- package/dist/{types-kiGBF35b.d.ts → types-DLZNyF5t.d.ts} +125 -1
- package/dist/unsandboxed.d.ts +59 -0
- package/dist/unsandboxed.js +32 -0
- package/dist/unsandboxed.js.map +1 -0
- package/dist/{uuid-RVN2T26F.js → uuid-CVTNAPEB.js} +1 -2
- package/dist/{zod-7YXKWYMC.js → zod-VKURGPRT.js} +1 -2
- package/package.json +35 -50
- package/dist/cache-BlBwXXPS.d.ts +0 -38
- package/dist/chunk-5GEX6ZSB.js.map +0 -1
- package/dist/chunk-6MMYCGJQ.js.map +0 -1
- package/dist/chunk-7IQCQI2G.js +0 -94
- package/dist/chunk-7IQCQI2G.js.map +0 -1
- package/dist/chunk-CCM2AXZG.js +0 -16
- package/dist/chunk-CCM2AXZG.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-HEQQQGK5.js +0 -131
- package/dist/chunk-HEQQQGK5.js.map +0 -1
- package/dist/chunk-I3JTUFPK.js +0 -171
- package/dist/chunk-I3JTUFPK.js.map +0 -1
- package/dist/chunk-XZN4QZLK.js.map +0 -1
- package/dist/chunk-ZXSDKBYB.js +0 -474
- package/dist/chunk-ZXSDKBYB.js.map +0 -1
- package/dist/client-CRRO2376.js +0 -10
- package/dist/providers/anthropic.d.ts +0 -19
- package/dist/providers/anthropic.js +0 -36
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/bedrock.d.ts +0 -39
- package/dist/providers/bedrock.js +0 -56
- package/dist/providers/bedrock.js.map +0 -1
- package/dist/providers/gemini.d.ts +0 -17
- package/dist/providers/gemini.js +0 -262
- package/dist/providers/gemini.js.map +0 -1
- package/dist/providers/ollama.d.ts +0 -13
- package/dist/providers/ollama.js +0 -20
- package/dist/providers/ollama.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -21
- package/dist/providers/openai.js +0 -9
- package/dist/providers/openrouter.d.ts +0 -16
- package/dist/providers/openrouter.js +0 -24
- package/dist/providers/openrouter.js.map +0 -1
- package/dist/providers/vertex.d.ts +0 -42
- package/dist/providers/vertex.js +0 -68
- package/dist/providers/vertex.js.map +0 -1
- package/dist/sandbox-9qeMTNrD.d.ts +0 -126
- package/dist/types-CD0rUKKT.d.ts +0 -109
- package/dist/uuid-RVN2T26F.js.map +0 -1
- package/dist/zod-7YXKWYMC.js.map +0 -1
- /package/dist/{chunk-DGUM43GV.js.map → client-JJFLE6RT.js.map} +0 -0
- /package/dist/{client-CRRO2376.js.map → history-snip-HAWNAYKY.js.map} +0 -0
- /package/dist/{history-snip-64GYP4ZL.js.map → lsp-3APWNKB2.js.map} +0 -0
- /package/dist/{lsp-PS3BWIHC.js.map → manager-Z5EQ7YYV.js.map} +0 -0
- /package/dist/{manager-DLXK63XC.js.map → mcp-auth-NOIQPF7W.js.map} +0 -0
- /package/dist/{mcp-auth-AEI2R4ZC.js.map → provider-factory-KNBSHXJ6.js.map} +0 -0
- /package/dist/{provider-factory-TUHU3DIG.js.map → render-4VEODRK7.js.map} +0 -0
- /package/dist/{providers/openai.js.map → resolve-AGQZFMKD.js.map} +0 -0
- /package/dist/{render-GRN4ZSSW.js.map → spinner-72JEISPK.js.map} +0 -0
- /package/dist/{resolve-6KUZNEYW.js.map → uuid-CVTNAPEB.js.map} +0 -0
- /package/dist/{spinner-OJNR6NFO.js.map → zod-VKURGPRT.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FileMemoryProvider,
|
|
3
|
+
InProcessBackend,
|
|
4
|
+
Mailbox,
|
|
5
|
+
OTelTracer,
|
|
6
|
+
SwarmManager,
|
|
7
|
+
applyPermissionUpdate,
|
|
8
|
+
applyPermissionUpdates,
|
|
9
|
+
codingAgent,
|
|
10
|
+
planningAgent,
|
|
11
|
+
reviewAgent,
|
|
12
|
+
truncateIndex
|
|
13
|
+
} from "./chunk-PDEAJ272.js";
|
|
14
|
+
import {
|
|
15
|
+
AiSdkProvider,
|
|
16
|
+
DEFAULT_MODELS,
|
|
17
|
+
SUPPORTED_PROVIDERS,
|
|
18
|
+
detectProvider,
|
|
19
|
+
resolveProvider
|
|
20
|
+
} from "./chunk-XZPAA5TO.js";
|
|
21
|
+
import {
|
|
22
|
+
buildMcpToolName,
|
|
23
|
+
getMcpPrefix,
|
|
24
|
+
normalizeNameForMCP,
|
|
25
|
+
parseMcpToolName
|
|
26
|
+
} from "./chunk-4SQA2UCV.js";
|
|
1
27
|
import {
|
|
2
28
|
Agent,
|
|
3
29
|
CLEARED_PLACEHOLDER,
|
|
@@ -10,32 +36,20 @@ import {
|
|
|
10
36
|
DEFAULT_RETRY_CONFIG,
|
|
11
37
|
DenialTracker,
|
|
12
38
|
FileCheckpointManager,
|
|
13
|
-
FileMemoryProvider,
|
|
14
39
|
FileStateCache,
|
|
15
|
-
InProcessBackend,
|
|
16
40
|
InvariantViolation,
|
|
17
|
-
LocalComputer,
|
|
18
|
-
LocalFs,
|
|
19
|
-
LocalSandbox,
|
|
20
|
-
Mailbox,
|
|
21
41
|
NoopSpan,
|
|
22
42
|
NoopTracer,
|
|
23
|
-
OTelTracer,
|
|
24
43
|
STRUCTURED_OUTPUT_TOOL_NAME,
|
|
25
|
-
SandboxedLocalComputer,
|
|
26
44
|
SessionStorage,
|
|
27
45
|
SpanStatusCode,
|
|
28
46
|
StreamingToolExecutor,
|
|
29
|
-
SwarmManager,
|
|
30
47
|
TaskStore,
|
|
31
48
|
Thread,
|
|
32
|
-
UnsandboxedLocal,
|
|
33
49
|
activateContextForPaths,
|
|
34
50
|
activateSkillsForPaths,
|
|
35
51
|
agentTool,
|
|
36
52
|
all,
|
|
37
|
-
applyPermissionUpdate,
|
|
38
|
-
applyPermissionUpdates,
|
|
39
53
|
applyPersistedReplacements,
|
|
40
54
|
assertValidMessageSequence,
|
|
41
55
|
buildExtractionPrompt,
|
|
@@ -45,7 +59,6 @@ import {
|
|
|
45
59
|
calculateCost,
|
|
46
60
|
canAutoCompact,
|
|
47
61
|
classifyError,
|
|
48
|
-
codingAgent,
|
|
49
62
|
compactConversation,
|
|
50
63
|
createAutoCompactConfig,
|
|
51
64
|
createAutoCompactTracking,
|
|
@@ -79,6 +92,9 @@ import {
|
|
|
79
92
|
generateAutoTitle,
|
|
80
93
|
generateMissingToolResults,
|
|
81
94
|
getActiveSkills,
|
|
95
|
+
getAutoCompactThreshold,
|
|
96
|
+
getContextWindowForModel,
|
|
97
|
+
getEffectiveContextWindow,
|
|
82
98
|
getLastCacheSafeParams,
|
|
83
99
|
getRetryDelay,
|
|
84
100
|
getWorktreeChanges,
|
|
@@ -95,13 +111,12 @@ import {
|
|
|
95
111
|
parsePaths,
|
|
96
112
|
partitionToolCalls,
|
|
97
113
|
persistToolResult,
|
|
98
|
-
planningAgent,
|
|
99
114
|
reconstructContentReplacementState,
|
|
100
115
|
recordAutoCompactFailure,
|
|
101
116
|
recordAutoCompactSuccess,
|
|
117
|
+
registerContextWindows,
|
|
102
118
|
removeWorktree,
|
|
103
119
|
restoreSession,
|
|
104
|
-
reviewAgent,
|
|
105
120
|
runNotificationHooks,
|
|
106
121
|
runPostToolUseFailureHooks,
|
|
107
122
|
runPostToolUseHooks,
|
|
@@ -117,22 +132,21 @@ import {
|
|
|
117
132
|
taskUpdateTool,
|
|
118
133
|
tokenCountWithEstimation,
|
|
119
134
|
truncateHeadForPTLRetry,
|
|
120
|
-
truncateIndex,
|
|
121
135
|
tryReactiveCompact,
|
|
122
136
|
webSearchToolPlaceholder,
|
|
123
137
|
withRetry
|
|
124
|
-
} from "./chunk-
|
|
125
|
-
import {
|
|
126
|
-
DEFAULT_MODELS,
|
|
127
|
-
SUPPORTED_PROVIDERS,
|
|
128
|
-
detectProvider,
|
|
129
|
-
resolveProvider
|
|
130
|
-
} from "./chunk-7IQCQI2G.js";
|
|
138
|
+
} from "./chunk-5HY4IYNT.js";
|
|
131
139
|
import {
|
|
132
140
|
applySnipRemovals,
|
|
133
141
|
projectSnippedView,
|
|
134
142
|
snipMessagesByUuids
|
|
135
143
|
} from "./chunk-42PHHZUA.js";
|
|
144
|
+
import {
|
|
145
|
+
ChatStreamError,
|
|
146
|
+
getMessageCacheBreakpointIndex,
|
|
147
|
+
sortToolDefinitionsForCache
|
|
148
|
+
} from "./chunk-OPFFLQZL.js";
|
|
149
|
+
import "./chunk-3HEYCV26.js";
|
|
136
150
|
import {
|
|
137
151
|
RULE_SOURCE_PRECEDENCE,
|
|
138
152
|
TOOL_SEARCH_NAME,
|
|
@@ -170,50 +184,36 @@ import {
|
|
|
170
184
|
toolMatchesRule,
|
|
171
185
|
webFetchTool,
|
|
172
186
|
writeFileTool
|
|
173
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-CX4BL6PC.js";
|
|
188
|
+
import {
|
|
189
|
+
formatZodValidationError,
|
|
190
|
+
registerZodToJsonSchema,
|
|
191
|
+
zodToJsonSchema
|
|
192
|
+
} from "./chunk-3SK5GCI6.js";
|
|
174
193
|
import {
|
|
175
194
|
API_IMAGE_MAX_BASE64_SIZE,
|
|
195
|
+
DEFAULT_DOT_DIRS,
|
|
176
196
|
IMAGE_EXTENSIONS,
|
|
177
197
|
IMAGE_MAX_HEIGHT,
|
|
178
198
|
IMAGE_MAX_WIDTH,
|
|
179
199
|
compressImageBufferWithTokenLimit,
|
|
200
|
+
createDotDirResolver,
|
|
180
201
|
createImageMetadataText,
|
|
181
202
|
maybeResizeAndDownsampleImageBlock,
|
|
182
|
-
maybeResizeAndDownsampleImageBuffer
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
getMcpPrefix,
|
|
187
|
-
normalizeNameForMCP,
|
|
188
|
-
parseMcpToolName
|
|
189
|
-
} from "./chunk-4SQA2UCV.js";
|
|
190
|
-
import {
|
|
191
|
-
formatZodValidationError,
|
|
192
|
-
registerZodToJsonSchema,
|
|
193
|
-
zodToJsonSchema
|
|
194
|
-
} from "./chunk-3SK5GCI6.js";
|
|
195
|
-
import {
|
|
196
|
-
getAutoCompactThreshold,
|
|
197
|
-
getContextWindowForModel,
|
|
198
|
-
getEffectiveContextWindow,
|
|
199
|
-
getMessageCacheBreakpointIndex,
|
|
200
|
-
registerContextWindows,
|
|
201
|
-
sortToolDefinitionsForCache
|
|
202
|
-
} from "./chunk-HEQQQGK5.js";
|
|
203
|
-
import {
|
|
204
|
-
ChatStreamError
|
|
205
|
-
} from "./chunk-CCM2AXZG.js";
|
|
206
|
-
import "./chunk-3HEYCV26.js";
|
|
203
|
+
maybeResizeAndDownsampleImageBuffer,
|
|
204
|
+
readAllDotDirs,
|
|
205
|
+
readFirstDotDir
|
|
206
|
+
} from "./chunk-HQISH4D7.js";
|
|
207
207
|
import {
|
|
208
208
|
contentToString,
|
|
209
209
|
hasImageContent,
|
|
210
210
|
normalizeContent,
|
|
211
211
|
stripImageContent
|
|
212
212
|
} from "./chunk-JACGEMTF.js";
|
|
213
|
-
import "./chunk-DGUM43GV.js";
|
|
214
213
|
export {
|
|
215
214
|
API_IMAGE_MAX_BASE64_SIZE,
|
|
216
215
|
Agent,
|
|
216
|
+
AiSdkProvider,
|
|
217
217
|
CLEARED_PLACEHOLDER,
|
|
218
218
|
COMPACTABLE_TOOLS,
|
|
219
219
|
CannotRetryError,
|
|
@@ -221,6 +221,7 @@ export {
|
|
|
221
221
|
CostTracker,
|
|
222
222
|
DEFAULT_AUTO_TITLE_MAX_INPUT_CHARS,
|
|
223
223
|
DEFAULT_AUTO_TITLE_SYSTEM_PROMPT,
|
|
224
|
+
DEFAULT_DOT_DIRS,
|
|
224
225
|
DEFAULT_MODELS,
|
|
225
226
|
DEFAULT_PRICING,
|
|
226
227
|
DEFAULT_RETRY_CONFIG,
|
|
@@ -233,9 +234,6 @@ export {
|
|
|
233
234
|
IMAGE_MAX_WIDTH,
|
|
234
235
|
InProcessBackend,
|
|
235
236
|
InvariantViolation,
|
|
236
|
-
LocalComputer,
|
|
237
|
-
LocalFs,
|
|
238
|
-
LocalSandbox,
|
|
239
237
|
Mailbox,
|
|
240
238
|
NoopSpan,
|
|
241
239
|
NoopTracer,
|
|
@@ -243,7 +241,6 @@ export {
|
|
|
243
241
|
RULE_SOURCE_PRECEDENCE,
|
|
244
242
|
STRUCTURED_OUTPUT_TOOL_NAME,
|
|
245
243
|
SUPPORTED_PROVIDERS,
|
|
246
|
-
SandboxedLocalComputer,
|
|
247
244
|
SessionStorage,
|
|
248
245
|
SpanStatusCode,
|
|
249
246
|
StreamingToolExecutor,
|
|
@@ -252,7 +249,6 @@ export {
|
|
|
252
249
|
TaskStore,
|
|
253
250
|
Thread,
|
|
254
251
|
ToolRegistry,
|
|
255
|
-
UnsandboxedLocal,
|
|
256
252
|
activateContextForPaths,
|
|
257
253
|
activateSkillsForPaths,
|
|
258
254
|
agentTool,
|
|
@@ -287,6 +283,7 @@ export {
|
|
|
287
283
|
createCacheSafeParams,
|
|
288
284
|
createCheckpointState,
|
|
289
285
|
createContentReplacementState,
|
|
286
|
+
createDotDirResolver,
|
|
290
287
|
createImageMetadataText,
|
|
291
288
|
createSkillTool,
|
|
292
289
|
createStructuredOutputTool,
|
|
@@ -363,7 +360,9 @@ export {
|
|
|
363
360
|
planningAgent,
|
|
364
361
|
preserveQuoteStyle,
|
|
365
362
|
projectSnippedView,
|
|
363
|
+
readAllDotDirs,
|
|
366
364
|
readFileTool,
|
|
365
|
+
readFirstDotDir,
|
|
367
366
|
reconstructContentReplacementState,
|
|
368
367
|
recordAutoCompactFailure,
|
|
369
368
|
recordAutoCompactSuccess,
|
package/dist/jsonrpc/index.js
CHANGED
package/dist/local.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { A as AgentOptions, a as Agent } from './agent-D0gl-qYi.js';
|
|
2
|
+
import { a as VirtualComputer, E as ExecOptions, C as CommandResult, V as VirtualFs, R as ReadOptions, F as FileEntry, b as FileStat } from './computer-DzMR92tK.js';
|
|
3
|
+
import { S as Sandbox } from './sandbox-DAqQo0Tj.js';
|
|
4
|
+
import './types-DLZNyF5t.js';
|
|
5
|
+
import './types-BX4ALqoN.js';
|
|
6
|
+
import './types-2kTLUCnD.js';
|
|
7
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
8
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
9
|
+
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Filesystem and network restriction config passed to `@anthropic-ai/sandbox-runtime`.
|
|
13
|
+
*/
|
|
14
|
+
interface SandboxConfig {
|
|
15
|
+
filesystem?: {
|
|
16
|
+
/** Paths the agent may write to (default: `[cwd]`). Write is denied everywhere else. */
|
|
17
|
+
allowWrite?: string[];
|
|
18
|
+
/** Paths to explicitly deny writes within allowed regions. */
|
|
19
|
+
denyWrite?: string[];
|
|
20
|
+
/** Paths to deny reading. By default everything is readable. */
|
|
21
|
+
denyRead?: string[];
|
|
22
|
+
/** Paths to re-allow reading within denyRead regions. Takes precedence over denyRead. */
|
|
23
|
+
allowRead?: string[];
|
|
24
|
+
};
|
|
25
|
+
network?: {
|
|
26
|
+
/** Domains the agent may reach via HTTP/HTTPS/SOCKS. */
|
|
27
|
+
allowedDomains?: string[];
|
|
28
|
+
/** Domains to explicitly block. */
|
|
29
|
+
deniedDomains?: string[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface SandboxedLocalComputerOptions {
|
|
33
|
+
defaultCwd?: string;
|
|
34
|
+
defaultTimeout?: number;
|
|
35
|
+
sandbox?: SandboxConfig;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `VirtualComputer` that wraps every command with OS-level sandboxing via
|
|
39
|
+
* `@anthropic-ai/sandbox-runtime`. Uses macOS Seatbelt (`sandbox-exec`) or
|
|
40
|
+
* Linux bubblewrap (`bwrap`) under the hood.
|
|
41
|
+
*/
|
|
42
|
+
declare class SandboxedLocalComputer implements VirtualComputer {
|
|
43
|
+
private defaultCwd;
|
|
44
|
+
private defaultTimeout;
|
|
45
|
+
private sandboxConfig;
|
|
46
|
+
private initPromise;
|
|
47
|
+
private initialized;
|
|
48
|
+
constructor(opts?: SandboxedLocalComputerOptions);
|
|
49
|
+
private buildRuntimeConfig;
|
|
50
|
+
private ensureInitialized;
|
|
51
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Tear down the sandbox runtime. Call when the agent is done.
|
|
54
|
+
*/
|
|
55
|
+
dispose(): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface LocalSandboxOptions {
|
|
59
|
+
/** Working directory for both file resolution and command execution. */
|
|
60
|
+
cwd?: string;
|
|
61
|
+
/** Default timeout (ms) for shell commands. */
|
|
62
|
+
defaultTimeout?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Sandbox restrictions. Defaults: writes allowed only in `cwd`,
|
|
65
|
+
* reads allowed everywhere, network unrestricted.
|
|
66
|
+
*/
|
|
67
|
+
sandbox?: SandboxConfig;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a `Sandbox` with OS-level isolation via `@anthropic-ai/sandbox-runtime`.
|
|
71
|
+
*
|
|
72
|
+
* - **macOS**: Seatbelt (`sandbox-exec`) profiles restrict filesystem and network.
|
|
73
|
+
* - **Linux**: bubblewrap (`bwrap`) + socat for namespace-based isolation.
|
|
74
|
+
*
|
|
75
|
+
* Filesystem operations (`VirtualFs`) use the host `node:fs` — the sandbox
|
|
76
|
+
* boundary is enforced on shell commands (`VirtualComputer`), which is where
|
|
77
|
+
* the agent executes arbitrary code.
|
|
78
|
+
*
|
|
79
|
+
* Requires `@anthropic-ai/sandbox-runtime` as a peer dependency.
|
|
80
|
+
*/
|
|
81
|
+
declare function LocalSandbox(opts?: LocalSandboxOptions): Sandbox;
|
|
82
|
+
|
|
83
|
+
interface LocalFsOptions {
|
|
84
|
+
basePath?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Unsandboxed VirtualFs backed by `node:fs/promises` on the host machine.
|
|
88
|
+
* Paths resolve relative to `basePath`. Suitable for local development and
|
|
89
|
+
* trusted environments. For production or untrusted agents, use a sandboxed
|
|
90
|
+
* implementation like `SpritesFs` (remote container) or a custom
|
|
91
|
+
* Docker/E2B adapter instead.
|
|
92
|
+
*/
|
|
93
|
+
declare class LocalFs implements VirtualFs {
|
|
94
|
+
private basePath;
|
|
95
|
+
private resolvedBasePath;
|
|
96
|
+
private realBasePathPromise;
|
|
97
|
+
constructor(opts?: LocalFsOptions);
|
|
98
|
+
private getRealBasePath;
|
|
99
|
+
private resolve;
|
|
100
|
+
readFile(filePath: string, opts?: ReadOptions): Promise<string>;
|
|
101
|
+
readFileBytes(filePath: string, maxBytes?: number): Promise<Buffer>;
|
|
102
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
103
|
+
appendFile(filePath: string, content: string): Promise<void>;
|
|
104
|
+
deleteFile(filePath: string, opts?: {
|
|
105
|
+
recursive?: boolean;
|
|
106
|
+
}): Promise<void>;
|
|
107
|
+
mkdir(dirPath: string, opts?: {
|
|
108
|
+
recursive?: boolean;
|
|
109
|
+
}): Promise<void>;
|
|
110
|
+
readdir(dirPath: string, opts?: {
|
|
111
|
+
recursive?: boolean;
|
|
112
|
+
}): Promise<FileEntry[]>;
|
|
113
|
+
exists(filePath: string): Promise<boolean>;
|
|
114
|
+
stat(filePath: string): Promise<FileStat>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface LocalComputerOptions {
|
|
118
|
+
defaultCwd?: string;
|
|
119
|
+
defaultTimeout?: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Unsandboxed VirtualComputer that runs commands directly on the host via
|
|
123
|
+
* `node:child_process`. Suitable for local development and trusted
|
|
124
|
+
* environments. For production or untrusted agents, use a sandboxed
|
|
125
|
+
* implementation like `SpritesComputer` (remote container) or a custom
|
|
126
|
+
* Docker/E2B adapter instead.
|
|
127
|
+
*/
|
|
128
|
+
declare class LocalComputer implements VirtualComputer {
|
|
129
|
+
private defaultCwd;
|
|
130
|
+
private defaultTimeout;
|
|
131
|
+
constructor(opts?: LocalComputerOptions);
|
|
132
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Options for {@link LocalAgent} — the full `AgentOptions` surface minus
|
|
137
|
+
* `sandbox`, plus an optional `localSandbox` block for tuning the
|
|
138
|
+
* default-created {@link LocalSandbox} (filesystem / network restrictions,
|
|
139
|
+
* command timeouts).
|
|
140
|
+
*/
|
|
141
|
+
interface LocalAgentOptions extends Omit<AgentOptions, "sandbox"> {
|
|
142
|
+
/**
|
|
143
|
+
* Forwarded to {@link LocalSandbox}. If `cwd` is omitted here it
|
|
144
|
+
* defaults to `opts.cwd` / `opts.options.cwd` / `process.cwd()`.
|
|
145
|
+
*/
|
|
146
|
+
localSandbox?: Omit<LocalSandboxOptions, "cwd"> & {
|
|
147
|
+
cwd?: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Convenience factory that constructs an {@link Agent} backed by a
|
|
152
|
+
* {@link LocalSandbox} (OS-level sandboxing via
|
|
153
|
+
* `@anthropic-ai/sandbox-runtime`). Equivalent to:
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* new Agent({ ...opts, sandbox: LocalSandbox({ cwd }) })
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* Lives on the `noumen/local` subpath rather than the root barrel so that
|
|
160
|
+
* `import { Agent } from "noumen"` never transitively pulls the local
|
|
161
|
+
* computer adapter (and `node:child_process`) into the module graph.
|
|
162
|
+
*
|
|
163
|
+
* Defaults: writes allowed only in `cwd`, reads allowed everywhere,
|
|
164
|
+
* network unrestricted. Pass `localSandbox.sandbox` to tighten.
|
|
165
|
+
*/
|
|
166
|
+
declare function LocalAgent(opts: LocalAgentOptions): Agent;
|
|
167
|
+
|
|
168
|
+
export { LocalAgent, type LocalAgentOptions, LocalComputer, type LocalComputerOptions, LocalFs, type LocalFsOptions, LocalSandbox, type LocalSandboxOptions, type SandboxConfig, SandboxedLocalComputer, type SandboxedLocalComputerOptions };
|
package/dist/local.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LocalSandbox,
|
|
3
|
+
SandboxedLocalComputer
|
|
4
|
+
} from "./chunk-PKHLGGEC.js";
|
|
5
|
+
import {
|
|
6
|
+
LocalComputer,
|
|
7
|
+
LocalFs
|
|
8
|
+
} from "./chunk-XQTNXRE7.js";
|
|
9
|
+
import {
|
|
10
|
+
Agent
|
|
11
|
+
} from "./chunk-5HY4IYNT.js";
|
|
12
|
+
import "./chunk-42PHHZUA.js";
|
|
13
|
+
import "./chunk-OPFFLQZL.js";
|
|
14
|
+
import "./chunk-3HEYCV26.js";
|
|
15
|
+
import "./chunk-CX4BL6PC.js";
|
|
16
|
+
import "./chunk-3SK5GCI6.js";
|
|
17
|
+
import "./chunk-HQISH4D7.js";
|
|
18
|
+
import "./chunk-JACGEMTF.js";
|
|
19
|
+
|
|
20
|
+
// src/local.ts
|
|
21
|
+
function LocalAgent(opts) {
|
|
22
|
+
const cwd = opts.localSandbox?.cwd ?? opts.cwd ?? opts.options?.cwd ?? process.cwd();
|
|
23
|
+
const { localSandbox, ...rest } = opts;
|
|
24
|
+
return new Agent({
|
|
25
|
+
...rest,
|
|
26
|
+
sandbox: LocalSandbox({
|
|
27
|
+
cwd,
|
|
28
|
+
defaultTimeout: localSandbox?.defaultTimeout,
|
|
29
|
+
sandbox: localSandbox?.sandbox
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
LocalAgent,
|
|
35
|
+
LocalComputer,
|
|
36
|
+
LocalFs,
|
|
37
|
+
LocalSandbox,
|
|
38
|
+
SandboxedLocalComputer
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/local.ts"],"sourcesContent":["// Local sandbox binding (OS-level isolation via @anthropic-ai/sandbox-runtime).\n//\n// Importing this subpath pulls in the local sandbox factory and its adapter\n// primitives. The root barrel (`noumen`) intentionally does not re-export\n// this module so that `import { Agent } from \"noumen\"` stays structurally\n// lightweight and every sandbox is opted into by import.\n//\n// import { LocalSandbox } from \"noumen/local\";\n\nimport { Agent, type AgentOptions } from \"./agent.js\";\nimport { LocalSandbox, type LocalSandboxOptions } from \"./virtual/local-sandbox.js\";\n\nexport {\n LocalSandbox,\n type LocalSandboxOptions,\n type SandboxConfig,\n} from \"./virtual/local-sandbox.js\";\nexport { LocalFs, type LocalFsOptions } from \"./virtual/local-fs.js\";\nexport {\n LocalComputer,\n type LocalComputerOptions,\n} from \"./virtual/local-computer.js\";\nexport {\n SandboxedLocalComputer,\n type SandboxedLocalComputerOptions,\n} from \"./virtual/sandboxed-local-computer.js\";\n\n/**\n * Options for {@link LocalAgent} — the full `AgentOptions` surface minus\n * `sandbox`, plus an optional `localSandbox` block for tuning the\n * default-created {@link LocalSandbox} (filesystem / network restrictions,\n * command timeouts).\n */\nexport interface LocalAgentOptions extends Omit<AgentOptions, \"sandbox\"> {\n /**\n * Forwarded to {@link LocalSandbox}. If `cwd` is omitted here it\n * defaults to `opts.cwd` / `opts.options.cwd` / `process.cwd()`.\n */\n localSandbox?: Omit<LocalSandboxOptions, \"cwd\"> & { cwd?: string };\n}\n\n/**\n * Convenience factory that constructs an {@link Agent} backed by a\n * {@link LocalSandbox} (OS-level sandboxing via\n * `@anthropic-ai/sandbox-runtime`). Equivalent to:\n *\n * ```ts\n * new Agent({ ...opts, sandbox: LocalSandbox({ cwd }) })\n * ```\n *\n * Lives on the `noumen/local` subpath rather than the root barrel so that\n * `import { Agent } from \"noumen\"` never transitively pulls the local\n * computer adapter (and `node:child_process`) into the module graph.\n *\n * Defaults: writes allowed only in `cwd`, reads allowed everywhere,\n * network unrestricted. Pass `localSandbox.sandbox` to tighten.\n */\nexport function LocalAgent(opts: LocalAgentOptions): Agent {\n const cwd = opts.localSandbox?.cwd ?? opts.cwd ?? opts.options?.cwd ?? process.cwd();\n const { localSandbox, ...rest } = opts;\n return new Agent({\n ...rest,\n sandbox: LocalSandbox({\n cwd,\n defaultTimeout: localSandbox?.defaultTimeout,\n sandbox: localSandbox?.sandbox,\n }),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyDO,SAAS,WAAW,MAAgC;AACzD,QAAM,MAAM,KAAK,cAAc,OAAO,KAAK,OAAO,KAAK,SAAS,OAAO,QAAQ,IAAI;AACnF,QAAM,EAAE,cAAc,GAAG,KAAK,IAAI;AAClC,SAAO,IAAI,MAAM;AAAA,IACf,GAAG;AAAA,IACH,SAAS,aAAa;AAAA,MACpB;AAAA,MACA,gBAAgB,cAAc;AAAA,MAC9B,SAAS,cAAc;AAAA,IACzB,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
package/dist/lsp/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { L as LspServerConfig, a as LspServerState, b as LspDiagnostic, T as Tool } from '../types-
|
|
2
|
-
export { D as DiagnosticRegistry, c as LspLocation, d as LspOperation, e as LspServerManager, f as LspSymbol } from '../types-
|
|
3
|
-
import '../
|
|
4
|
-
import '../
|
|
5
|
-
import '../types-CD0rUKKT.js';
|
|
1
|
+
import { L as LspServerConfig, a as LspServerState, b as LspDiagnostic, T as Tool } from '../types-BX4ALqoN.js';
|
|
2
|
+
export { D as DiagnosticRegistry, c as LspLocation, d as LspOperation, e as LspServerManager, f as LspSymbol } from '../types-BX4ALqoN.js';
|
|
3
|
+
import '../computer-DzMR92tK.js';
|
|
4
|
+
import '../types-DLZNyF5t.js';
|
|
6
5
|
|
|
7
6
|
interface ServerCapabilities {
|
|
8
7
|
definitionProvider?: boolean;
|
package/dist/lsp/index.js
CHANGED
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { M as McpClientManager } from '../server-
|
|
2
|
-
export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, d as createMcpServer, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from '../server-
|
|
1
|
+
import { M as McpClientManager } from '../server-DFXdlqyX.js';
|
|
2
|
+
export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, d as createMcpServer, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from '../server-DFXdlqyX.js';
|
|
3
3
|
import { T as TokenStorage, O as OAuthTokenData, a as OAuthProviderOptions } from '../types-2kTLUCnD.js';
|
|
4
4
|
export { b as McpConfig, c as McpConnection, d as McpHttpServerConfig, e as McpOAuthConfig, M as McpServerConfig, f as McpSseServerConfig, g as McpStdioServerConfig, h as McpToolInfo, i as McpWebSocketServerConfig } from '../types-2kTLUCnD.js';
|
|
5
|
+
import { i as DotDirResolver, T as Tool } from '../types-BX4ALqoN.js';
|
|
5
6
|
import { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
6
7
|
export { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
8
|
import { OAuthClientMetadata, OAuthClientInformationMixed, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
9
|
export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
9
|
-
import { T as Tool } from '../types-DhXwOQwD.js';
|
|
10
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
11
|
-
import '../
|
|
12
|
-
import '../
|
|
13
|
-
import '../types-CD0rUKKT.js';
|
|
11
|
+
import '../computer-DzMR92tK.js';
|
|
12
|
+
import '../types-DLZNyF5t.js';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* In-memory token storage. Suitable for tests, short-lived processes,
|
|
@@ -26,10 +25,19 @@ declare class InMemoryTokenStorage implements TokenStorage {
|
|
|
26
25
|
* File-backed token storage. Persists all server tokens to a single JSON
|
|
27
26
|
* file so they survive process restarts. Each server key maps to its own
|
|
28
27
|
* entry in the file.
|
|
28
|
+
*
|
|
29
|
+
* Reads walk all candidate dot-dirs in preference order, so tokens written
|
|
30
|
+
* by an older install under `.claude/` keep working; writes always target
|
|
31
|
+
* the resolver's canonical write dir (default `.noumen/`).
|
|
29
32
|
*/
|
|
30
33
|
declare class FileTokenStorage implements TokenStorage {
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
/** Explicit path override, if provided. */
|
|
35
|
+
private explicitPath?;
|
|
36
|
+
private resolver;
|
|
37
|
+
private homeBase;
|
|
38
|
+
constructor(filePath?: string, resolver?: DotDirResolver);
|
|
39
|
+
private get writePath();
|
|
40
|
+
private readCandidatePaths;
|
|
33
41
|
load(serverKey: string): Promise<OAuthTokenData | undefined>;
|
|
34
42
|
save(serverKey: string, data: OAuthTokenData): Promise<void>;
|
|
35
43
|
delete(serverKey: string): Promise<void>;
|
package/dist/mcp/index.js
CHANGED
|
@@ -5,25 +5,24 @@ import {
|
|
|
5
5
|
NoumenOAuthProvider,
|
|
6
6
|
OAuthCallbackServer,
|
|
7
7
|
findAvailablePort
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-NUCJXOUV.js";
|
|
9
9
|
import {
|
|
10
10
|
createMcpAuthTool
|
|
11
11
|
} from "../chunk-BZSFUEWM.js";
|
|
12
|
-
import {
|
|
13
|
-
ToolRegistry
|
|
14
|
-
} from "../chunk-XZN4QZLK.js";
|
|
15
|
-
import "../chunk-5GEX6ZSB.js";
|
|
16
12
|
import {
|
|
17
13
|
buildMcpToolName,
|
|
18
14
|
getMcpPrefix,
|
|
19
15
|
normalizeNameForMCP,
|
|
20
16
|
parseMcpToolName
|
|
21
17
|
} from "../chunk-4SQA2UCV.js";
|
|
18
|
+
import {
|
|
19
|
+
ToolRegistry
|
|
20
|
+
} from "../chunk-CX4BL6PC.js";
|
|
22
21
|
import "../chunk-3SK5GCI6.js";
|
|
22
|
+
import "../chunk-HQISH4D7.js";
|
|
23
23
|
import {
|
|
24
24
|
contentToString
|
|
25
25
|
} from "../chunk-JACGEMTF.js";
|
|
26
|
-
import "../chunk-DGUM43GV.js";
|
|
27
26
|
|
|
28
27
|
// src/mcp/server.ts
|
|
29
28
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mcp/server.ts"],"sourcesContent":["import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n type CallToolResult,\n type ListToolsResult,\n type Tool as McpSdkTool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { Tool, ToolContext } from \"../tools/types.js\";\nimport { ToolRegistry } from \"../tools/registry.js\";\nimport { contentToString } from \"../utils/content.js\";\n\nexport interface McpServerOptions {\n /** Additional tools beyond the 6 built-ins */\n tools?: Tool[];\n /** Context passed to tool.call() for all invocations */\n toolContext: ToolContext;\n /** Server name reported to clients */\n name?: string;\n /** Server version reported to clients */\n version?: string;\n}\n\n/**\n * Start an MCP server over stdio that exposes noumen's tools.\n * This is the entry point for `noumen mcp` or similar CLI integrations.\n */\nexport async function createMcpServer(opts: McpServerOptions): Promise<void> {\n const registry = new ToolRegistry(opts.tools);\n\n const server = new Server(\n { name: opts.name ?? \"noumen\", version: opts.version ?? \"0.1.0\" },\n { capabilities: { tools: {} } },\n );\n\n server.setRequestHandler(\n ListToolsRequestSchema,\n async (): Promise<ListToolsResult> => {\n const tools = registry.listTools();\n return {\n tools: tools.map(\n (tool): McpSdkTool => ({\n name: tool.name,\n description: tool.description,\n inputSchema: {\n type: \"object\" as const,\n properties: tool.parameters.properties as Record<string, object>,\n ...(tool.parameters.required\n ? { required: tool.parameters.required }\n : {}),\n },\n }),\n ),\n };\n },\n );\n\n server.setRequestHandler(\n CallToolRequestSchema,\n async ({ params: { name, arguments: args } }): Promise<CallToolResult> => {\n const tool = registry.get(name);\n if (!tool) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n };\n }\n\n try {\n const result = await tool.call(\n (args as Record<string, unknown>) ?? {},\n opts.toolContext,\n );\n return {\n isError: result.isError,\n content: [{ type: \"text\", text: contentToString(result.content) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\", text: message }],\n };\n }\n },\n );\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/server.ts"],"sourcesContent":["import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n type CallToolResult,\n type ListToolsResult,\n type Tool as McpSdkTool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { Tool, ToolContext } from \"../tools/types.js\";\nimport { ToolRegistry } from \"../tools/registry.js\";\nimport { contentToString } from \"../utils/content.js\";\n\nexport interface McpServerOptions {\n /** Additional tools beyond the 6 built-ins */\n tools?: Tool[];\n /** Context passed to tool.call() for all invocations */\n toolContext: ToolContext;\n /** Server name reported to clients */\n name?: string;\n /** Server version reported to clients */\n version?: string;\n}\n\n/**\n * Start an MCP server over stdio that exposes noumen's tools.\n * This is the entry point for `noumen mcp` or similar CLI integrations.\n */\nexport async function createMcpServer(opts: McpServerOptions): Promise<void> {\n const registry = new ToolRegistry(opts.tools);\n\n const server = new Server(\n { name: opts.name ?? \"noumen\", version: opts.version ?? \"0.1.0\" },\n { capabilities: { tools: {} } },\n );\n\n server.setRequestHandler(\n ListToolsRequestSchema,\n async (): Promise<ListToolsResult> => {\n const tools = registry.listTools();\n return {\n tools: tools.map(\n (tool): McpSdkTool => ({\n name: tool.name,\n description: tool.description,\n inputSchema: {\n type: \"object\" as const,\n properties: tool.parameters.properties as Record<string, object>,\n ...(tool.parameters.required\n ? { required: tool.parameters.required }\n : {}),\n },\n }),\n ),\n };\n },\n );\n\n server.setRequestHandler(\n CallToolRequestSchema,\n async ({ params: { name, arguments: args } }): Promise<CallToolResult> => {\n const tool = registry.get(name);\n if (!tool) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n };\n }\n\n try {\n const result = await tool.call(\n (args as Record<string, unknown>) ?? {},\n opts.toolContext,\n );\n return {\n isError: result.isError,\n content: [{ type: \"text\", text: contentToString(result.content) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\", text: message }],\n };\n }\n },\n );\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAoBP,eAAsB,gBAAgB,MAAuC;AAC3E,QAAM,WAAW,IAAI,aAAa,KAAK,KAAK;AAE5C,QAAM,SAAS,IAAI;AAAA,IACjB,EAAE,MAAM,KAAK,QAAQ,UAAU,SAAS,KAAK,WAAW,QAAQ;AAAA,IAChE,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,EAAE;AAAA,EAChC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAsC;AACpC,YAAM,QAAQ,SAAS,UAAU;AACjC,aAAO;AAAA,QACL,OAAO,MAAM;AAAA,UACX,CAAC,UAAsB;AAAA,YACrB,MAAM,KAAK;AAAA,YACX,aAAa,KAAK;AAAA,YAClB,aAAa;AAAA,cACX,MAAM;AAAA,cACN,YAAY,KAAK,WAAW;AAAA,cAC5B,GAAI,KAAK,WAAW,WAChB,EAAE,UAAU,KAAK,WAAW,SAAS,IACrC,CAAC;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,KAAK,EAAE,MAA+B;AACxE,YAAM,OAAO,SAAS,IAAI,IAAI;AAC9B,UAAI,CAAC,MAAM;AACT,eAAO;AAAA,UACL,SAAS;AAAA,UACT,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,iBAAiB,IAAI,GAAG,CAAC;AAAA,QAC3D;AAAA,MACF;AAEA,UAAI;AACF,cAAM,SAAS,MAAM,KAAK;AAAA,UACvB,QAAoC,CAAC;AAAA,UACtC,KAAK;AAAA,QACP;AACA,eAAO;AAAA,UACL,SAAS,OAAO;AAAA,UAChB,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,gBAAgB,OAAO,OAAO,EAAE,CAAC;AAAA,QACnE;AAAA,MACF,SAAS,KAAK;AACZ,cAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,eAAO;AAAA,UACL,SAAS;AAAA,UACT,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,QAAQ,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;","names":[]}
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
SUPPORTED_PROVIDERS,
|
|
8
8
|
detectProvider,
|
|
9
9
|
resolveProvider
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-XZPAA5TO.js";
|
|
11
|
+
import "./chunk-OPFFLQZL.js";
|
|
12
12
|
export {
|
|
13
13
|
DEFAULT_MODELS,
|
|
14
14
|
SUPPORTED_PROVIDERS,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
isOllamaRunning,
|
|
18
18
|
ollamaBaseURL
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=provider-factory-
|
|
20
|
+
//# sourceMappingURL=provider-factory-KNBSHXJ6.js.map
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
promptPermission,
|
|
5
5
|
renderEvent
|
|
6
6
|
} from "./chunk-OGXNFXFA.js";
|
|
7
|
-
import "./chunk-DGUM43GV.js";
|
|
8
7
|
export {
|
|
9
8
|
createRenderState,
|
|
10
9
|
isVisibleEvent,
|
|
11
10
|
promptPermission,
|
|
12
11
|
renderEvent
|
|
13
12
|
};
|
|
14
|
-
//# sourceMappingURL=render-
|
|
13
|
+
//# sourceMappingURL=render-4VEODRK7.js.map
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
SUPPORTED_PROVIDERS,
|
|
4
4
|
detectProvider,
|
|
5
5
|
resolveProvider
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-XZPAA5TO.js";
|
|
7
|
+
import "./chunk-OPFFLQZL.js";
|
|
8
8
|
export {
|
|
9
9
|
DEFAULT_MODELS,
|
|
10
10
|
SUPPORTED_PROVIDERS,
|
|
11
11
|
detectProvider,
|
|
12
12
|
resolveProvider
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=resolve-
|
|
14
|
+
//# sourceMappingURL=resolve-AGQZFMKD.js.map
|