noumen 0.5.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-C3eDRsxs.d.ts → agent-D0gl-qYi.d.ts} +259 -31
- package/dist/{chunk-WPCYGZOE.js → chunk-5HY4IYNT.js} +2062 -2545
- 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 +358 -72
- package/dist/index.js +68 -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-KI7OZUY3.js → provider-factory-KNBSHXJ6.js} +3 -3
- package/dist/{render-GRN4ZSSW.js → render-4VEODRK7.js} +1 -2
- package/dist/{resolve-GDSHNMG6.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-Cu9gv1dk.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-BA87bHPV.d.ts → types-BX4ALqoN.d.ts} +76 -4
- package/dist/{types-LrU4LRmX.d.ts → types-DLZNyF5t.d.ts} +164 -2
- 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-DsRqxx6v.d.ts +0 -38
- package/dist/chunk-5GEX6ZSB.js.map +0 -1
- package/dist/chunk-CS6WNDCF.js +0 -171
- package/dist/chunk-CS6WNDCF.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-EKOGVTBT.js +0 -472
- package/dist/chunk-EKOGVTBT.js.map +0 -1
- package/dist/chunk-HEQQQGK5.js +0 -131
- package/dist/chunk-HEQQQGK5.js.map +0 -1
- package/dist/chunk-L3L3FG5T.js +0 -16
- package/dist/chunk-L3L3FG5T.js.map +0 -1
- package/dist/chunk-WPCYGZOE.js.map +0 -1
- package/dist/chunk-WTLK2ZAR.js +0 -94
- package/dist/chunk-WTLK2ZAR.js.map +0 -1
- package/dist/chunk-XZN4QZLK.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 -35
- 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 -67
- 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-KI7OZUY3.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-GDSHNMG6.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,38 +1,55 @@
|
|
|
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,
|
|
4
30
|
COMPACTABLE_TOOLS,
|
|
5
31
|
CannotRetryError,
|
|
6
32
|
CostTracker,
|
|
33
|
+
DEFAULT_AUTO_TITLE_MAX_INPUT_CHARS,
|
|
34
|
+
DEFAULT_AUTO_TITLE_SYSTEM_PROMPT,
|
|
7
35
|
DEFAULT_PRICING,
|
|
8
36
|
DEFAULT_RETRY_CONFIG,
|
|
9
37
|
DenialTracker,
|
|
10
38
|
FileCheckpointManager,
|
|
11
|
-
FileMemoryProvider,
|
|
12
39
|
FileStateCache,
|
|
13
|
-
InProcessBackend,
|
|
14
40
|
InvariantViolation,
|
|
15
|
-
LocalComputer,
|
|
16
|
-
LocalFs,
|
|
17
|
-
LocalSandbox,
|
|
18
|
-
Mailbox,
|
|
19
41
|
NoopSpan,
|
|
20
42
|
NoopTracer,
|
|
21
|
-
OTelTracer,
|
|
22
43
|
STRUCTURED_OUTPUT_TOOL_NAME,
|
|
23
|
-
|
|
44
|
+
SessionStorage,
|
|
24
45
|
SpanStatusCode,
|
|
25
46
|
StreamingToolExecutor,
|
|
26
|
-
SwarmManager,
|
|
27
47
|
TaskStore,
|
|
28
48
|
Thread,
|
|
29
|
-
UnsandboxedLocal,
|
|
30
49
|
activateContextForPaths,
|
|
31
50
|
activateSkillsForPaths,
|
|
32
51
|
agentTool,
|
|
33
52
|
all,
|
|
34
|
-
applyPermissionUpdate,
|
|
35
|
-
applyPermissionUpdates,
|
|
36
53
|
applyPersistedReplacements,
|
|
37
54
|
assertValidMessageSequence,
|
|
38
55
|
buildExtractionPrompt,
|
|
@@ -42,7 +59,6 @@ import {
|
|
|
42
59
|
calculateCost,
|
|
43
60
|
canAutoCompact,
|
|
44
61
|
classifyError,
|
|
45
|
-
codingAgent,
|
|
46
62
|
compactConversation,
|
|
47
63
|
createAutoCompactConfig,
|
|
48
64
|
createAutoCompactTracking,
|
|
@@ -65,14 +81,20 @@ import {
|
|
|
65
81
|
exitPlanModeTool,
|
|
66
82
|
exitWorktreeTool,
|
|
67
83
|
extractMemories,
|
|
84
|
+
extractTitleFromResponse,
|
|
85
|
+
extractTitleSeedText,
|
|
68
86
|
filterActiveContextFiles,
|
|
69
87
|
filterOrphanedThinkingMessages,
|
|
70
88
|
filterUnresolvedToolUses,
|
|
71
89
|
filterWhitespaceOnlyAssistantMessages,
|
|
72
90
|
findGitRoot,
|
|
73
91
|
findModelPricing,
|
|
92
|
+
generateAutoTitle,
|
|
74
93
|
generateMissingToolResults,
|
|
75
94
|
getActiveSkills,
|
|
95
|
+
getAutoCompactThreshold,
|
|
96
|
+
getContextWindowForModel,
|
|
97
|
+
getEffectiveContextWindow,
|
|
76
98
|
getLastCacheSafeParams,
|
|
77
99
|
getRetryDelay,
|
|
78
100
|
getWorktreeChanges,
|
|
@@ -83,18 +105,18 @@ import {
|
|
|
83
105
|
loadSkills,
|
|
84
106
|
microcompactMessages,
|
|
85
107
|
normalizeMessagesForAPI,
|
|
108
|
+
normalizeTitle,
|
|
86
109
|
parseAllowedTools,
|
|
87
110
|
parseFrontmatter,
|
|
88
111
|
parsePaths,
|
|
89
112
|
partitionToolCalls,
|
|
90
113
|
persistToolResult,
|
|
91
|
-
planningAgent,
|
|
92
114
|
reconstructContentReplacementState,
|
|
93
115
|
recordAutoCompactFailure,
|
|
94
116
|
recordAutoCompactSuccess,
|
|
117
|
+
registerContextWindows,
|
|
95
118
|
removeWorktree,
|
|
96
119
|
restoreSession,
|
|
97
|
-
reviewAgent,
|
|
98
120
|
runNotificationHooks,
|
|
99
121
|
runPostToolUseFailureHooks,
|
|
100
122
|
runPostToolUseHooks,
|
|
@@ -110,22 +132,21 @@ import {
|
|
|
110
132
|
taskUpdateTool,
|
|
111
133
|
tokenCountWithEstimation,
|
|
112
134
|
truncateHeadForPTLRetry,
|
|
113
|
-
truncateIndex,
|
|
114
135
|
tryReactiveCompact,
|
|
115
136
|
webSearchToolPlaceholder,
|
|
116
137
|
withRetry
|
|
117
|
-
} from "./chunk-
|
|
118
|
-
import {
|
|
119
|
-
DEFAULT_MODELS,
|
|
120
|
-
SUPPORTED_PROVIDERS,
|
|
121
|
-
detectProvider,
|
|
122
|
-
resolveProvider
|
|
123
|
-
} from "./chunk-WTLK2ZAR.js";
|
|
138
|
+
} from "./chunk-5HY4IYNT.js";
|
|
124
139
|
import {
|
|
125
140
|
applySnipRemovals,
|
|
126
141
|
projectSnippedView,
|
|
127
142
|
snipMessagesByUuids
|
|
128
143
|
} from "./chunk-42PHHZUA.js";
|
|
144
|
+
import {
|
|
145
|
+
ChatStreamError,
|
|
146
|
+
getMessageCacheBreakpointIndex,
|
|
147
|
+
sortToolDefinitionsForCache
|
|
148
|
+
} from "./chunk-OPFFLQZL.js";
|
|
149
|
+
import "./chunk-3HEYCV26.js";
|
|
129
150
|
import {
|
|
130
151
|
RULE_SOURCE_PRECEDENCE,
|
|
131
152
|
TOOL_SEARCH_NAME,
|
|
@@ -163,55 +184,44 @@ import {
|
|
|
163
184
|
toolMatchesRule,
|
|
164
185
|
webFetchTool,
|
|
165
186
|
writeFileTool
|
|
166
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-CX4BL6PC.js";
|
|
188
|
+
import {
|
|
189
|
+
formatZodValidationError,
|
|
190
|
+
registerZodToJsonSchema,
|
|
191
|
+
zodToJsonSchema
|
|
192
|
+
} from "./chunk-3SK5GCI6.js";
|
|
167
193
|
import {
|
|
168
194
|
API_IMAGE_MAX_BASE64_SIZE,
|
|
195
|
+
DEFAULT_DOT_DIRS,
|
|
169
196
|
IMAGE_EXTENSIONS,
|
|
170
197
|
IMAGE_MAX_HEIGHT,
|
|
171
198
|
IMAGE_MAX_WIDTH,
|
|
172
199
|
compressImageBufferWithTokenLimit,
|
|
200
|
+
createDotDirResolver,
|
|
173
201
|
createImageMetadataText,
|
|
174
202
|
maybeResizeAndDownsampleImageBlock,
|
|
175
|
-
maybeResizeAndDownsampleImageBuffer
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
getMcpPrefix,
|
|
180
|
-
normalizeNameForMCP,
|
|
181
|
-
parseMcpToolName
|
|
182
|
-
} from "./chunk-4SQA2UCV.js";
|
|
183
|
-
import {
|
|
184
|
-
formatZodValidationError,
|
|
185
|
-
registerZodToJsonSchema,
|
|
186
|
-
zodToJsonSchema
|
|
187
|
-
} from "./chunk-3SK5GCI6.js";
|
|
188
|
-
import {
|
|
189
|
-
getAutoCompactThreshold,
|
|
190
|
-
getContextWindowForModel,
|
|
191
|
-
getEffectiveContextWindow,
|
|
192
|
-
getMessageCacheBreakpointIndex,
|
|
193
|
-
registerContextWindows,
|
|
194
|
-
sortToolDefinitionsForCache
|
|
195
|
-
} from "./chunk-HEQQQGK5.js";
|
|
196
|
-
import {
|
|
197
|
-
ChatStreamError
|
|
198
|
-
} from "./chunk-L3L3FG5T.js";
|
|
199
|
-
import "./chunk-3HEYCV26.js";
|
|
203
|
+
maybeResizeAndDownsampleImageBuffer,
|
|
204
|
+
readAllDotDirs,
|
|
205
|
+
readFirstDotDir
|
|
206
|
+
} from "./chunk-HQISH4D7.js";
|
|
200
207
|
import {
|
|
201
208
|
contentToString,
|
|
202
209
|
hasImageContent,
|
|
203
210
|
normalizeContent,
|
|
204
211
|
stripImageContent
|
|
205
212
|
} from "./chunk-JACGEMTF.js";
|
|
206
|
-
import "./chunk-DGUM43GV.js";
|
|
207
213
|
export {
|
|
208
214
|
API_IMAGE_MAX_BASE64_SIZE,
|
|
209
215
|
Agent,
|
|
216
|
+
AiSdkProvider,
|
|
210
217
|
CLEARED_PLACEHOLDER,
|
|
211
218
|
COMPACTABLE_TOOLS,
|
|
212
219
|
CannotRetryError,
|
|
213
220
|
ChatStreamError,
|
|
214
221
|
CostTracker,
|
|
222
|
+
DEFAULT_AUTO_TITLE_MAX_INPUT_CHARS,
|
|
223
|
+
DEFAULT_AUTO_TITLE_SYSTEM_PROMPT,
|
|
224
|
+
DEFAULT_DOT_DIRS,
|
|
215
225
|
DEFAULT_MODELS,
|
|
216
226
|
DEFAULT_PRICING,
|
|
217
227
|
DEFAULT_RETRY_CONFIG,
|
|
@@ -224,9 +234,6 @@ export {
|
|
|
224
234
|
IMAGE_MAX_WIDTH,
|
|
225
235
|
InProcessBackend,
|
|
226
236
|
InvariantViolation,
|
|
227
|
-
LocalComputer,
|
|
228
|
-
LocalFs,
|
|
229
|
-
LocalSandbox,
|
|
230
237
|
Mailbox,
|
|
231
238
|
NoopSpan,
|
|
232
239
|
NoopTracer,
|
|
@@ -234,7 +241,7 @@ export {
|
|
|
234
241
|
RULE_SOURCE_PRECEDENCE,
|
|
235
242
|
STRUCTURED_OUTPUT_TOOL_NAME,
|
|
236
243
|
SUPPORTED_PROVIDERS,
|
|
237
|
-
|
|
244
|
+
SessionStorage,
|
|
238
245
|
SpanStatusCode,
|
|
239
246
|
StreamingToolExecutor,
|
|
240
247
|
SwarmManager,
|
|
@@ -242,7 +249,6 @@ export {
|
|
|
242
249
|
TaskStore,
|
|
243
250
|
Thread,
|
|
244
251
|
ToolRegistry,
|
|
245
|
-
UnsandboxedLocal,
|
|
246
252
|
activateContextForPaths,
|
|
247
253
|
activateSkillsForPaths,
|
|
248
254
|
agentTool,
|
|
@@ -277,6 +283,7 @@ export {
|
|
|
277
283
|
createCacheSafeParams,
|
|
278
284
|
createCheckpointState,
|
|
279
285
|
createContentReplacementState,
|
|
286
|
+
createDotDirResolver,
|
|
280
287
|
createImageMetadataText,
|
|
281
288
|
createSkillTool,
|
|
282
289
|
createStructuredOutputTool,
|
|
@@ -298,6 +305,8 @@ export {
|
|
|
298
305
|
exitWorktreeTool,
|
|
299
306
|
extractCommandName,
|
|
300
307
|
extractMemories,
|
|
308
|
+
extractTitleFromResponse,
|
|
309
|
+
extractTitleSeedText,
|
|
301
310
|
filterActiveContextFiles,
|
|
302
311
|
filterOrphanedThinkingMessages,
|
|
303
312
|
filterUnresolvedToolUses,
|
|
@@ -307,6 +316,7 @@ export {
|
|
|
307
316
|
findModelPricing,
|
|
308
317
|
formatDeferredToolLine,
|
|
309
318
|
formatZodValidationError,
|
|
319
|
+
generateAutoTitle,
|
|
310
320
|
generateMissingToolResults,
|
|
311
321
|
getActiveSkills,
|
|
312
322
|
getAutoCompactThreshold,
|
|
@@ -339,6 +349,7 @@ export {
|
|
|
339
349
|
normalizeMessagesForAPI,
|
|
340
350
|
normalizeNameForMCP,
|
|
341
351
|
normalizeQuotes,
|
|
352
|
+
normalizeTitle,
|
|
342
353
|
notebookEditTool,
|
|
343
354
|
parseAllowedTools,
|
|
344
355
|
parseFrontmatter,
|
|
@@ -349,7 +360,9 @@ export {
|
|
|
349
360
|
planningAgent,
|
|
350
361
|
preserveQuoteStyle,
|
|
351
362
|
projectSnippedView,
|
|
363
|
+
readAllDotDirs,
|
|
352
364
|
readFileTool,
|
|
365
|
+
readFirstDotDir,
|
|
353
366
|
reconstructContentReplacementState,
|
|
354
367
|
recordAutoCompactFailure,
|
|
355
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-BA87bHPV.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
|