MCPcopy Create free account
hub / github.com/arctic-cli/interface / generate

Function generate

packages/arctic/src/agent/agent.ts:254–290  ·  view source on GitHub ↗
(input: { description: string })

Source from the content-addressed store, hash-verified

252 }
253
254 export async function generate(input: { description: string }) {
255 const cfg = await Config.get()
256 const defaultModel = await Provider.defaultModel()
257 const model = await Provider.getModel(defaultModel.providerID, defaultModel.modelID)
258 const language = await Provider.getLanguage(model)
259 const system = SystemPrompt.header(defaultModel.providerID)
260 system.push(PROMPT_GENERATE)
261 const existing = await list()
262 const result = await generateObject({
263 experimental_telemetry: {
264 isEnabled: cfg.experimental?.openTelemetry,
265 metadata: {
266 userId: cfg.username ?? "unknown",
267 },
268 },
269 temperature: 0.3,
270 messages: [
271 ...system.map(
272 (item): ModelMessage => ({
273 role: "system",
274 content: item,
275 }),
276 ),
277 {
278 role: "user",
279 content: `Create an agent configuration based on this request: \"${input.description}\".\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${existing.map((i) => i.name).join(", ")}\n Return ONLY the JSON object, no other text, do not wrap in backticks`,
280 },
281 ],
282 model: language,
283 schema: z.object({
284 identifier: z.string(),
285 whenToUse: z.string(),
286 systemPrompt: z.string(),
287 }),
288 })
289 return result.object
290 }
291}
292
293function mergeAgentPermissions(basePermission: any, overridePermission: any): Agent.Info["permission"] {

Callers

nothing calls this directly

Calls 3

pushMethod · 0.80
listFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected