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

Function resolveSystemPrompt

packages/arctic/src/session/prompt.ts:840–865  ·  view source on GitHub ↗
(input: {
    system?: string
    agent: Agent.Info
    model: Provider.Model
    isLastStep?: boolean
  })

Source from the content-addressed store, hash-verified

838 }
839
840 async function resolveSystemPrompt(input: {
841 system?: string
842 agent: Agent.Info
843 model: Provider.Model
844 isLastStep?: boolean
845 }) {
846 let system = SystemPrompt.header(input.model.providerID)
847 system.push(
848 ...(() => {
849 if (input.system) return [input.system]
850 if (input.agent.prompt) return [input.agent.prompt]
851 return SystemPrompt.provider(input.model)
852 })(),
853 )
854 system.push(...(await SystemPrompt.environment()))
855 system.push(...(await SystemPrompt.custom()))
856
857 if (input.isLastStep) {
858 system.push(MAX_STEPS)
859 }
860
861 // max 2 system prompt messages for caching purposes
862 const [first, ...rest] = system
863 system = [first, rest.join("\n")]
864 return system
865 }
866
867 async function resolveTools(input: {
868 agent: Agent.Info

Callers 1

prompt.tsFile · 0.85

Calls 2

pushMethod · 0.80
providerMethod · 0.45

Tested by

no test coverage detected