amalgm 0.0.0 → 0.0.32
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 +41 -1
- package/bin/amalgm.js +8 -2
- package/lib/auth-store.js +223 -0
- package/lib/cli.js +1132 -0
- package/lib/paths.js +30 -0
- package/lib/supervisor.js +476 -0
- package/lib/tunnel-chat.js +328 -0
- package/lib/tunnel-events.js +499 -0
- package/package.json +30 -3
- package/runtime/README.md +4 -0
- package/runtime/lib/chatInput.js +315 -0
- package/runtime/lib/harnesses.js +988 -0
- package/runtime/lib/local/amalgmStore.js +136 -0
- package/runtime/lib/local/credentialResolver.js +425 -0
- package/runtime/lib/mcpApps/registry.js +619 -0
- package/runtime/package.json +5 -0
- package/runtime/scripts/amalgm-mcp/agents/rest.js +144 -0
- package/runtime/scripts/amalgm-mcp/agents/store.js +684 -0
- package/runtime/scripts/amalgm-mcp/agents/talk.js +1162 -0
- package/runtime/scripts/amalgm-mcp/agents/tools.js +221 -0
- package/runtime/scripts/amalgm-mcp/artifacts/advertise.js +132 -0
- package/runtime/scripts/amalgm-mcp/artifacts/rest.js +103 -0
- package/runtime/scripts/amalgm-mcp/artifacts/store.js +157 -0
- package/runtime/scripts/amalgm-mcp/artifacts/supervisor.js +402 -0
- package/runtime/scripts/amalgm-mcp/artifacts/tools.js +176 -0
- package/runtime/scripts/amalgm-mcp/browser/page.js +637 -0
- package/runtime/scripts/amalgm-mcp/browser/tools.js +688 -0
- package/runtime/scripts/amalgm-mcp/config.js +140 -0
- package/runtime/scripts/amalgm-mcp/credentials/rest.js +45 -0
- package/runtime/scripts/amalgm-mcp/deps.js +40 -0
- package/runtime/scripts/amalgm-mcp/email/inbound.js +215 -0
- package/runtime/scripts/amalgm-mcp/events/executor.js +179 -0
- package/runtime/scripts/amalgm-mcp/events/ingress.js +113 -0
- package/runtime/scripts/amalgm-mcp/events/matcher.js +125 -0
- package/runtime/scripts/amalgm-mcp/events/rest.js +200 -0
- package/runtime/scripts/amalgm-mcp/events/ring-buffer.js +19 -0
- package/runtime/scripts/amalgm-mcp/events/store.js +113 -0
- package/runtime/scripts/amalgm-mcp/events/tools.js +306 -0
- package/runtime/scripts/amalgm-mcp/events/webhook-url.js +28 -0
- package/runtime/scripts/amalgm-mcp/fs/rest.js +293 -0
- package/runtime/scripts/amalgm-mcp/index.js +100 -0
- package/runtime/scripts/amalgm-mcp/lib/chat-runner.js +167 -0
- package/runtime/scripts/amalgm-mcp/lib/email-md.js +288 -0
- package/runtime/scripts/amalgm-mcp/lib/mcp-resolver.js +63 -0
- package/runtime/scripts/amalgm-mcp/lib/prefs.js +441 -0
- package/runtime/scripts/amalgm-mcp/lib/storage.js +92 -0
- package/runtime/scripts/amalgm-mcp/lib/supabase.js +118 -0
- package/runtime/scripts/amalgm-mcp/lib/tool-result.js +177 -0
- package/runtime/scripts/amalgm-mcp/local/rest.js +87 -0
- package/runtime/scripts/amalgm-mcp/mcp-connections/rest.js +234 -0
- package/runtime/scripts/amalgm-mcp/notify/index.js +107 -0
- package/runtime/scripts/amalgm-mcp/server/core-tools.js +20 -0
- package/runtime/scripts/amalgm-mcp/server/http.js +377 -0
- package/runtime/scripts/amalgm-mcp/server/mcp.js +127 -0
- package/runtime/scripts/amalgm-mcp/slack/inbound.js +200 -0
- package/runtime/scripts/amalgm-mcp/state/db.js +194 -0
- package/runtime/scripts/amalgm-mcp/state/events.js +113 -0
- package/runtime/scripts/amalgm-mcp/state/rest.js +64 -0
- package/runtime/scripts/amalgm-mcp/state/snapshot.js +76 -0
- package/runtime/scripts/amalgm-mcp/tasks/executor.js +225 -0
- package/runtime/scripts/amalgm-mcp/tasks/rest.js +110 -0
- package/runtime/scripts/amalgm-mcp/tasks/schedule-normalization.js +85 -0
- package/runtime/scripts/amalgm-mcp/tasks/scheduler.js +105 -0
- package/runtime/scripts/amalgm-mcp/tasks/store.js +154 -0
- package/runtime/scripts/amalgm-mcp/tasks/tools.js +391 -0
- package/runtime/scripts/amalgm-mcp/toolbox/rest.js +75 -0
- package/runtime/scripts/amalgm-mcp/toolbox/runner.js +257 -0
- package/runtime/scripts/amalgm-mcp/toolbox/store.js +933 -0
- package/runtime/scripts/amalgm-mcp/toolbox/tools.js +269 -0
- package/runtime/scripts/amalgm-mcp/user-api-keys/rest.js +105 -0
- package/runtime/scripts/amalgm-mcp/workspace/rest.js +497 -0
- package/runtime/scripts/chat-core/adapters/claude.js +165 -0
- package/runtime/scripts/chat-core/adapters/codex.js +313 -0
- package/runtime/scripts/chat-core/adapters/opencode.js +412 -0
- package/runtime/scripts/chat-core/auth.js +177 -0
- package/runtime/scripts/chat-core/contract.js +328 -0
- package/runtime/scripts/chat-core/credentials/store.js +212 -0
- package/runtime/scripts/chat-core/egress.js +87 -0
- package/runtime/scripts/chat-core/engine.js +253 -0
- package/runtime/scripts/chat-core/event-schema.js +231 -0
- package/runtime/scripts/chat-core/events.js +190 -0
- package/runtime/scripts/chat-core/index.js +11 -0
- package/runtime/scripts/chat-core/input.js +50 -0
- package/runtime/scripts/chat-core/normalizers/claude.js +450 -0
- package/runtime/scripts/chat-core/normalizers/codex.js +380 -0
- package/runtime/scripts/chat-core/normalizers/normalizer_spec.md +259 -0
- package/runtime/scripts/chat-core/normalizers/opencode.js +552 -0
- package/runtime/scripts/chat-core/normalizers/tool_contract.md +123 -0
- package/runtime/scripts/chat-core/normalizers/usage_contract.md +304 -0
- package/runtime/scripts/chat-core/parts.js +253 -0
- package/runtime/scripts/chat-core/recorder.js +65 -0
- package/runtime/scripts/chat-core/runtime.js +86 -0
- package/runtime/scripts/chat-core/server.js +163 -0
- package/runtime/scripts/chat-core/sse.js +196 -0
- package/runtime/scripts/chat-core/stores.js +100 -0
- package/runtime/scripts/chat-core/tool-display.js +149 -0
- package/runtime/scripts/chat-core/tool-shape.js +143 -0
- package/runtime/scripts/chat-core/tooling/mcp-bundle.js +161 -0
- package/runtime/scripts/chat-core/tooling/mcp-relay.js +97 -0
- package/runtime/scripts/chat-core/tooling/native-binaries.js +608 -0
- package/runtime/scripts/chat-core/tooling/system-prompt.js +20 -0
- package/runtime/scripts/chat-core/usage.js +343 -0
- package/runtime/scripts/chat-server/config.js +110 -0
- package/runtime/scripts/chat-server/db.js +529 -0
- package/runtime/scripts/chat-server/index.js +33 -0
- package/runtime/scripts/chat-server/model-catalog.js +327 -0
- package/runtime/scripts/chat-server.js +75 -0
- package/runtime/scripts/credential-adapter.js +131 -0
- package/runtime/scripts/fs-watcher.js +888 -0
- package/runtime/scripts/local-gateway.js +854 -0
- package/runtime/scripts/platform-context.txt +246 -0
- package/runtime/scripts/port-monitor.js +175 -0
- package/runtime/scripts/proxy-token-store.js +162 -0
- package/runtime/scripts/runtime-auth.js +163 -0
- package/runtime/scripts/test-claude-code-models.js +87 -0
- package/runtime/tsconfig.json +15 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
const { z } = require('zod');
|
|
2
|
+
|
|
3
|
+
const VALID_AUTH_METHODS = ['amalgm', 'byok', 'provider_auth'];
|
|
4
|
+
|
|
5
|
+
const ChatInputTextPartSchema = z.object({
|
|
6
|
+
type: z.literal('text'),
|
|
7
|
+
text: z.string().default(''),
|
|
8
|
+
}).passthrough();
|
|
9
|
+
|
|
10
|
+
const ChatInputFilePartSchema = z.object({
|
|
11
|
+
type: z.literal('file'),
|
|
12
|
+
filename: z.string().optional(),
|
|
13
|
+
mediaType: z.string().optional(),
|
|
14
|
+
url: z.string().optional(),
|
|
15
|
+
storagePath: z.string().optional(),
|
|
16
|
+
storage_path: z.string().optional(),
|
|
17
|
+
computerPath: z.string().optional(),
|
|
18
|
+
sandboxPath: z.string().optional(),
|
|
19
|
+
assetId: z.string().optional(),
|
|
20
|
+
}).passthrough();
|
|
21
|
+
|
|
22
|
+
const ChatInputUnknownPartSchema = z.object({
|
|
23
|
+
type: z.string(),
|
|
24
|
+
}).passthrough();
|
|
25
|
+
|
|
26
|
+
const ChatInputPartSchema = z.union([
|
|
27
|
+
ChatInputTextPartSchema,
|
|
28
|
+
ChatInputFilePartSchema,
|
|
29
|
+
ChatInputUnknownPartSchema,
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
const WorkspaceTargetSchema = z.discriminatedUnion('kind', [
|
|
33
|
+
z.object({
|
|
34
|
+
kind: z.literal('cwd'),
|
|
35
|
+
cwd: z.string(),
|
|
36
|
+
}),
|
|
37
|
+
z.object({
|
|
38
|
+
kind: z.literal('existing-worktree'),
|
|
39
|
+
path: z.string(),
|
|
40
|
+
}),
|
|
41
|
+
z.object({
|
|
42
|
+
kind: z.literal('managed-worktree'),
|
|
43
|
+
repoPath: z.string(),
|
|
44
|
+
branch: z.string(),
|
|
45
|
+
baseBranch: z.string().nullable().optional(),
|
|
46
|
+
path: z.string().nullable().optional(),
|
|
47
|
+
}),
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
const ChatInputSchema = z.object({
|
|
51
|
+
parts: z.array(ChatInputPartSchema).default([]),
|
|
52
|
+
agent: z.object({
|
|
53
|
+
harness: z.string().nullable().optional(),
|
|
54
|
+
model: z.string().nullable().optional(),
|
|
55
|
+
authMethod: z.enum(VALID_AUTH_METHODS).nullable().optional(),
|
|
56
|
+
customAgentId: z.string().nullable().optional(),
|
|
57
|
+
systemPrompt: z.string().nullable().optional(),
|
|
58
|
+
}).default({}),
|
|
59
|
+
tools: z.object({
|
|
60
|
+
mcpAppIds: z.array(z.string()).default([]),
|
|
61
|
+
mode: z.enum(['all', 'selected']).default('all'),
|
|
62
|
+
toolIds: z.array(z.string()).default([]),
|
|
63
|
+
}).default({}),
|
|
64
|
+
execution: z.object({
|
|
65
|
+
cwd: z.string().nullable().optional(),
|
|
66
|
+
computerId: z.string().nullable().optional(),
|
|
67
|
+
workspace: WorkspaceTargetSchema.nullable().optional(),
|
|
68
|
+
}).default({}),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
function isObject(value) {
|
|
72
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function cleanString(value) {
|
|
76
|
+
return typeof value === 'string' && value.trim() ? value : null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function firstString(...values) {
|
|
80
|
+
for (const value of values) {
|
|
81
|
+
const cleaned = cleanString(value);
|
|
82
|
+
if (cleaned) return cleaned;
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function uniqueStrings(values) {
|
|
88
|
+
if (!Array.isArray(values)) return [];
|
|
89
|
+
return [...new Set(values.filter((value) => typeof value === 'string' && value.trim()).map((value) => value.trim()))];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function normalizeWorkspace(rawWorkspace, fallbackCwd) {
|
|
93
|
+
if (isObject(rawWorkspace) && typeof rawWorkspace.kind === 'string') {
|
|
94
|
+
const parsed = WorkspaceTargetSchema.safeParse(rawWorkspace);
|
|
95
|
+
if (parsed.success) return parsed.data;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const cwd = cleanString(fallbackCwd);
|
|
99
|
+
return cwd ? { kind: 'cwd', cwd } : null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getWorkspaceCwd(workspace) {
|
|
103
|
+
if (!workspace || !isObject(workspace)) return null;
|
|
104
|
+
if (workspace.kind === 'cwd' && cleanString(workspace.cwd)) return workspace.cwd.trim();
|
|
105
|
+
if (workspace.kind === 'existing-worktree' && cleanString(workspace.path)) return workspace.path.trim();
|
|
106
|
+
if (workspace.kind === 'managed-worktree') {
|
|
107
|
+
return firstString(workspace.path, workspace.repoPath);
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function normalizeChatPart(part) {
|
|
113
|
+
if (!isObject(part) || typeof part.type !== 'string') return null;
|
|
114
|
+
|
|
115
|
+
if (part.type === 'text') {
|
|
116
|
+
return {
|
|
117
|
+
...part,
|
|
118
|
+
type: 'text',
|
|
119
|
+
text: typeof part.text === 'string' ? part.text : '',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (part.type === 'file') {
|
|
124
|
+
const storagePath = firstString(part.storagePath, part.storage_path);
|
|
125
|
+
const computerPath = firstString(part.computerPath, part.sandboxPath);
|
|
126
|
+
return {
|
|
127
|
+
...part,
|
|
128
|
+
type: 'file',
|
|
129
|
+
...(cleanString(part.filename) ? { filename: part.filename.trim() } : {}),
|
|
130
|
+
...(cleanString(part.mediaType) ? { mediaType: part.mediaType.trim() } : {}),
|
|
131
|
+
...(cleanString(part.url) ? { url: part.url.trim() } : {}),
|
|
132
|
+
...(storagePath ? { storagePath, storage_path: storagePath } : {}),
|
|
133
|
+
...(computerPath ? { computerPath, sandboxPath: computerPath } : {}),
|
|
134
|
+
...(cleanString(part.assetId) ? { assetId: part.assetId.trim() } : {}),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return { ...part };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function normalizeChatParts(parts, fallbackPrompt) {
|
|
142
|
+
const normalized = Array.isArray(parts)
|
|
143
|
+
? parts.map(normalizeChatPart).filter(Boolean)
|
|
144
|
+
: [];
|
|
145
|
+
|
|
146
|
+
if (normalized.length > 0) return normalized;
|
|
147
|
+
|
|
148
|
+
const prompt = typeof fallbackPrompt === 'string' ? fallbackPrompt : '';
|
|
149
|
+
return prompt.trim() ? [{ type: 'text', text: prompt }] : [];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getChatInputText(chatInput, fallbackPrompt) {
|
|
153
|
+
const normalized = normalizeChatInput(chatInput, { prompt: fallbackPrompt });
|
|
154
|
+
return normalized.parts
|
|
155
|
+
.filter((part) => part.type === 'text' && typeof part.text === 'string')
|
|
156
|
+
.map((part) => part.text)
|
|
157
|
+
.join('\n\n')
|
|
158
|
+
.trim();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function getAttachedFilePaths(parts) {
|
|
162
|
+
if (!Array.isArray(parts)) return [];
|
|
163
|
+
return parts
|
|
164
|
+
.filter((part) => part && part.type === 'file')
|
|
165
|
+
.map((part) => firstString(part.computerPath, part.sandboxPath))
|
|
166
|
+
.filter(Boolean);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function buildPromptFromParts(parts, fallbackPrompt) {
|
|
170
|
+
const normalizedParts = normalizeChatParts(parts, fallbackPrompt);
|
|
171
|
+
const text = normalizedParts
|
|
172
|
+
.filter((part) => part.type === 'text' && typeof part.text === 'string')
|
|
173
|
+
.map((part) => part.text)
|
|
174
|
+
.join('\n\n')
|
|
175
|
+
.trim();
|
|
176
|
+
const attachedPaths = getAttachedFilePaths(normalizedParts);
|
|
177
|
+
|
|
178
|
+
if (attachedPaths.length === 0) {
|
|
179
|
+
return text || (typeof fallbackPrompt === 'string' ? fallbackPrompt : '');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const attachedPrefix = `[Attached files: ${attachedPaths.join(', ')}]`;
|
|
183
|
+
return text ? `${attachedPrefix}\n\n${text}` : attachedPrefix;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function normalizeChatInput(chatInput, legacy = {}) {
|
|
187
|
+
const rawInput = isObject(chatInput) ? chatInput : {};
|
|
188
|
+
const rawAgent = isObject(rawInput.agent) ? rawInput.agent : {};
|
|
189
|
+
const rawTools = isObject(rawInput.tools) ? rawInput.tools : {};
|
|
190
|
+
const rawExecution = isObject(rawInput.execution) ? rawInput.execution : {};
|
|
191
|
+
|
|
192
|
+
const workspace = normalizeWorkspace(
|
|
193
|
+
rawExecution.workspace,
|
|
194
|
+
firstString(rawExecution.cwd, legacy.cwd, legacy.projectPath),
|
|
195
|
+
);
|
|
196
|
+
const resolvedCwd = firstString(
|
|
197
|
+
rawExecution.cwd,
|
|
198
|
+
getWorkspaceCwd(workspace),
|
|
199
|
+
legacy.cwd,
|
|
200
|
+
legacy.projectPath,
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const normalized = {
|
|
204
|
+
parts: normalizeChatParts(
|
|
205
|
+
rawInput.parts,
|
|
206
|
+
Array.isArray(legacy.userParts) && legacy.userParts.length > 0
|
|
207
|
+
? null
|
|
208
|
+
: legacy.prompt,
|
|
209
|
+
),
|
|
210
|
+
agent: {
|
|
211
|
+
harness: firstString(rawAgent.harness, rawAgent.harnessId, legacy.harness),
|
|
212
|
+
model: firstString(rawAgent.model, rawAgent.modelId, legacy.modelId, legacy.model),
|
|
213
|
+
authMethod: firstString(rawAgent.authMethod, legacy.authMethod),
|
|
214
|
+
customAgentId: firstString(
|
|
215
|
+
rawAgent.customAgentId,
|
|
216
|
+
(typeof rawAgent.harness === 'string' && rawAgent.harness.startsWith('custom-'))
|
|
217
|
+
? rawAgent.harness
|
|
218
|
+
: null,
|
|
219
|
+
(typeof legacy.harness === 'string' && legacy.harness.startsWith('custom-'))
|
|
220
|
+
? legacy.harness
|
|
221
|
+
: null,
|
|
222
|
+
),
|
|
223
|
+
systemPrompt: firstString(rawAgent.systemPrompt, legacy.systemPrompt),
|
|
224
|
+
},
|
|
225
|
+
tools: {
|
|
226
|
+
mcpAppIds: uniqueStrings(rawTools.mcpAppIds || legacy.mcpAppIds),
|
|
227
|
+
mode: rawTools.mode === 'selected' || legacy.toolMode === 'selected' ? 'selected' : 'all',
|
|
228
|
+
toolIds: uniqueStrings(
|
|
229
|
+
rawTools.toolIds
|
|
230
|
+
|| rawTools.selectedToolIds
|
|
231
|
+
|| legacy.toolIds
|
|
232
|
+
|| legacy.selectedToolIds,
|
|
233
|
+
),
|
|
234
|
+
},
|
|
235
|
+
execution: {
|
|
236
|
+
cwd: resolvedCwd,
|
|
237
|
+
computerId: firstString(rawExecution.computerId, legacy.computerId),
|
|
238
|
+
workspace,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
return ChatInputSchema.parse(normalized);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function chatInputToLegacyFields(chatInput, fallback = {}) {
|
|
246
|
+
const normalized = normalizeChatInput(chatInput, fallback);
|
|
247
|
+
const prompt = buildPromptFromParts(normalized.parts, fallback.prompt);
|
|
248
|
+
const harness = firstString(
|
|
249
|
+
normalized.agent.customAgentId,
|
|
250
|
+
normalized.agent.harness,
|
|
251
|
+
fallback.harness,
|
|
252
|
+
);
|
|
253
|
+
const modelId = firstString(
|
|
254
|
+
normalized.agent.model,
|
|
255
|
+
fallback.modelId,
|
|
256
|
+
fallback.model,
|
|
257
|
+
);
|
|
258
|
+
const cwd = firstString(
|
|
259
|
+
normalized.execution.cwd,
|
|
260
|
+
getWorkspaceCwd(normalized.execution.workspace),
|
|
261
|
+
fallback.cwd,
|
|
262
|
+
fallback.projectPath,
|
|
263
|
+
);
|
|
264
|
+
const authMethod = firstString(
|
|
265
|
+
normalized.agent.authMethod,
|
|
266
|
+
fallback.authMethod,
|
|
267
|
+
);
|
|
268
|
+
const systemPrompt = firstString(
|
|
269
|
+
normalized.agent.systemPrompt,
|
|
270
|
+
fallback.systemPrompt,
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
prompt,
|
|
275
|
+
userParts: normalized.parts,
|
|
276
|
+
harness,
|
|
277
|
+
modelId,
|
|
278
|
+
model: modelId,
|
|
279
|
+
authMethod,
|
|
280
|
+
cwd,
|
|
281
|
+
projectPath: cwd,
|
|
282
|
+
computerId: firstString(normalized.execution.computerId, fallback.computerId),
|
|
283
|
+
mcpAppIds: normalized.tools.mcpAppIds,
|
|
284
|
+
systemPrompt,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function withChatInputText(chatInput, updater, legacy = {}) {
|
|
289
|
+
const normalized = normalizeChatInput(chatInput, legacy);
|
|
290
|
+
const parts = normalized.parts.map((part) => {
|
|
291
|
+
if (part.type !== 'text' || typeof part.text !== 'string') return part;
|
|
292
|
+
const nextText = updater(part.text, part);
|
|
293
|
+
return {
|
|
294
|
+
...part,
|
|
295
|
+
text: typeof nextText === 'string' ? nextText : part.text,
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
return normalizeChatInput({ ...normalized, parts });
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
module.exports = {
|
|
302
|
+
ChatInputPartSchema,
|
|
303
|
+
ChatInputSchema,
|
|
304
|
+
WorkspaceTargetSchema,
|
|
305
|
+
buildPromptFromParts,
|
|
306
|
+
chatInputToLegacyFields,
|
|
307
|
+
getAttachedFilePaths,
|
|
308
|
+
getChatInputText,
|
|
309
|
+
getWorkspaceCwd,
|
|
310
|
+
normalizeChatInput,
|
|
311
|
+
normalizeChatPart,
|
|
312
|
+
normalizeChatParts,
|
|
313
|
+
uniqueStrings,
|
|
314
|
+
withChatInputText,
|
|
315
|
+
};
|